Add iOS Password AutoFill support for login and registration
Enable system-level password generation and iCloud Keychain integration: RegisterView: - Add .textContentType(.username) to username field - Add .textContentType(.emailAddress) to email field - Add .textContentType(.newPassword) to password fields for Strong Password - iOS will suggest secure passwords and offer to save to Keychain LoginView: - Add .textContentType(.username) to email/username field - Add .textContentType(.password) to password fields - Enables AutoFill from saved Keychain credentials 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -89,6 +89,7 @@ struct LoginView: View {
|
||||
.textInputAutocapitalization(.never)
|
||||
.autocorrectionDisabled()
|
||||
.keyboardType(.emailAddress)
|
||||
.textContentType(.username)
|
||||
.focused($focusedField, equals: .username)
|
||||
.submitLabel(.next)
|
||||
.onSubmit {
|
||||
@@ -126,6 +127,7 @@ struct LoginView: View {
|
||||
TextField("Enter your password", text: $viewModel.password)
|
||||
.textInputAutocapitalization(.never)
|
||||
.autocorrectionDisabled()
|
||||
.textContentType(.password)
|
||||
.focused($focusedField, equals: .password)
|
||||
.submitLabel(.go)
|
||||
.onSubmit {
|
||||
@@ -134,6 +136,7 @@ struct LoginView: View {
|
||||
.accessibilityIdentifier(AccessibilityIdentifiers.Authentication.passwordField)
|
||||
} else {
|
||||
SecureField("Enter your password", text: $viewModel.password)
|
||||
.textContentType(.password)
|
||||
.focused($focusedField, equals: .password)
|
||||
.submitLabel(.go)
|
||||
.onSubmit {
|
||||
|
||||
@@ -37,6 +37,7 @@ struct RegisterView: View {
|
||||
TextField("Username", text: $viewModel.username)
|
||||
.textInputAutocapitalization(.never)
|
||||
.autocorrectionDisabled()
|
||||
.textContentType(.username)
|
||||
.focused($focusedField, equals: .username)
|
||||
.submitLabel(.next)
|
||||
.onSubmit {
|
||||
@@ -48,6 +49,7 @@ struct RegisterView: View {
|
||||
.textInputAutocapitalization(.never)
|
||||
.autocorrectionDisabled()
|
||||
.keyboardType(.emailAddress)
|
||||
.textContentType(.emailAddress)
|
||||
.focused($focusedField, equals: .email)
|
||||
.submitLabel(.next)
|
||||
.onSubmit {
|
||||
@@ -60,7 +62,10 @@ struct RegisterView: View {
|
||||
.listRowBackground(Color.appBackgroundSecondary)
|
||||
|
||||
Section {
|
||||
// Using .newPassword enables iOS Strong Password generation
|
||||
// iOS will automatically offer to save to iCloud Keychain after successful registration
|
||||
SecureField("Password", text: $viewModel.password)
|
||||
.textContentType(.newPassword)
|
||||
.focused($focusedField, equals: .password)
|
||||
.submitLabel(.next)
|
||||
.onSubmit {
|
||||
@@ -69,6 +74,7 @@ struct RegisterView: View {
|
||||
.accessibilityIdentifier(AccessibilityIdentifiers.Authentication.registerPasswordField)
|
||||
|
||||
SecureField("Confirm Password", text: $viewModel.confirmPassword)
|
||||
.textContentType(.newPassword)
|
||||
.focused($focusedField, equals: .confirmPassword)
|
||||
.submitLabel(.go)
|
||||
.onSubmit {
|
||||
@@ -78,7 +84,7 @@ struct RegisterView: View {
|
||||
} header: {
|
||||
Text("Security")
|
||||
} footer: {
|
||||
Text("Password must be secure")
|
||||
Text("Tap the password field for a strong password suggestion")
|
||||
}
|
||||
.listRowBackground(Color.appBackgroundSecondary)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user