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

Adding real time validation to signup #3452

Merged
merged 38 commits into from
May 20, 2020

Conversation

tabshaikh
Copy link
Collaborator

@tabshaikh tabshaikh commented May 9, 2020

Issue: #3256

Closes #1433

Todo:

  • change api to check email id and screen name instead of hardwiring it to a true/false
  • shift js to its respective directory and ask @jdlrobson for correct placement for js
  • change the function to use blur

@tabshaikh tabshaikh added this to To Do in Tabish GSoC 2020 via automation May 9, 2020
@cdrini
Copy link
Collaborator

cdrini commented May 11, 2020

Let's not do this on keyup; it creates a bit of a disruptive experience to get errors thrown at you are you're typing. Let's do this on blur instead. I checked Google, Apple, Adobe, Amazon, Spotify; none of them give feedback as you type. Also validate before the form is submitted.

Copy link
Collaborator

@jdlrobson jdlrobson left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Happy to review any patches that pull out the JS from the template separately!

Tabish GSoC 2020 automation moved this from To Do to In progress May 11, 2020
@tabshaikh
Copy link
Collaborator Author

Let's not do this on keyup; it creates a bit of a disruptive experience to get errors thrown at you are you're typing. Let's do this on blur instead. I checked Google, Apple, Adobe, Amazon, Spotify; none of them give feedback as you type. Also validate before the form is submitted.

@cdrini was planning to add throttling/debouncing like we have in search, I have a few issues with blur which we can discuss on the call :)

@cdrini
Copy link
Collaborator

cdrini commented May 11, 2020

👍 Let's talk about it tomorrow!

@mekarpeles mekarpeles marked this pull request as draft May 11, 2020 20:23
@tabshaikh tabshaikh marked this pull request as ready for review May 16, 2020 19:19
@tabshaikh tabshaikh requested a review from jdlrobson May 16, 2020 19:20
@tabshaikh tabshaikh changed the title Mockup for real time signup validation Adding real time validation to signup May 16, 2020
openlibrary/plugins/upstream/account.py Outdated Show resolved Hide resolved
openlibrary/plugins/upstream/account.py Outdated Show resolved Hide resolved
openlibrary/plugins/upstream/account.py Outdated Show resolved Hide resolved
openlibrary/plugins/upstream/account.py Outdated Show resolved Hide resolved
openlibrary/plugins/upstream/account.py Outdated Show resolved Hide resolved
openlibrary/plugins/upstream/account.py Outdated Show resolved Hide resolved
tabshaikh and others added 4 commits May 18, 2020 18:53
Co-authored-by: Christian Clauss <cclauss@me.com>
Co-authored-by: Christian Clauss <cclauss@me.com>
Co-authored-by: Christian Clauss <cclauss@me.com>
Co-authored-by: Michael E. Karpeles <michael.karpeles@gmail.com>
Co-authored-by: Michael E. Karpeles <michael.karpeles@gmail.com>
Co-authored-by: Michael E. Karpeles <michael.karpeles@gmail.com>
tabshaikh and others added 2 commits May 20, 2020 22:10
Co-authored-by: Michael E. Karpeles <michael.karpeles@gmail.com>
Co-authored-by: Michael E. Karpeles <michael.karpeles@gmail.com>
Copy link
Member

@mekarpeles mekarpeles left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's open a new issue to sweep over this file and make sure it has the right ES6 syntax (e.g. const v. var / let).

@mekarpeles mekarpeles changed the base branch from improvingSignUp to master May 20, 2020 16:53
var value_email = $(this).val();
if (!value_email=='') {
$.ajax({
url: `/account/validate?email=${value_email}`,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We may have to urlencode + for the email. Otherwise, the API call will treat it as a space. This would means we would also have to urlencode the email on the other side.

encodeURIComponent from js (before we do the ajax request)
unquote_plus on the backend (within API)

def validate_username(username):
if not 3 <= len(username) <= 20:
return _('Username must be between 3-20 characters')
if not re.match('^[A-Za-z0-9-_]{3,20}$', username):
Copy link
Member

@mekarpeles mekarpeles May 20, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggestion: We should try to DRY this regex since we're now using it in 2 different places.

Copy link
Member

@mekarpeles mekarpeles left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Turns out, we only needed to uriencode on the frontend and then everything worked.

openlibrary/plugins/upstream/account.py Outdated Show resolved Hide resolved
openlibrary/plugins/upstream/account.py Outdated Show resolved Hide resolved
@mekarpeles mekarpeles merged commit 71d044d into internetarchive:master May 20, 2020
Tabish GSoC 2020 automation moved this from In progress to Done May 20, 2020
@cclauss
Copy link
Collaborator

cclauss commented May 20, 2020

Nice!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
State: Work In Progress This issue is being actively worked on. [managed]
Projects
No open projects
Development

Successfully merging this pull request may close these issues.

Add Realtime Validation to Account Registration Page Realtime
6 participants