Skip to content

Commit

Permalink
feat: check email regex in frontend
Browse files Browse the repository at this point in the history
  • Loading branch information
dacongda committed May 19, 2024
1 parent 6efec6b commit 9b4c9e5
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 is not valid Email!"));
}
}

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

0 comments on commit 9b4c9e5

Please sign in to comment.