-
Notifications
You must be signed in to change notification settings - Fork 377
fix(LoginPage): Improve inputs validation #936
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
fix(LoginPage): Improve inputs validation #936
Conversation
00c21df to
ec1ec6e
Compare
ec1ec6e to
ab9ec07
Compare
|
PatternFly-React preview: https://936-pr-patternfly-react-patternfly.surge.sh |
Pull Request Test Coverage Report for Build 3281
💛 - Coveralls |
| const { usernameField, passwordField } = this.state; | ||
| if (usernameField.value) { | ||
| !this.isUserNameValid() && this.handleOnInvalidUsername(); | ||
| !this.isEmailValid() && this.handleOnInvalidUsername(); |
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.
why? do you always assume that username is an email?
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.
Inside this function I validate only if it's an email, else return true
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.
what about that its not empty? e.g. I would expect the login btn to be disabled if there is no username / password or an ongoing authentication event in progress?
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 submit event will fire only if the form is valid,
Our validations currently covers:
- empty inputs errors
- capslock warning for passwords
- valid email
Your suggestion can be made by the consumer
by passing a disabled prop to the submitButton on submit event,
And it can be a great follow up PR.
| }; | ||
|
|
||
| isUserNameValid = () => { | ||
| isEmailValid = () => { |
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.
I think the method should remain as isUserNameValid, if follow-up PRs add more validation cases there would be no need to re-rename this method.
ab9ec07 to
4630769
Compare
As part of the LoginPage implementation in Foreman there need to be some fixes in inputs validation.