1
0
mirror of https://shylinux.com/x/icebergs synced 2025-04-26 01:24:05 +08:00

opt login

This commit is contained in:
shylinux 2021-04-29 12:56:19 +08:00
parent 4b53831144
commit 54c26c1ea3
2 changed files with 9 additions and 5 deletions

View File

@ -4,6 +4,7 @@ import (
"github.com/gorilla/websocket"
ice "github.com/shylinux/icebergs"
"github.com/shylinux/icebergs/base/aaa"
"github.com/shylinux/icebergs/base/cli"
"github.com/shylinux/icebergs/base/mdb"
"github.com/shylinux/icebergs/base/tcp"
kit "github.com/shylinux/toolkits"
@ -254,7 +255,8 @@ func init() {
}
switch kind {
case "chrome":
m.Cmd(SPACE, name, "pwd", name)
link := kit.MergeURL(m.Conf(SHARE, kit.Keym(kit.MDB_DOMAIN)), "auth", name)
m.Cmd(SPACE, name, "pwd", name, link, m.Cmdx(cli.QRCODE, link))
}
frame := m.Target().Server().(*Frame)

View File

@ -53,11 +53,13 @@ func init() {
}},
P_HEADER: {Name: "/header", Help: "标题栏", Action: map[string]*ice.Action{
"auth": {Name: "auth share", Help: "用户授权", Hand: func(m *ice.Message, arg ...string) {
m.Cmd(web.SHARE, "auth", m.Option(web.SHARE), aaa.USERNAME, m.Option(ice.MSG_USERNAME))
"auth": {Name: "auth space", Help: "用户授权", Hand: func(m *ice.Message, arg ...string) {
if m.Option(ice.MSG_USERPOD) != "" {
m.Cmd(web.SPACE, m.Option(ice.MSG_USERPOD), m.Prefix(P_HEADER), kit.MDB_ACTION, "auth", arg)
return
}
space := m.Cmdy(web.SHARE, m.Option(web.SHARE)).Append(kit.MDB_NAME)
m.Cmd(web.SPACE, space, ice.MSG_SESSID, aaa.SessCreate(m, m.Option(ice.MSG_USERNAME)))
m.Cmd(web.SPACE, m.Option(web.SPACE), ice.MSG_SESSID, aaa.SessCreate(m, m.Option(ice.MSG_USERNAME)))
}},
APPLY: {Name: "apply", Help: "用户登录", Hand: func(m *ice.Message, arg ...string) {
m.Cmdy(web.SHARE, mdb.CREATE, kit.MDB_TYPE, web.APPLY, kit.MDB_NAME, m.Option(kit.MDB_NAME))