Skip to content

Commit

Permalink
feat: check signup item email regex in signup page (#2960)
Browse files Browse the repository at this point in the history
* feat: check email regex in frontend

* Update SignupPage.js

---------

Co-authored-by: Yang Luo <hsluoyz@qq.com>
  • Loading branch information
dacongda and hsluoyz committed May 19, 2024
1 parent 6efec6b commit c48306d
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions web/src/auth/SignupPage.js
Original file line number Diff line number Diff line change
Expand Up @@ -389,6 +389,14 @@ class SignupPage extends React.Component {
return Promise.reject(i18next.t("signup:The input is not valid Email!"));
}

if (signupItem.regex) {
const reg = new RegExp(signupItem.regex);
if (!reg.test(this.state.email)) {
this.setState({validEmail: false});
return Promise.reject(i18next.t("signup:The input Email doesn't match the signup item regex!"));
}
}

this.setState({validEmail: true});
return Promise.resolve();
},
Expand Down

0 comments on commit c48306d

Please sign in to comment.