Merge pull request #370 from James-Sangalli/fix-missing-password-and-confirm-pasword-check

Fix: add missing check for password and confirm password check when backing up wallet
pull/377/head
James Sangalli 7 years ago committed by GitHub
commit 6888880426
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 1
      Trust/Localization/en.lproj/Localizable.strings
  2. 1
      Trust/Localization/es.lproj/Localizable.strings
  3. 1
      Trust/Localization/zh-Hans.lproj/Localizable.strings
  4. 13
      Trust/Wallet/ViewControllers/EnterPasswordViewController.swift

@ -270,3 +270,4 @@
"undefined.error" = "Undefined error";
"unknown.error" = "An unknown error occurred.";
"coming.soon" = "Coming soon";
"backupPassword.confirmation.mustMatch" = "You must enter the same passsword in Password and Confirm Password";

@ -270,3 +270,4 @@
"undefined.error" = "Undefined error";
"unknown.error" = "An unknown error occurred.";
"coming.soon" = "Coming soon";
"backupPassword.confirmation.mustMatch" = "You must enter the same passsword in Password and Confirm Password";

@ -270,3 +270,4 @@
"undefined.error" = "未知错误";
"unknown.error" = "出现未知错误.";
"coming.soon" = "Coming soon";
"backupPassword.confirmation.mustMatch" = "You must enter the same passsword in Password and Confirm Password";

@ -9,6 +9,12 @@ protocol EnterPasswordViewControllerDelegate: class {
}
class EnterPasswordViewController: FormViewController {
struct ValidationError: LocalizedError {
var msg: String
var errorDescription: String? {
return msg
}
}
struct Values {
static var password = "password"
@ -77,8 +83,13 @@ class EnterPasswordViewController: FormViewController {
@objc func done() {
guard
form.validate().isEmpty,
let password = passwordRow?.value
let password = passwordRow?.value,
let confirmPassword = confirmPasswordRow?.value
else { return }
guard password == confirmPassword else {
displayError(error: ValidationError(msg: R.string.localizable.backupPasswordConfirmationMustMatch()))
return
}
delegate?.didEnterPassword(password: password, for: account, in: self)
}

Loading…
Cancel
Save