Consider password-confirmation on signup (#690)
This is now the logic-part. The passwords must be the same to register.
This commit is contained in:
parent
f3c8c3c2a3
commit
a107b4d9e2
|
@ -150,10 +150,15 @@ final class MastodonRegisterViewModel: ObservableObject {
|
|||
.assign(to: \.emailValidateState, on: self)
|
||||
.store(in: &disposeBag)
|
||||
|
||||
$password
|
||||
.map { password in
|
||||
Publishers.CombineLatest($password, $passwordConfirmation)
|
||||
.map { password, confirmation in
|
||||
guard !password.isEmpty else { return .empty }
|
||||
return password.count >= 8 ? .valid : .invalid
|
||||
|
||||
if password.count >= 8 && password == confirmation {
|
||||
return .valid
|
||||
} else {
|
||||
return .invalid
|
||||
}
|
||||
}
|
||||
.assign(to: \.passwordValidateState, on: self)
|
||||
.store(in: &disposeBag)
|
||||
|
|
Loading…
Reference in New Issue