Skip to content

Conversation

@Ron-Lavi
Copy link
Collaborator

As part of the LoginPage implementation in Foreman there need to be some fixes in inputs validation.

@Ron-Lavi Ron-Lavi force-pushed the fix/login-page-validation branch from 00c21df to ec1ec6e Compare November 18, 2018 15:26
@Ron-Lavi Ron-Lavi changed the title Fix/login page validation fix(LoginPage): Improve inputs validation Nov 18, 2018
@Ron-Lavi Ron-Lavi force-pushed the fix/login-page-validation branch from ec1ec6e to ab9ec07 Compare November 18, 2018 15:32
@patternfly-build
Copy link
Collaborator

PatternFly-React preview: https://936-pr-patternfly-react-patternfly.surge.sh

@coveralls
Copy link

coveralls commented Nov 18, 2018

Pull Request Test Coverage Report for Build 3281

  • 9 of 10 (90.0%) changed or added relevant lines in 1 file are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage decreased (-0.005%) to 81.397%

Changes Missing Coverage Covered Lines Changed/Added Lines %
packages/patternfly-3/patternfly-react/src/components/LoginPage/components/LoginCardComponents/LoginCardWithValidation.js 9 10 90.0%
Totals Coverage Status
Change from base Build 3269: -0.005%
Covered Lines: 3868
Relevant Lines: 4480

💛 - Coveralls

const { usernameField, passwordField } = this.state;
if (usernameField.value) {
!this.isUserNameValid() && this.handleOnInvalidUsername();
!this.isEmailValid() && this.handleOnInvalidUsername();
Copy link
Member

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?

Copy link
Collaborator Author

@Ron-Lavi Ron-Lavi Nov 19, 2018

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

Copy link
Member

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?

Copy link
Collaborator Author

@Ron-Lavi Ron-Lavi Nov 19, 2018

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

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.

@Ron-Lavi Ron-Lavi force-pushed the fix/login-page-validation branch from ab9ec07 to 4630769 Compare November 19, 2018 13:41
@dgutride dgutride merged commit 60c1067 into patternfly:master Nov 19, 2018
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.

7 participants