Skip to content
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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

petermcneil
Copy link

…tion

Copy link
Member

@LePips LePips left a 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
Copy link
Member

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"))
Copy link
Member

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 {
Copy link
Member

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.

Suggested change
enum FocusField: Hashable {
private enum FocusField: Hashable {

.onSubmit {
focusedTextField = 1
if username.isEmpty {
Copy link
Member

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 }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants