show/hide password when signing up

This commit is contained in:
Stuart Breckenridge 2020-12-06 08:00:34 +08:00
parent 32506b25ae
commit 841da2d570
No known key found for this signature in database
GPG Key ID: 1F11FD62007DC331
4 changed files with 53 additions and 3 deletions

View File

@ -18,7 +18,6 @@ class AddFeedlyViewModel: ObservableObject, OAuthAccountAuthorizationOperationDe
@Published var showError: Bool = false
@Published var username: String = ""
@Published var password: String = ""
@Published var showPassword: Bool = false
func authenticateFeedly() {
isAuthenticating = true

View File

@ -19,6 +19,7 @@ class AddNewsBlurViewModel: ObservableObject, AddAccountSignUp {
@Published var username: String = ""
@Published var password: String = ""
@Published var canDismiss: Bool = false
@Published var showPassword: Bool = false
func authenticateNewsBlur() {
isAuthenticating = true

View File

@ -34,7 +34,32 @@ struct AddFeedWranglerAccountView: View {
.scaleEffect(CGSize(width: 0.5, height: 0.5))
.hidden(!model.isAuthenticating) , content: {
TextField("me@email.com", text: $model.username)
SecureField("•••••••••••", text: $model.password)
if model.showPassword == false {
ZStack {
HStack {
SecureField("Password", text: $model.password)
Spacer()
Image(systemName: "eye.fill")
.foregroundColor(.accentColor)
.onTapGesture {
model.showPassword = true
}
}
}
}
else {
ZStack {
HStack {
TextField("Password", text: $model.password)
Spacer()
Image(systemName: "eye.slash.fill")
.foregroundColor(.accentColor)
.onTapGesture {
model.showPassword = false
}
}
}
}
})
}.navigationBarItems(leading:
Button(action: {

View File

@ -32,7 +32,32 @@ struct AddNewsBlurAccountView: View {
.scaleEffect(CGSize(width: 0.5, height: 0.5))
.hidden(!model.isAuthenticating) , content: {
TextField("me@email.com", text: $model.username)
SecureField("•••••••••••", text: $model.password)
if model.showPassword == false {
ZStack {
HStack {
SecureField("Password", text: $model.password)
Spacer()
Image(systemName: "eye.fill")
.foregroundColor(.accentColor)
.onTapGesture {
model.showPassword = true
}
}
}
}
else {
ZStack {
HStack {
TextField("Password", text: $model.password)
Spacer()
Image(systemName: "eye.slash.fill")
.foregroundColor(.accentColor)
.onTapGesture {
model.showPassword = false
}
}
}
}
})
}.navigationBarItems(leading:
Button(action: {