mirror of
https://github.com/yunionio/cloudpods.git
synced 2026-09-24 16:03:43 +08:00
Merge pull request #4451 from swordqiu/feature/qj-skip-user-create-password-complexity-check
feature: allow skip password complexity check when creating user
This commit is contained in:
@@ -159,6 +159,8 @@ func init() {
|
||||
Enabled bool `help:"Enabled"`
|
||||
Disabled bool `help:"Disabled"`
|
||||
|
||||
SkipPasswordComplexityCheck bool `help:"do password complexity check, default is false"`
|
||||
|
||||
// DefaultProject string `help:"Default project"`
|
||||
SystemAccount bool `help:"is a system account?"`
|
||||
NoWebConsole bool `help:"allow web console access"`
|
||||
@@ -176,6 +178,9 @@ func init() {
|
||||
}
|
||||
if args.Password != nil {
|
||||
params.Add(jsonutils.NewString(*args.Password), "password")
|
||||
if args.SkipPasswordComplexityCheck {
|
||||
params.Add(jsonutils.JSONTrue, "skip_password_complexity_check")
|
||||
}
|
||||
}
|
||||
if len(args.Displayname) > 0 {
|
||||
params.Add(jsonutils.NewString(args.Displayname), "displayname")
|
||||
|
||||
@@ -389,7 +389,7 @@ func (manager *SUserManager) FilterByHiddenSystemAttributes(q *sqlchemy.SQuery,
|
||||
}
|
||||
|
||||
func (manager *SUserManager) ValidateCreateData(ctx context.Context, userCred mcclient.TokenCredential, ownerId mcclient.IIdentityProvider, query jsonutils.JSONObject, data *jsonutils.JSONDict) (*jsonutils.JSONDict, error) {
|
||||
if data.Contains("password") {
|
||||
if data.Contains("password") && !jsonutils.QueryBoolean(data, "skip_password_complexity_check", false) {
|
||||
passwd, _ := data.GetString("password")
|
||||
err := validatePasswordComplexity(passwd)
|
||||
if err != nil {
|
||||
|
||||
Reference in New Issue
Block a user