Drop password confirmation field
This commit is contained in:
parent
50c1984e6c
commit
edc513f6cc
|
@ -38,8 +38,6 @@ class AccountViewController: UIViewController, TableModelHost {
|
||||||
|
|
||||||
private weak var cellPassword: FieldTableViewCell?
|
private weak var cellPassword: FieldTableViewCell?
|
||||||
|
|
||||||
private weak var cellPasswordConfirmation: FieldTableViewCell?
|
|
||||||
|
|
||||||
var currentCredentials: Credentials?
|
var currentCredentials: Credentials?
|
||||||
|
|
||||||
var usernamePlaceholder: String?
|
var usernamePlaceholder: String?
|
||||||
|
@ -72,7 +70,7 @@ class AccountViewController: UIViewController, TableModelHost {
|
||||||
let model: TableModel<SectionType, RowType> = {
|
let model: TableModel<SectionType, RowType> = {
|
||||||
let model: TableModel<SectionType, RowType> = TableModel()
|
let model: TableModel<SectionType, RowType> = TableModel()
|
||||||
model.add(.only)
|
model.add(.only)
|
||||||
model.set([.username, .password, .passwordConfirmation], in: .only)
|
model.set([.username, .password], in: .only)
|
||||||
return model
|
return model
|
||||||
}()
|
}()
|
||||||
|
|
||||||
|
@ -113,13 +111,6 @@ class AccountViewController: UIViewController, TableModelHost {
|
||||||
}
|
}
|
||||||
|
|
||||||
@IBAction private func done() {
|
@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)
|
view.endEditing(true)
|
||||||
delegate?.accountControllerDidComplete(self)
|
delegate?.accountControllerDidComplete(self)
|
||||||
}
|
}
|
||||||
|
@ -139,8 +130,6 @@ extension AccountViewController: UITableViewDataSource, UITableViewDelegate, Fie
|
||||||
case username
|
case username
|
||||||
|
|
||||||
case password
|
case password
|
||||||
|
|
||||||
case passwordConfirmation
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private static let footerButtonTag = 1000
|
private static let footerButtonTag = 1000
|
||||||
|
@ -185,15 +174,6 @@ extension AccountViewController: UITableViewDataSource, UITableViewDelegate, Fie
|
||||||
cell.field.isSecureTextEntry = true
|
cell.field.isSecureTextEntry = true
|
||||||
cell.field.text = currentCredentials?.password
|
cell.field.text = currentCredentials?.password
|
||||||
cell.field.returnKeyType = .done
|
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.captionWidth = 120.0
|
||||||
cell.delegate = self
|
cell.delegate = self
|
||||||
|
@ -210,10 +190,7 @@ extension AccountViewController: UITableViewDataSource, UITableViewDelegate, Fie
|
||||||
cellPassword?.field.becomeFirstResponder()
|
cellPassword?.field.becomeFirstResponder()
|
||||||
|
|
||||||
case cellPassword:
|
case cellPassword:
|
||||||
cellPasswordConfirmation?.field.becomeFirstResponder()
|
cellPassword?.field.resignFirstResponder()
|
||||||
|
|
||||||
case cellPasswordConfirmation:
|
|
||||||
cellPasswordConfirmation?.field.resignFirstResponder()
|
|
||||||
done()
|
done()
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
|
|
@ -113,8 +113,8 @@
|
||||||
"account.cells.username.placeholder" = "username";
|
"account.cells.username.placeholder" = "username";
|
||||||
"account.cells.password.caption" = "Password";
|
"account.cells.password.caption" = "Password";
|
||||||
"account.cells.password.placeholder" = "secret";
|
"account.cells.password.placeholder" = "secret";
|
||||||
"account.cells.password_confirm.caption" = "Confirm";
|
//"account.cells.password_confirm.caption" = "Confirm";
|
||||||
"account.cells.password_confirm.mismatch" = "Passwords don't match!";
|
//"account.cells.password_confirm.mismatch" = "Passwords don't match!";
|
||||||
|
|
||||||
"endpoint.sections.location_addresses.header" = "Addresses";
|
"endpoint.sections.location_addresses.header" = "Addresses";
|
||||||
"endpoint.sections.location_protocols.header" = "Protocols";
|
"endpoint.sections.location_protocols.header" = "Protocols";
|
||||||
|
|
|
@ -65,13 +65,6 @@ internal enum L10n {
|
||||||
internal static let placeholder = L10n.tr("Localizable", "account.cells.password.placeholder")
|
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 {
|
internal enum Username {
|
||||||
/// Username
|
/// Username
|
||||||
internal static let caption = L10n.tr("Localizable", "account.cells.username.caption")
|
internal static let caption = L10n.tr("Localizable", "account.cells.username.caption")
|
||||||
|
|
Loading…
Reference in New Issue