Skip to content

Commit c53cfcf

Browse files
fix: update password view to match UI
1 parent 0825807 commit c53cfcf

1 file changed

Lines changed: 35 additions & 29 deletions

File tree

FirebaseSwiftUI/FirebaseAuthSwiftUI/Sources/Views/UpdatePasswordView.swift

Lines changed: 35 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
//
1919
// Created by Russell Wheatley on 24/04/2025.
2020
//
21-
21+
import FirebaseAuthUIComponents
2222
import FirebaseCore
2323
import SwiftUI
2424

@@ -48,32 +48,32 @@ extension UpdatePasswordView: View {
4848
}
4949

5050
public var body: some View {
51-
VStack {
52-
LabeledContent {
53-
SecureField(authService.string.passwordInputLabel, text: $password)
54-
.focused($focus, equals: .password)
55-
.submitLabel(.go)
56-
} label: {
57-
Image(systemName: "lock")
58-
}
59-
.padding(.vertical, 6)
60-
.background(Divider(), alignment: .bottom)
61-
.padding(.bottom, 8)
62-
63-
Divider()
64-
65-
LabeledContent {
66-
SecureField(authService.string.confirmPasswordInputLabel, text: $confirmPassword)
67-
.focused($focus, equals: .confirmPassword)
68-
.submitLabel(.go)
69-
} label: {
70-
Image(systemName: "lock")
71-
}
72-
.padding(.vertical, 6)
73-
.background(Divider(), alignment: .bottom)
74-
.padding(.bottom, 8)
51+
VStack(spacing: 24) {
52+
AuthTextField(
53+
text: $password,
54+
localizedTitle: "Type new password",
55+
prompt: authService.string.passwordInputLabel,
56+
contentType: .password,
57+
sensitive: true,
58+
leading: {
59+
Image(systemName: "lock")
60+
}
61+
)
62+
.submitLabel(.go)
63+
.focused($focus, equals: .password)
7564

76-
Divider()
65+
AuthTextField(
66+
text: $confirmPassword,
67+
localizedTitle: "Retype new password",
68+
prompt: authService.string.confirmPasswordInputLabel,
69+
contentType: .password,
70+
sensitive: true,
71+
leading: {
72+
Image(systemName: "lock")
73+
}
74+
)
75+
.submitLabel(.go)
76+
.focused($focus, equals: .confirmPassword)
7777

7878
Button(action: {
7979
Task {
@@ -90,14 +90,20 @@ extension UpdatePasswordView: View {
9090
.padding([.top, .bottom], 8)
9191
.frame(maxWidth: .infinity)
9292
.buttonStyle(.borderedProminent)
93-
}.sheet(isPresented: isShowingPasswordPrompt) {
93+
}
94+
.frame(maxWidth: .infinity, maxHeight: .infinity, alignment: .top)
95+
.safeAreaPadding()
96+
.navigationTitle(authService.string.passwordRecoveryTitle)
97+
.sheet(isPresented: isShowingPasswordPrompt) {
9498
PasswordPromptSheet(coordinator: authService.passwordPrompt)
9599
}
96100
}
97101
}
98102

99103
#Preview {
100104
FirebaseOptions.dummyConfigurationForPreview()
101-
return UpdatePasswordView()
102-
.environment(AuthService())
105+
return NavigationStack {
106+
UpdatePasswordView()
107+
.environment(AuthService())
108+
}
103109
}

0 commit comments

Comments
 (0)