-
Notifications
You must be signed in to change notification settings - Fork 839
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
PM-9532: pt2. separate vault unlock logic and fail out on error durin…
…g login. (#3609)
- Loading branch information
1 parent
a090000
commit 18cd66a
Showing
13 changed files
with
716 additions
and
149 deletions.
There are no files selected for viewing
288 changes: 185 additions & 103 deletions
288
app/src/main/java/com/x8bit/bitwarden/data/auth/repository/AuthRepositoryImpl.kt
Large diffs are not rendered by default.
Oops, something went wrong.
15 changes: 15 additions & 0 deletions
15
app/src/main/java/com/x8bit/bitwarden/data/auth/repository/model/LoginResultExtensions.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
package com.x8bit.bitwarden.data.auth.repository.model | ||
|
||
import com.x8bit.bitwarden.data.vault.repository.model.VaultUnlockError | ||
import com.x8bit.bitwarden.data.vault.repository.model.VaultUnlockResult | ||
|
||
/** | ||
* Helper function to map a [VaultUnlockError] to a [LoginResult.Error] with | ||
* the necessary `message` if applicable. | ||
*/ | ||
fun VaultUnlockError.toLoginErrorResult(): LoginResult.Error = when (this) { | ||
is VaultUnlockResult.AuthenticationError -> LoginResult.Error(this.message) | ||
VaultUnlockResult.GenericError, | ||
VaultUnlockResult.InvalidStateError, | ||
-> LoginResult.Error(errorMessage = null) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -43,6 +43,7 @@ import com.x8bit.bitwarden.ui.platform.components.scaffold.BitwardenScaffold | |
import com.x8bit.bitwarden.ui.platform.components.text.BitwardenClickableText | ||
import com.x8bit.bitwarden.ui.platform.components.toggle.BitwardenSwitch | ||
import com.x8bit.bitwarden.ui.platform.components.util.rememberVectorPainter | ||
import com.x8bit.bitwarden.ui.platform.theme.BitwardenTheme | ||
|
||
/** | ||
* The top level composable for the Reset Password screen. | ||
|
@@ -230,26 +231,28 @@ private fun TrustedDeviceDialogs( | |
@Preview | ||
@Composable | ||
private fun TrustedDeviceScaffold_preview() { | ||
TrustedDeviceScaffold( | ||
state = TrustedDeviceState( | ||
dialogState = null, | ||
isRemembered = false, | ||
emailAddress = "[email protected]", | ||
environmentLabel = "vault.bitwarden.pw", | ||
showContinueButton = false, | ||
showOtherDeviceButton = true, | ||
showRequestAdminButton = true, | ||
showMasterPasswordButton = true, | ||
), | ||
handlers = TrustedDeviceHandlers( | ||
onBackClick = {}, | ||
onDismissDialog = {}, | ||
onRememberToggle = {}, | ||
onContinueClick = {}, | ||
onApproveWithAdminClick = {}, | ||
onApproveWithDeviceClick = {}, | ||
onApproveWithPasswordClick = {}, | ||
onNotYouButtonClick = {}, | ||
), | ||
) | ||
BitwardenTheme { | ||
TrustedDeviceScaffold( | ||
state = TrustedDeviceState( | ||
dialogState = null, | ||
isRemembered = false, | ||
emailAddress = "[email protected]", | ||
environmentLabel = "vault.bitwarden.pw", | ||
showContinueButton = false, | ||
showOtherDeviceButton = true, | ||
showRequestAdminButton = true, | ||
showMasterPasswordButton = true, | ||
), | ||
handlers = TrustedDeviceHandlers( | ||
onBackClick = {}, | ||
onDismissDialog = {}, | ||
onRememberToggle = {}, | ||
onContinueClick = {}, | ||
onApproveWithAdminClick = {}, | ||
onApproveWithDeviceClick = {}, | ||
onApproveWithPasswordClick = {}, | ||
onNotYouButtonClick = {}, | ||
), | ||
) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.