Skip to content

Commit 454e419

Browse files
Merge pull request #1181 from yogeshpaliyal/fixCreatePasswordBug
feat: reset password field when moving to confirm password
2 parents 9bbc901 + 33f0815 commit 454e419

File tree

1 file changed

+17
-1
lines changed

1 file changed

+17
-1
lines changed

app/src/main/java/com/yogeshpaliyal/keypass/ui/auth/AuthScreen.kt

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,13 @@ import com.yogeshpaliyal.keypass.ui.redux.actions.NavigationAction
3030
import com.yogeshpaliyal.keypass.ui.redux.states.AuthState
3131
import org.reduxkotlin.compose.rememberDispatcher
3232

33+
/**
34+
* Displays the authentication screen and manages user input and navigation based on the current authentication state.
35+
*
36+
* Renders the appropriate UI for login, password creation, or password confirmation, handling state transitions, input validation, and navigation actions according to the provided [state].
37+
*
38+
* @param state The current authentication state determining which UI and logic to display.
39+
*/
3340
@Composable
3441
fun AuthScreen(state: AuthState) {
3542
val userSettings = LocalUserSettings.current
@@ -43,6 +50,15 @@ fun AuthScreen(state: AuthState) {
4350
dispatchAction(NavigationAction(AuthState.CreatePassword, true))
4451
}
4552

53+
// Reset password field when navigating to ConfirmPassword state
54+
LaunchedEffect(state) {
55+
if (state is AuthState.ConfirmPassword) {
56+
password.value = ""
57+
passwordVisible.value = false
58+
passwordError.value = null
59+
}
60+
}
61+
4662
LaunchedEffect(key1 = userSettings.keyPassPassword) {
4763
val mPassword = userSettings.keyPassPassword
4864
if (mPassword == null) {
@@ -103,4 +119,4 @@ fun AuthScreen(state: AuthState) {
103119
dispatchAction(it)
104120
}
105121
}
106-
}
122+
}

0 commit comments

Comments
 (0)