You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
go-fly/controller/auth.go

25 lines
556 B

package controller
import (
"github.com/taoshihan1991/imaptool/config"
"github.com/taoshihan1991/imaptool/tools"
)
func AuthLocal(username string,password string)string{
account:=config.GetAccount()
if username==account["Username"] && password==account["Password"]{
sessionId:=tools.Md5(username)
info:=make(map[string]string)
info["username"]=username
config.SetUserInfo(sessionId,info)
return sessionId
}
return ""
}
//验证是否已经登录
func AuthCheck(uid string)map[string]string{
info:=config.GetUserInfo(uid)
return info
}