Autofilling new password with confirmation

I've added 3 UITextFields to create a new account by entering a username in eMail address format, a new password and a password confirmation. As suggested in https://developer.apple.com/documentation/security/password_autofill/enabling_password_autofill_on_a_text_input_view

i have configured the username field like this

userTextField.textContentType = .username
userTextField.keyboardType = .emailAddress

and the new password fields like this

newPasswordTextField.textContentType = .newPassword
confirmPasswordTextField.textContentType = .newPassword

Now, when the users enters an eMail address as username the newPasswordTextField is pre-filled with a suggestion for a strong password (as expected), but the confirmPasswordTextField isn't filled with the same suggested password.

When the user directly taps into the newPasswordTextField without entering a username before both newPasswordTextField and confirmPasswordTextField are pre-filled with the same suggested password (also as suggested).

How can i combine this both situations that after the user enters a username both password fields will be pre-filled with the same password?

Replies

I've the exact same issue. I simplified my UI for having just 3 textfields (username, password1, password2) stacked vertically and I got the same behavior.

Entering the username, then taping on password1, just auto-fills password1.

Entering the username, then taping on password2 works (ios autofills both the second and third fields).

If I change the order of these fields in the parent view (without changin the x-y position), nothing changes.

The example on https://developerinsider.co/ios12-password-autofill-automatic-strong-password-and-security-code-autofill/ works because the username textfield is disabled. As soos as you enable it and enter some text in it, the behavior is as described above.

  • could you find an elegant way to handle this? I can not disable my username to make the strong password textfields work in my app.

Add a Comment

I have have the exact same issue. But when I use:

userTextField.textContentType = .username
userTextField.keyboardType = .emailAddress
newPasswordTextField.textContentType = .password
confirmPasswordTextField.textContentType = .newPassword

I got both new and confirm password filled, but the listener on the confirmPasswordTextField is not called.

Did anyone find a solution?

  • have you found any solution? in here they say we should use .newPassword for both

Add a Comment