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

Add name field validation #984

Merged
merged 6 commits into from
Sep 25, 2024

Conversation

Mehrnaz-Charkhchi
Copy link
Contributor

Description

Add validation to the name field of registration for to prevent users from using non-ascii characters.

Views affected

https://www.ensembl.org/Multi/Account/Register
http://wp-np2-1e:8788/Multi/Account/Register

Possible complications

Since field type "Name" is added in this process it shouldn't affect other fields.

Merge conflicts

Related JIRA Issues (EBI developers only)

ENSWEB-6907

tests: {
'int': new RegExp(/^[\-+]?\d+$/),
'float': new RegExp(/^([\-+]?)(?=\d|\.\d)\d*(\.\d*)?([Ee]([\-+]?\d+))?$/),
password: new RegExp(/^\S{6,32}$/),
required: new RegExp(/(.|\s)*\S(.|\s)*/),
name: new RegExp(/^[\x00-\x7F]+$/),
Copy link
Contributor

Choose a reason for hiding this comment

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

Out of interest, did you try running this against some of the names we receive in RT:

  • 邮箱未激活
  • 张凯强
  • 回复

Copy link
Contributor Author

Choose a reason for hiding this comment

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

No but I did now. It does return the proper error.

Copy link
Contributor

Choose a reason for hiding this comment

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

When I add valid input values in the form on the sandbox the registration button is never enabled. There doesn't appear to be any javascript errors, and javascript seems to be working and it correctly shows an error when I include unicode. Do we know if the button will work in the live site but not in a sandbox, @Mehrnaz-Charkhchi ?

@jyothishnt
Copy link
Contributor

Hi @Mehrnaz-Charkhchi I searched for VALIDATION_CLASS in the entire Ensembl organisation and did not find any place where it is used. Am I missing something?

@azangru
Copy link
Contributor

azangru commented Nov 20, 2023

@jyothishnt it is used to add a class name to the form element, which is then targeted by javascript for validation.

See

$self->set_attribute('class', [$self->VALIDATION_CLASS, $params->{'required'} ? $self->CSS_CLASS_REQUIRED : $self->CSS_CLASS_OPTIONAL]);

@jyothishnt
Copy link
Contributor

Aah cool. Thanks I missed that one!

Copy link
Contributor

@jgtate jgtate left a comment

Choose a reason for hiding this comment

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

Issue with the register button remaining greyed out is to do with the sandbox site. We'll check it on staging or test before merging to postreleasefix/111 but it looks good otherwise.

@Mehrnaz-Charkhchi Mehrnaz-Charkhchi marked this pull request as draft November 28, 2023 14:30
@jyothishnt
Copy link
Contributor

@Mehrnaz-Charkhchi Any update on this?

@Mehrnaz-Charkhchi Mehrnaz-Charkhchi changed the base branch from postreleasefix/111 to postreleasefix/113 September 25, 2024 12:43
@Mehrnaz-Charkhchi Mehrnaz-Charkhchi marked this pull request as ready for review September 25, 2024 12:43
@Mehrnaz-Charkhchi Mehrnaz-Charkhchi merged commit 4dc9b56 into postreleasefix/113 Sep 25, 2024
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.

5 participants