1
0
mirror of https://shylinux.com/x/ContextOS synced 2025-04-25 16:58:06 +08:00

add aaa.email

This commit is contained in:
shaoying 2019-07-02 20:40:43 +08:00
parent 2af0963fd2
commit 42d66bbd94
6 changed files with 30 additions and 2 deletions

View File

@ -9,6 +9,7 @@ install:
@go get github.com/gomarkdown/markdown
@go get github.com/PuerkitoBio/goquery
@go get github.com/go-cas/cas
@go get github.com/gopkg.in/gomail.v2
GOPATH=$(PWD):$(GOPATH) go install $(BENCH)
@date
# bench web.code.counter nmake 1

View File

@ -1,6 +1,7 @@
package aaa
import (
"gopkg.in/gomail.v2"
"contexts/ctx"
"crypto"
"crypto/aes"
@ -128,6 +129,11 @@ var Index = &ctx.Context{Name: "aaa", Help: "认证中心",
}, Help: "散列"},
"expire": &ctx.Config{Name: "expire(s)", Value: "72000", Help: "会话超时"},
"email": &ctx.Config{Name: "email", Value: map[string]interface{}{
"self": "shylinux@163.com",
"smtp": "smtp.163.com",
"port": "25",
}, Help: "会话超时"},
},
Commands: map[string]*ctx.Command{
"_init": &ctx.Command{Name: "_init", Help: "数字摘要", Hand: func(m *ctx.Message, c *ctx.Context, key string, arg ...string) (e error) {
@ -712,6 +718,21 @@ var Index = &ctx.Context{Name: "aaa", Help: "认证中心",
return
}},
"email": &ctx.Command{Name: "email", Help: "数字摘要", Hand: func(m *ctx.Message, c *ctx.Context, key string, arg ...string) (e error) {
msg := gomail.NewMessage()
msg.SetHeader("From", m.Conf("email", "self"))
msg.SetHeader("To", arg[0])
msg.SetHeader("Subject", arg[1])
msg.SetBody("text/html", strings.Join(arg[2:], ""))
d := gomail.NewDialer(m.Conf("email", "smtp"), kit.Int(m.Conf("email", "port")), m.Conf("email", "self"), m.Conf("email", "code"))
if e := d.DialAndSend(msg); e != nil {
m.Echo("%v", e)
} else {
m.Echo("success")
}
return
}},
"relay": &ctx.Command{Name: "relay check hash | share role", Help: "授权", Hand: func(m *ctx.Message, c *ctx.Context, key string, arg ...string) (e error) {
if len(arg) == 0 { // 会话列表
m.Cmdy("aaa.auth", "relay")

View File

@ -146,6 +146,7 @@ var Index = &ctx.Context{Name: "cli", Help: "管理中心",
"github.com/gomodule/redigo",
"github.com/go-sql-driver/mysql",
"github.com/gomarkdown/markdown",
"github.com/gopkg.in/gomail.v2",
"github.com/skip2/go-qrcode",
"github.com/PuerkitoBio/goquery",
"github.com/go-cas/cas",
@ -762,7 +763,7 @@ var version = struct {
m.Add("append", "status", "stop")
}
})
m.Sort("status").Table()
m.Sort("you", "str_r").Sort("status").Table()
return
}

View File

@ -4,5 +4,5 @@ var version = struct {
host string
self int
}{
"2019-07-02 17:07:03", "ZYB-20190522USI", 84,
"2019-07-02 20:23:38", "ZYB-20190522USI", 85,
}

View File

@ -652,6 +652,7 @@ var Index = &ctx.Context{Name: "web", Help: "应用中心",
res, e := web.Client.Do(req)
if e != nil {
m.Log("warn", "%v", e)
m.Echo("%v", e)
return e
}

View File

@ -167,6 +167,10 @@ fieldset.Login>form.option button {
height:28px;
}
fieldset.item>div.output {
overflow:auto;
}
.hidden {
display:none;
}