π End-to-end encrypted cloud for everything.
Dart 2faandroidauthye2eeencryptionend-to-end-encryptionfluttergolanggoogle-photosgoogle-photos-alternativeiosopensourcephotosprivacyprivacy-toolstypescriptzero-knowledge
update login password screen
AmanRajSinghMourya5878e384bf5c
diff --git a/mobile/apps/photos/lib/ui/account/email_entry_page.dart b/mobile/apps/photos/lib/ui/account/email_entry_page.dartindex 78b1dc34cf..5e56f1562f 100644--- a/mobile/apps/photos/lib/ui/account/email_entry_page.dart+++ b/mobile/apps/photos/lib/ui/account/email_entry_page.dart@@ -217,6 +217,7 @@ class _EmailEntryPageState extends State<EmailEntryPage> {isRequired: true,autoCorrect: false,autofillHints: const [],+ finishAutofillContextOnEditingComplete: true,message: confirmPasswordMessage,messageType: confirmPasswordMessageType,onChange: (cnfPassword) {diff --git a/mobile/apps/photos/lib/ui/account/login_pwd_verification_page.dart b/mobile/apps/photos/lib/ui/account/login_pwd_verification_page.dartindex da95a28dd8..390f6734db 100644--- a/mobile/apps/photos/lib/ui/account/login_pwd_verification_page.dart+++ b/mobile/apps/photos/lib/ui/account/login_pwd_verification_page.dart@@ -7,9 +7,14 @@ import 'package:photos/core/configuration.dart';import "package:photos/generated/l10n.dart";import "package:photos/models/api/user/srp.dart";import "package:photos/services/account/user_service.dart";+import "package:photos/theme/colors.dart";import "package:photos/theme/ente_theme.dart";-import 'package:photos/ui/common/dynamic_fab.dart';-import "package:photos/ui/components/buttons/button_widget.dart";+import "package:photos/theme/text_style.dart";+import "package:photos/ui/common/dynamic_fab.dart";+import "package:photos/ui/components/buttons/button_widget.dart"+ show ButtonAction;+import "package:photos/ui/components/buttons/button_widget_v2.dart";+import "package:photos/ui/components/text_input_widget_v2.dart";import "package:photos/utils/dialog_util.dart";import "package:photos/utils/email_util.dart";@@ -31,10 +36,8 @@ class LoginPasswordVerificationPage extends StatefulWidget {class _LoginPasswordVerificationPageStateextends State<LoginPasswordVerificationPage> {final _passwordController = TextEditingController();- final FocusNode _passwordFocusNode = FocusNode();String? email;- bool _passwordInFocus = false;- bool _passwordVisible = false;+ bool _hasPassword = false;final Logger _logger = Logger("LoginPasswordVerificationPage");@override@@ -43,23 +46,20 @@ class _LoginPasswordVerificationPageStateemail = Configuration.instance.getEmail();if (kDebugMode) {_passwordController.text = const String.fromEnvironment("password");+ _hasPassword = _passwordController.text.isNotEmpty;}- _passwordFocusNode.addListener(() {- setState(() {- _passwordInFocus = _passwordFocusNode.hasFocus;- });- });}@overridevoid dispose() {_passwordController.dispose();- _passwordFocusNode.dispose();super.dispose();}@overrideWidget build(BuildContext context) {+ final colorScheme = getEnteColorScheme(context);+ final textTheme = getEnteTextTheme(context);final isKeypadOpen = MediaQuery.of(context).viewInsets.bottom > 100;FloatingActionButtonLocation? fabLocation() {@@ -72,21 +72,31 @@ class _LoginPasswordVerificationPageStatereturn Scaffold(resizeToAvoidBottomInset: isKeypadOpen,+ backgroundColor: colorScheme.backgroundColour,appBar: AppBar(elevation: 0,+ scrolledUnderElevation: 0,+ backgroundColor: colorScheme.backgroundColour,leading: IconButton(icon: const Icon(Icons.arrow_back),- color: Theme.of(context).iconTheme.color,+ color: colorScheme.content,onPressed: () {Navigator.of(context).pop();},),+ title: Text(+ "ente",+ style: textTheme.h3Bold.copyWith(+ fontFamily: "Montserrat",+ ),+ ),+ centerTitle: true,),- body: _getBody(),+ body: _getBody(colorScheme, textTheme),floatingActionButton: DynamicFAB(key: const ValueKey("verifyPasswordButton"),isKeypadOpen: isKeypadOpen,- isFormValid: _passwordController.text.isNotEmpty,+ isFormValid: _hasPassword,buttonText: AppLocalizations.of(context).logInLabel,onPressedFunction: () async {FocusScope.of(context).unfocus();@@ -98,6 +108,61 @@ class _LoginPasswordVerificationPageState);}+ Widget _getBody(EnteColorScheme colorScheme, EnteTextTheme textTheme) {+ return AutofillGroup(+ child: ListView(+ padding: const EdgeInsets.symmetric(horizontal: 16),+ children: [+ const SizedBox(height: 24),+ Visibility(+ visible: false,+ child: TextFormField(+ autofillHints: const [AutofillHints.email],+ autocorrect: false,+ keyboardType: TextInputType.emailAddress,+ initialValue: email,+ textInputAction: TextInputAction.next,+ ),+ ),+ TextInputWidgetV2(+ key: const ValueKey("passwordInputField"),+ label: AppLocalizations.of(context).password,+ hintText: AppLocalizations.of(context).enterYourPassword,+ textEditingController: _passwordController,+ isPasswordInput: true,+ isRequired: true,+ autoCorrect: false,+ autoFocus: true,+ onChange: (value) {+ final hasPassword = value.isNotEmpty;+ if (_hasPassword != hasPassword) {+ setState(() {+ _hasPassword = hasPassword;+ });+ }+ },+ ),+ const SizedBox(height: 12),+ Align(+ alignment: Alignment.centerRight,+ child: ButtonWidgetV2(+ buttonType: ButtonTypeV2.link,+ labelText: AppLocalizations.of(context).forgotPassword,+ buttonSize: ButtonSizeV2.small,+ onTap: () async {+ await UserService.instance.sendOtt(+ context,+ email!,+ isResetPasswordScreen: true,+ );+ },+ ),+ ),+ ],+ ),+ );+ }+Future<void> verifyPassword(BuildContext context, String password) async {final dialog = createProgressDialog(context,@@ -200,159 +265,4 @@ class _LoginPasswordVerificationPageState);}}-- Widget _getBody() {- return Column(- children: [- Expanded(- child: AutofillGroup(- child: ListView(- children: [- Padding(- padding: const EdgeInsets.only(top: 30, left: 20, right: 20),- child: Text(- AppLocalizations.of(context).enterPassword,- style: Theme.of(context).textTheme.headlineMedium,- ),- ),- Padding(- padding: const EdgeInsets.only(- bottom: 30,- left: 22,- right: 20,- ),- child: Text(- email ?? '',- style: getEnteTextTheme(context).smallMuted,- ),- ),- Visibility(- // hidden textForm for suggesting auto-fill service for saving- // password- visible: false,- child: TextFormField(- autofillHints: const [- AutofillHints.email,- ],- autocorrect: false,- keyboardType: TextInputType.emailAddress,- initialValue: email,- textInputAction: TextInputAction.next,- ),- ),- Padding(- padding: const EdgeInsets.fromLTRB(20, 24, 20, 0),- child: TextFormField(- key: const ValueKey("passwordInputField"),- autofillHints: const [AutofillHints.password],- decoration: InputDecoration(- hintText: AppLocalizations.of(context).enterYourPassword,- filled: true,- contentPadding: const EdgeInsets.all(20),- border: UnderlineInputBorder(- borderSide: BorderSide.none,- borderRadius: BorderRadius.circular(6),- ),- fillColor: getEnteColorScheme(context).fillFaint,- suffixIcon: _passwordInFocus- ? IconButton(- icon: Icon(- _passwordVisible- ? Icons.visibility- : Icons.visibility_off,- color: Theme.of(context).iconTheme.color,- size: 20,- ),- onPressed: () {- setState(() {- _passwordVisible = !_passwordVisible;- });- },- )- : null,- ),- style: const TextStyle(- fontSize: 14,- ),- controller: _passwordController,- autofocus: true,- autocorrect: false,- obscureText: !_passwordVisible,- keyboardType: TextInputType.visiblePassword,- focusNode: _passwordFocusNode,- onChanged: (_) {- setState(() {});- },- ),- ),- Padding(- padding: const EdgeInsets.symmetric(vertical: 18),- child: Divider(- thickness: 1,- color: getEnteColorScheme(context).strokeFaint,- ),- ),- Padding(- padding: const EdgeInsets.symmetric(horizontal: 20),- child: Row(- mainAxisAlignment: MainAxisAlignment.spaceBetween,- children: [- GestureDetector(- behavior: HitTestBehavior.opaque,- onTap: () async {- await UserService.instance.sendOtt(- context,- email!,- isResetPasswordScreen: true,- );- },- child: Center(- child: Text(- AppLocalizations.of(context).forgotPassword,- style: Theme.of(context)- .textTheme- .titleMedium!- .copyWith(- fontSize: 14,- decoration: TextDecoration.underline,- ),- ),- ),- ),- GestureDetector(- behavior: HitTestBehavior.opaque,- onTap: () async {- final dialog = createProgressDialog(- context,- AppLocalizations.of(context).pleaseWait,- );- await dialog.show();- await Configuration.instance.logout();- await dialog.hide();- Navigator.of(context)- .popUntil((route) => route.isFirst);- },- child: Center(- child: Text(- AppLocalizations.of(context).changeEmail,- style: Theme.of(context)- .textTheme- .titleMedium!- .copyWith(- fontSize: 14,- decoration: TextDecoration.underline,- ),- ),- ),- ),- ],- ),- ),- ],- ),- ),- ),- ],- );- }}