-
-
Notifications
You must be signed in to change notification settings - Fork 272
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Change password to be a SecureField and autosubmit on password comple… #1090
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for your contribution, just some changes.
@@ -74,9 +77,13 @@ struct UserSignInView: View { | |||
.foregroundStyle(.red, .red.opacity(0.2)) | |||
} else { | |||
Button(L10n.signIn) { | |||
focusedTextField = nil |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These changes aren't necessary:
1 - the button is disabled if username
is empty (see other comment about colors)
2 - an empty password is a valid password
@@ -49,20 +53,19 @@ struct UserSignInView: View { | |||
@ViewBuilder | |||
private var signInSection: some View { | |||
Section { | |||
TextField(L10n.username, text: $username) | |||
TextField(L10n.username, text: $username, prompt: Text("Required")) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The first parameter is already the prompt, which I'm fine with just being the username label. So, the new prompt is no longer required. I don't have a design for any indicators for what fields are required except for the sign in button which should have dynamic colors for whether it can be selected or not (but it just hasn't been implemented because I needed to take a break from tvOS). I'm not worried about people being confused about knowing if username is required, because that's basic requirement of the entire Jellyfin user system.
@@ -16,6 +16,10 @@ import SwiftUI | |||
// TODO: change public users from list to grid | |||
|
|||
struct UserSignInView: View { | |||
enum FocusField: Hashable { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please put an empty line above FocusField
as well, please.
enum FocusField: Hashable { | |
private enum FocusField: Hashable { |
.onSubmit { | ||
focusedTextField = 1 | ||
if username.isEmpty { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use guard
instead:
guard username.isNotEmpty else { return }
…tion