Skip to content
This repository has been archived by the owner on May 10, 2024. It is now read-only.

Commit

Permalink
Fix #443: Display time out details for incorrect passcode lockdown
Browse files Browse the repository at this point in the history
  • Loading branch information
kylehickinson committed Nov 18, 2019
1 parent eb689ba commit a925ab8
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
4 changes: 3 additions & 1 deletion BraveShared/BraveStrings.swift
Original file line number Diff line number Diff line change
Expand Up @@ -288,7 +288,9 @@ extension Strings {

public static let AuthenticationIncorrectAttemptsRemaining = NSLocalizedString("AuthenticationIncorrectAttemptsRemaining", tableName: "BraveShared", bundle: Bundle.braveShared, value: "Incorrect passcode. Try again (Attempts remaining: %d).", comment: "Error message displayed when user enters incorrect passcode when trying to enter a protected section of the app with attempts remaining")

public static let AuthenticationMaximumAttemptsReached = NSLocalizedString("AuthenticationMaximumAttemptsReached", tableName: "BraveShared", bundle: Bundle.braveShared, value: "Maximum attempts reached. Please try again in an hour.", comment: "Error message displayed when user enters incorrect passcode and has reached the maximum number of attempts.")
public static let AuthenticationMaximumAttemptsReached = NSLocalizedString("AuthenticationMaximumAttemptsReached", tableName: "BraveShared", bundle: Bundle.braveShared, value: "Too many failed attempts. Please try again in %d minutes.", comment: "Error message displayed when user enters incorrect passcode and has reached the maximum number of attempts.")

public static let AuthenticationMaximumAttemptsReachedOneMinute = NSLocalizedString("AuthenticationMaximumAttemptsReachedOneMinute", tableName: "BraveShared", bundle: Bundle.braveShared, value: "Too many failed attempts. Please try again in 1 minute.", comment: "Error message displayed when user enters incorrect passcode and has reached the maximum number of attempts.")

public static let AuthenticationMaximumAttemptsReachedNoTime = NSLocalizedString("AuthenticationMaximumAttemptsReachedNoTime", tableName: "BraveShared", bundle: Bundle.braveShared, value: "Maximum attempts reached. Please try again later.", comment: "Error message displayed when user enters incorrect passcode and has reached the maximum number of attempts.")

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,16 @@ extension BasePasscodeViewController {
}

func displayLockoutError() {
displayError(Strings.AuthenticationMaximumAttemptsReachedNoTime)
if let timeLeft = authenticationInfo?.lockoutTimeLeft {
let inMinutes = Int(ceil(timeLeft / 60))
if inMinutes == 1 {
displayError(Strings.AuthenticationMaximumAttemptsReachedOneMinute)
} else {
displayError(String.localizedStringWithFormat(Strings.AuthenticationMaximumAttemptsReached, inMinutes))
}
} else {
displayError(Strings.AuthenticationMaximumAttemptsReachedNoTime)
}
}

func failMismatchPasscode() {
Expand Down

0 comments on commit a925ab8

Please sign in to comment.