自动注册工单系统账号

This commit is contained in:
LawyZHENG
2021-03-17 15:59:05 +08:00
parent 25c58d9988
commit 545537ecf1
3 changed files with 34 additions and 26 deletions

View File

@@ -17,12 +17,13 @@ import (
"gopkg.in/ldap.v2"
"math"
"github.com/astaxie/beego"
"github.com/astaxie/beego/logs"
"github.com/astaxie/beego/orm"
"github.com/lifei6671/mindoc/conf"
"github.com/lifei6671/mindoc/utils"
"math"
)
type Member struct {
@@ -167,13 +168,17 @@ func (m *Member) httpLogin(account, password string) (*Member, error) {
return nil, ErrMemberAuthMethodInvalid
}
tmpH := md5.New()
tmpH.Write([]byte(password))
password = strings.ToUpper(hex.EncodeToString(tmpH.Sum(nil)))
val := url.Values{
"account": []string{account},
"password": []string{password},
"time": []string{strconv.FormatInt(time.Now().Unix(), 10)},
}
h := md5.New()
h.Write([]byte(val.Encode() + beego.AppConfig.DefaultString("http_login_secret","")))
h.Write([]byte(val.Encode() + beego.AppConfig.DefaultString("http_login_secret", "")))
val.Add("sn", hex.EncodeToString(h.Sum(nil)))