From edc513f6cc6ec598e721da63c72294cd3a083328 Mon Sep 17 00:00:00 2001 From: Davide De Rosa Date: Mon, 22 Oct 2018 22:16:59 +0200 Subject: [PATCH] Drop password confirmation field --- .../Scenes/AccountViewController.swift | 27 ++----------------- .../Resources/en.lproj/Localizable.strings | 4 +-- Passepartout/Sources/SwiftGen+Strings.swift | 7 ----- 3 files changed, 4 insertions(+), 34 deletions(-) diff --git a/Passepartout-iOS/Scenes/AccountViewController.swift b/Passepartout-iOS/Scenes/AccountViewController.swift index f20fcbda..c324a2df 100644 --- a/Passepartout-iOS/Scenes/AccountViewController.swift +++ b/Passepartout-iOS/Scenes/AccountViewController.swift @@ -38,8 +38,6 @@ class AccountViewController: UIViewController, TableModelHost { private weak var cellPassword: FieldTableViewCell? - private weak var cellPasswordConfirmation: FieldTableViewCell? - var currentCredentials: Credentials? var usernamePlaceholder: String? @@ -72,7 +70,7 @@ class AccountViewController: UIViewController, TableModelHost { let model: TableModel = { let model: TableModel = TableModel() model.add(.only) - model.set([.username, .password, .passwordConfirmation], in: .only) + model.set([.username, .password], in: .only) return model }() @@ -113,13 +111,6 @@ class AccountViewController: UIViewController, TableModelHost { } @IBAction private func done() { - guard cellPassword?.field.text == cellPasswordConfirmation?.field.text else { - let alert = Macros.alert(title, L10n.Account.Cells.PasswordConfirm.mismatch) - alert.addCancelAction(L10n.Global.ok) - present(alert, animated: true, completion: nil) - return - } - view.endEditing(true) delegate?.accountControllerDidComplete(self) } @@ -139,8 +130,6 @@ extension AccountViewController: UITableViewDataSource, UITableViewDelegate, Fie case username case password - - case passwordConfirmation } private static let footerButtonTag = 1000 @@ -185,15 +174,6 @@ extension AccountViewController: UITableViewDataSource, UITableViewDelegate, Fie cell.field.isSecureTextEntry = true cell.field.text = currentCredentials?.password cell.field.returnKeyType = .done - - case .passwordConfirmation: - cellPasswordConfirmation = cell - cell.caption = L10n.Account.Cells.PasswordConfirm.caption - cell.field.placeholder = L10n.Account.Cells.Password.placeholder - cell.field.clearButtonMode = .always - cell.field.isSecureTextEntry = true - cell.field.text = currentCredentials?.password - cell.field.returnKeyType = .done } cell.captionWidth = 120.0 cell.delegate = self @@ -210,10 +190,7 @@ extension AccountViewController: UITableViewDataSource, UITableViewDelegate, Fie cellPassword?.field.becomeFirstResponder() case cellPassword: - cellPasswordConfirmation?.field.becomeFirstResponder() - - case cellPasswordConfirmation: - cellPasswordConfirmation?.field.resignFirstResponder() + cellPassword?.field.resignFirstResponder() done() default: diff --git a/Passepartout/Resources/en.lproj/Localizable.strings b/Passepartout/Resources/en.lproj/Localizable.strings index 24aa0f54..dd1df5a5 100644 --- a/Passepartout/Resources/en.lproj/Localizable.strings +++ b/Passepartout/Resources/en.lproj/Localizable.strings @@ -113,8 +113,8 @@ "account.cells.username.placeholder" = "username"; "account.cells.password.caption" = "Password"; "account.cells.password.placeholder" = "secret"; -"account.cells.password_confirm.caption" = "Confirm"; -"account.cells.password_confirm.mismatch" = "Passwords don't match!"; +//"account.cells.password_confirm.caption" = "Confirm"; +//"account.cells.password_confirm.mismatch" = "Passwords don't match!"; "endpoint.sections.location_addresses.header" = "Addresses"; "endpoint.sections.location_protocols.header" = "Protocols"; diff --git a/Passepartout/Sources/SwiftGen+Strings.swift b/Passepartout/Sources/SwiftGen+Strings.swift index 3afea6c4..f24fdb90 100644 --- a/Passepartout/Sources/SwiftGen+Strings.swift +++ b/Passepartout/Sources/SwiftGen+Strings.swift @@ -65,13 +65,6 @@ internal enum L10n { internal static let placeholder = L10n.tr("Localizable", "account.cells.password.placeholder") } - internal enum PasswordConfirm { - /// Confirm - internal static let caption = L10n.tr("Localizable", "account.cells.password_confirm.caption") - /// Passwords don't match! - internal static let mismatch = L10n.tr("Localizable", "account.cells.password_confirm.mismatch") - } - internal enum Username { /// Username internal static let caption = L10n.tr("Localizable", "account.cells.username.caption")