mirror of
https://github.com/yunionio/cloudpods.git
synced 2026-09-24 16:03:43 +08:00
Merge pull request #1950 from swordqiu/feature/qj-keystone-reset-admin-user-password
feature: allow keystone reset sysadmin password at boot
This commit is contained in:
@@ -178,6 +178,19 @@ func (manager *SUserManager) initSysUser() error {
|
||||
return errors.Wrap(err, "query")
|
||||
}
|
||||
if cnt == 1 {
|
||||
// if ResetAdminUserPassword is true, reset sysadmin password
|
||||
if options.Options.ResetAdminUserPassword {
|
||||
usr := SUser{}
|
||||
usr.SetModelManager(manager, &usr)
|
||||
err = q.First(&usr)
|
||||
if err != nil {
|
||||
return errors.Wrap(err, "ResetAdminUserPassword Query user")
|
||||
}
|
||||
err = usr.initLocalData(options.Options.BootstrapAdminUserPassword)
|
||||
if err != nil {
|
||||
return errors.Wrap(err, "initLocalData")
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
if cnt > 2 {
|
||||
|
||||
@@ -31,6 +31,7 @@ type SKeystoneOptions struct {
|
||||
// SetupStateKey bool `help:"setup standalone fernet keys for openid state" token:"setup_state_key"`
|
||||
|
||||
BootstrapAdminUserPassword string `help:"bootstreap sysadmin user password" default:"sysadmin"`
|
||||
ResetAdminUserPassword bool `help:"reset sysadmin password if exists and this option is true"`
|
||||
|
||||
AutoSyncIntervalSeconds int `help:"frequency to check auto sync tasks" default:"30"`
|
||||
|
||||
|
||||
Reference in New Issue
Block a user