From a16bb8e721dcfded73c7ddb5b6aa6ad3b251c318 Mon Sep 17 00:00:00 2001 From: Taras Smakula <tarassmakula@gmail.com> Date: Fri, 1 Mar 2024 15:13:59 +0200 Subject: [PATCH] Add forgot password confirmation --- .../org/futo/circles/auth/feature/log_in/LogInFragment.kt | 5 ++++- .../java/org/futo/circles/auth/model/ConfirmationType.kt | 8 +++++++- auth/src/main/res/values/strings.xml | 1 + 3 files changed, 12 insertions(+), 2 deletions(-) diff --git a/auth/src/main/java/org/futo/circles/auth/feature/log_in/LogInFragment.kt b/auth/src/main/java/org/futo/circles/auth/feature/log_in/LogInFragment.kt index a6f945892..b0be875df 100644 --- a/auth/src/main/java/org/futo/circles/auth/feature/log_in/LogInFragment.kt +++ b/auth/src/main/java/org/futo/circles/auth/feature/log_in/LogInFragment.kt @@ -15,6 +15,7 @@ import org.futo.circles.auth.R import org.futo.circles.auth.databinding.FragmentLogInBinding import org.futo.circles.auth.feature.log_in.switch_user.list.SwitchUsersAdapter import org.futo.circles.auth.feature.log_in.switch_user.list.SwitchUsersViewHolder +import org.futo.circles.auth.model.ForgotPassword import org.futo.circles.auth.model.RemoveUser import org.futo.circles.core.base.CirclesAppConfig import org.futo.circles.core.base.NetworkObserver @@ -119,7 +120,9 @@ class LogInFragment : Fragment(R.layout.fragment_log_in), HasLoadingState { findNavController().navigateSafe(LogInFragmentDirections.toSignUpFragment()) } btnLogin.setOnClickListener { startLogin(false) } - btnForgotPassword.setOnClickListener { startLogin(true) } + btnForgotPassword.setOnClickListener { + withConfirmation(ForgotPassword()) { startLogin(true) } + } } } diff --git a/auth/src/main/java/org/futo/circles/auth/model/ConfirmationType.kt b/auth/src/main/java/org/futo/circles/auth/model/ConfirmationType.kt index c1e5c6799..ac7d8d417 100644 --- a/auth/src/main/java/org/futo/circles/auth/model/ConfirmationType.kt +++ b/auth/src/main/java/org/futo/circles/auth/model/ConfirmationType.kt @@ -24,11 +24,17 @@ data class LogOut( data class RemoveSession( override val titleRes: Int = R.string.remove_session, override val messageRes: Int = R.string.remove_session_message, - override val positiveButtonRes: Int = org.futo.circles.core.R.string.remove + override val positiveButtonRes: Int = org.futo.circles.core.R.string.remove ) : ConfirmationType(titleRes, messageRes, positiveButtonRes) data class ResetKeys( override val titleRes: Int = R.string.reset_keys, override val messageRes: Int = R.string.reset_keys_message, override val positiveButtonRes: Int = R.string.confirm +) : ConfirmationType(titleRes, messageRes, positiveButtonRes) + +data class ForgotPassword( + override val titleRes: Int = R.string.forgot_password, + override val messageRes: Int = R.string.forgot_password_message, + override val positiveButtonRes: Int = R.string.confirm ) : ConfirmationType(titleRes, messageRes, positiveButtonRes) \ No newline at end of file diff --git a/auth/src/main/res/values/strings.xml b/auth/src/main/res/values/strings.xml index 98e154e56..a0368d8b4 100644 --- a/auth/src/main/res/values/strings.xml +++ b/auth/src/main/res/values/strings.xml @@ -104,6 +104,7 @@ <string name="remove_session_message">In order to sign out from this session you should confirm your auth.</string> <string name="reset_keys">Reset keys</string> <string name="reset_keys_message">Confirm auth to reset keys and enable cross signing</string> + <string name="forgot_password_message">After verifying your email the new password and key backup will be set.\n\nWarning: With a new key backup you will not be able to see all your previous encrypted messages, this action can not be undone.</string> <string name="confirm">Confirm</string> <string name="failed_to_read_qr_code">Failed to read QR code</string> <string name="current_session">Current session</string> -- GitLab