mirror of
https://github.com/casdoor/casdoor.git
synced 2025-05-23 02:35:49 +08:00
feat: password and invitation code verification rules (#2258)
This commit is contained in:
parent
9da2f0775f
commit
7970edeaa7
@ -140,13 +140,6 @@ func (c *ApiController) Signup() {
|
|||||||
username = id
|
username = id
|
||||||
}
|
}
|
||||||
|
|
||||||
password := authForm.Password
|
|
||||||
msg = object.CheckPasswordComplexityByOrg(organization, password)
|
|
||||||
if msg != "" {
|
|
||||||
c.ResponseError(msg)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
initScore, err := organization.GetInitScore()
|
initScore, err := organization.GetInitScore()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
c.ResponseError(fmt.Errorf(c.T("account:Get init score failed, error: %w"), err).Error())
|
c.ResponseError(fmt.Errorf(c.T("account:Get init score failed, error: %w"), err).Error())
|
||||||
|
@ -66,8 +66,11 @@ func CheckUserSignup(application *Application, organization *Organization, form
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if len(form.Password) <= 5 {
|
if application.IsSignupItemVisible("Password") {
|
||||||
return i18n.Translate(lang, "check:Password must have at least 6 characters")
|
msg := CheckPasswordComplexityByOrg(organization, form.Password)
|
||||||
|
if msg != "" {
|
||||||
|
return msg
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if application.IsSignupItemVisible("Email") {
|
if application.IsSignupItemVisible("Email") {
|
||||||
@ -126,7 +129,9 @@ func CheckUserSignup(application *Application, organization *Organization, form
|
|||||||
|
|
||||||
if len(application.InvitationCodes) > 0 {
|
if len(application.InvitationCodes) > 0 {
|
||||||
if form.InvitationCode == "" {
|
if form.InvitationCode == "" {
|
||||||
|
if application.IsSignupItemRequired("Invitation code") {
|
||||||
return i18n.Translate(lang, "check:Invitation code cannot be blank")
|
return i18n.Translate(lang, "check:Invitation code cannot be blank")
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
if !util.InSlice(application.InvitationCodes, form.InvitationCode) {
|
if !util.InSlice(application.InvitationCodes, form.InvitationCode) {
|
||||||
return i18n.Translate(lang, "check:Invitation code is invalid")
|
return i18n.Translate(lang, "check:Invitation code is invalid")
|
||||||
|
@ -137,7 +137,7 @@ class SignupTable extends React.Component {
|
|||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Switch checked={text} onChange={checked => {
|
<Switch checked={text} disabled={record.name === "Password"} onChange={checked => {
|
||||||
this.updateField(table, index, "required", checked);
|
this.updateField(table, index, "required", checked);
|
||||||
}} />
|
}} />
|
||||||
);
|
);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user