feat: Allow to sign up with Email without verification (#728)

* feat: Allow to sign up with Email without verification by rule

* Update account.go

* Update SignupTable.js

* Update SignupPage.js

Co-authored-by: Yang Luo <hsluoyz@qq.com>
This commit is contained in:
Resulte Lee
2022-05-02 17:19:40 +08:00
committed by GitHub
parent 4acba2d493
commit c4089eacb7
5 changed files with 27 additions and 19 deletions

View File

@ -116,7 +116,7 @@ func (c *ApiController) Signup() {
return
}
if application.IsSignupItemVisible("Email") && form.Email != "" {
if application.IsSignupItemVisible("Email") && application.GetSignupItemRule("Email") != "No verification" && form.Email != "" {
checkResult := object.CheckVerificationCode(form.Email, form.EmailCode)
if len(checkResult) != 0 {
c.ResponseError(fmt.Sprintf("Email: %s", checkResult))

View File

@ -109,7 +109,7 @@ func initBuiltInApplication() {
{Name: "Display name", Visible: true, Required: true, Prompted: false, Rule: "None"},
{Name: "Password", Visible: true, Required: true, Prompted: false, Rule: "None"},
{Name: "Confirm password", Visible: true, Required: true, Prompted: false, Rule: "None"},
{Name: "Email", Visible: true, Required: true, Prompted: false, Rule: "None"},
{Name: "Email", Visible: true, Required: true, Prompted: false, Rule: "Normal"},
{Name: "Phone", Visible: true, Required: true, Prompted: false, Rule: "None"},
{Name: "Agreement", Visible: true, Required: true, Prompted: false, Rule: "None"},
},

View File

@ -43,7 +43,7 @@ class ApplicationListPage extends BaseListPage {
{name: "Display name", visible: true, required: true, rule: "None"},
{name: "Password", visible: true, required: true, rule: "None"},
{name: "Confirm password", visible: true, required: true, rule: "None"},
{name: "Email", visible: true, required: true, rule: "None"},
{name: "Email", visible: true, required: true, rule: "Normal"},
{name: "Phone", visible: true, required: true, rule: "None"},
{name: "Agreement", visible: true, required: true, rule: "None"},
],

View File

@ -159,7 +159,7 @@ class SignupTable extends React.Component {
title: i18next.t("provider:rule"),
dataIndex: 'rule',
key: 'rule',
width: '120px',
width: '155px',
render: (text, record, index) => {
let options = [];
if (record.name === "ID") {
@ -167,12 +167,17 @@ class SignupTable extends React.Component {
{id: 'Random', name: 'Random'},
{id: 'Incremental', name: 'Incremental'},
];
} if (record.name === "Display name") {
} else if (record.name === "Display name") {
options = [
{id: 'None', name: 'None'},
{id: 'Real name', name: 'Real name'},
{id: 'First, last', name: 'First, last'},
];
} else if (record.name === "Email") {
options = [
{id: 'Normal', name: 'Normal'},
{id: 'No Verification', name: 'No verification'},
];
}
if (options.length === 0) {

View File

@ -325,6 +325,8 @@ class SignupPage extends React.Component {
>
<Input onChange={e => this.setState({email: e.target.value})} />
</Form.Item>
{
signupItem.rule !== "No verification" &&
<Form.Item
name="emailCode"
key="emailCode"
@ -339,6 +341,7 @@ class SignupPage extends React.Component {
onButtonClickArgs={[this.state.email, "email", Setting.getApplicationOrgName(application)]}
/>
</Form.Item>
}
</React.Fragment>
)
} else if (signupItem.name === "Phone") {