diff --git a/base/aaa/user.go b/base/aaa/user.go index 05c3f8b9..bc4d1dba 100644 --- a/base/aaa/user.go +++ b/base/aaa/user.go @@ -30,7 +30,11 @@ func _user_create(m *ice.Message, role, name, word string) { return } if word == "" { - word = kit.Hashs() + if m.Richs(USER, nil, name, func(key string, value map[string]interface{}) { + word = kit.Format(value[PASSWORD]) + }) == nil { + word = kit.Hashs() + } } m.Rich(USER, nil, kit.Dict(USERROLE, role, USERNAME, name, PASSWORD, word)) m.Event(USER_CREATE, USER, name) @@ -44,11 +48,11 @@ func _user_search(m *ice.Message, name, text string) { } func UserRoot(m *ice.Message, arg ...string) { // password username userrole - userrole := kit.Select(ROOT, arg, 2) - username := kit.Select(kit.Select("root", ice.Info.UserName), arg, 1) - m.Option(ice.MSG_USERROLE, userrole) - m.Option(ice.MSG_USERNAME, username) - _user_create(m, userrole, username, kit.Select("", arg, 0)) + userrole := m.Option(ice.MSG_USERROLE, kit.Select(ROOT, arg, 2)) + username := m.Option(ice.MSG_USERNAME, kit.Select(kit.Select(ROOT, ice.Info.UserName), arg, 1)) + if len(arg) > 0 { + _user_create(m, userrole, username, kit.Select("", arg, 0)) + } } func UserRole(m *ice.Message, username interface{}) (role string) { if role = VOID; username == ice.Info.UserName { diff --git a/base/cli/system.go b/base/cli/system.go index aa5f7625..018b5925 100644 --- a/base/cli/system.go +++ b/base/cli/system.go @@ -30,12 +30,10 @@ func _system_cmd(m *ice.Message, arg ...string) *exec.Cmd { // 环境变量 env := kit.Simple(m.Optionv(CMD_ENV)) for i := 0; i < len(env)-1; i += 2 { - cmd.Env = append(cmd.Env, kit.Format("%s=%s", env[i], env[i+1])) - if env[i] == PATH { + if cmd.Env = append(cmd.Env, kit.Format("%s=%s", env[i], env[i+1])); env[i] == PATH { if file := _system_find(m, arg[0], strings.Split(env[i+1], ice.DF)...); file != "" { m.Debug("cmd: %v", file) cmd.Path = file - continue } } } diff --git a/core/code/template.go b/core/code/template.go index 92602bda..8e89204a 100644 --- a/core/code/template.go +++ b/core/code/template.go @@ -58,7 +58,6 @@ func init() { ice.Cmd("{{.Option "key"}}", {{.Option "name"}}{}) } m.Option("tags", "`"+m.Option("tags")+"`") if buf, err := kit.Render(m.Option(mdb.TEXT), m); !m.Warn(err) { m.Cmd(nfs.DEFS, path.Join(m.Option(nfs.PATH), m.Option(nfs.FILE)), string(buf)) - m.Debug("what %v", m.FormatMeta()) switch kit.Ext(m.Option(nfs.FILE)) { case GO: if m.Option(MAIN) != "" && m.Option(mdb.ZONE) != "" {