1
0
mirror of https://shylinux.com/x/icebergs synced 2025-04-25 17:18:05 +08:00
This commit is contained in:
IT 老营长 @云轩领航-创始人 2025-01-22 16:12:23 +08:00
parent 50ba5c3a3f
commit 524bbf6430
2 changed files with 34 additions and 9 deletions

View File

@ -0,0 +1,33 @@
package center
import (
"shylinux.com/x/ice"
"shylinux.com/x/icebergs/base/aaa"
"shylinux.com/x/icebergs/base/mdb"
"shylinux.com/x/icebergs/base/web"
)
type password struct {
change string `name:"change" help:"修改登录"`
login string `name:"login username* password*" help:"登录" role:"void"`
list string `name:"list refresh" help:"密码登录" role:"void"`
}
func (s password) Change(m *ice.Message, arg ...string) {
m.Cmd(aaa.USER, mdb.MODIFY, aaa.USERNAME, m.Option(ice.MSG_USERNAME), aaa.PASSWORD, arg[1])
}
func (s password) Login(m *ice.Message, arg ...string) {
if m.WarnNotValid(m.Option(aaa.PASSWORD) != m.Cmd(aaa.USER, m.Option(aaa.USERNAME)).Append(aaa.PASSWORD), aaa.PASSWORD) {
return
}
web.RenderCookie(m.Message, aaa.SessCreate(m.Message, m.Option(aaa.USERNAME)))
}
func (s password) List(m *ice.Message, arg ...string) {
if m.Option(ice.MSG_USERNAME) == "" {
m.DisplayForm("username*", "password*", s.Login)
} else {
m.DisplayForm("password*", s.Change)
}
}
func init() { ice.Cmd("web.chat.password", password{}) }

View File

@ -1,11 +1,3 @@
package chat
import ice "shylinux.com/x/icebergs"
func init() {
Index.MergeCommands(ice.Commands{
"password": {Name: "password", Hand: func(m *ice.Message, arg ...string) {
m.Echo("hello world")
}},
})
}
func init() {}