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

Can I validate user input w/o subsequent signup? Only validation #1054

Closed
wzup opened this issue Jun 19, 2018 · 9 comments
Closed

Can I validate user input w/o subsequent signup? Only validation #1054

wzup opened this issue Jun 19, 2018 · 9 comments
Labels
feature-request Request a new feature UI Related to UI Components

Comments

@wzup
Copy link

wzup commented Jun 19, 2018

Do you want to request a feature or report a bug?

Issue

What is the current behavior?

DOn't know, can't find methods in docs

What is the expected behavior?

Validate user input WITHOUT subsequent sign up action. Please see example below

        // method like this, no subsequent signup, just validate
        Auth.verifySignupInput()
            .then(response => {
                // input is valid
            })
            .catch( err => {
                // input is invalid
                // pasword is short
                // email doesn't have @ sign
            });

// currently validation is done in exactly during signUp action.
Auth.signUp( email, password )

SO question
https://stackoverflow.com/questions/50922919/can-i-validate-user-input-w-o-subsequent-signup-only-validation-no-signup

@haverchuck haverchuck added the investigating This issue is being investigated label Jun 19, 2018
@haverchuck haverchuck self-assigned this Jun 19, 2018
@haverchuck
Copy link
Contributor

Hi @wzup ,

Thanks for reaching out. Can you please clarify what you mean by 'validate' user input? Specifically - do you mean validate that the inputs fall within predefined parameters (for example, correct password length and character restrictions) or do you mean validate that the actual user credentials (username/password combination) are correct?

If you are actually trying to verify that the credentials are correct, can you please give a little more detail about your usecase - why would you want to do this without lgging the user in? It would help us answer your question or take action.

Thanks so much.

@wzup
Copy link
Author

wzup commented Jun 21, 2018

@haverchuck

This variant:

do you mean validate that the inputs fall within predefined parameters (for example, correct password length and character restrictions)

Because there is Policies section where for example you can set up password strength:

screen shot 2018-06-21 at 9 19 52 am

So we end up having password restrictions in Cognito, but not on client-side. We have to manually create regex that match Cognito's settings to validate a password client-side. Why this duplication? It is redundant. Same applies to email string.

Currently I use validate.js. But why if it would be better to use single source of validation - exactly in Cognito?

Auth.isPasswordValid('password')
Auth.isEmailValid('email')

@haverchuck
Copy link
Contributor

@wzup
So essentially you're trying to avoid calls to the backend that you already know will result in a failure because of the field constraints?

@haverchuck
Copy link
Contributor

Hi @wzup

Just checking in on this issue - are you asking for a UI component that will get the input restrictions form Cognito in advance of the user making a signUp call?

@wzup
Copy link
Author

wzup commented Jul 4, 2018

@haverchuck

that will get the input restrictions form Cognito in advance

This also possible.

The idea is to have one source of validators. If I set validators in Cognito, let's use it on the client as well. Either by making a request like validatePassword( {method: POST, password: 'zxcvb567'} ) or as you say by getting the input restrictions form Cognito in advance.

Currently it is not possible. I have to create validators (regex string) on the client that matches my Cognito's validators.

@haverchuck
Copy link
Contributor

I'm marking this as a feature request.

@haverchuck haverchuck added feature-request Request a new feature and removed investigating This issue is being investigated labels Jul 10, 2018
@jordanranz jordanranz added this to the UI Components Refactor milestone May 9, 2019
@jordanranz
Copy link
Contributor

FYI, we have started an RFC discussion for a proposed Amplify UI Component refactor to increase customizability and flexibility for our components. Please feel free to add any additional comments to the following issue:

#3279

@sammartinez sammartinez added the UI Related to UI Components label Oct 8, 2019
@harrysolovay
Copy link
Contributor

Unfortunately this is not something that we could implement. If you'd like this feature (a service feature), it would require a new endpoint and new validation functionality. I recommend going into your AWS Console, navigating to Cognito, and submitting feedback (bottom left-hand corner).

@github-actions
Copy link

This issue has been automatically locked since there hasn't been any recent activity after it was closed. Please open a new issue for related bugs.

Looking for a help forum? We recommend joining the Amplify Community Discord server *-help channels or Discussions for those types of questions.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Nov 13, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
feature-request Request a new feature UI Related to UI Components
Projects
None yet
Development

No branches or pull requests

5 participants