parent
59c75cb77d
commit
4395defbaa
@ -1,12 +1,24 @@
|
|||||||
package controller
|
package controller
|
||||||
|
|
||||||
import "github.com/taoshihan1991/imaptool/config"
|
import (
|
||||||
|
"github.com/taoshihan1991/imaptool/config"
|
||||||
func AuthLocal(username string,password string)bool{
|
"github.com/taoshihan1991/imaptool/tools"
|
||||||
|
)
|
||||||
|
func AuthLocal(username string,password string)string{
|
||||||
account:=config.GetAccount()
|
account:=config.GetAccount()
|
||||||
if username==account["Username"] && password==account["Password"]{
|
if username==account["Username"] && password==account["Password"]{
|
||||||
return true
|
|
||||||
|
sessionId:=tools.Md5(username)
|
||||||
|
info:=make(map[string]string)
|
||||||
|
info["username"]=username
|
||||||
|
config.SetUserInfo(sessionId,info)
|
||||||
|
return sessionId
|
||||||
|
}
|
||||||
|
return ""
|
||||||
}
|
}
|
||||||
return false
|
//验证是否已经登录
|
||||||
|
func AuthCheck(uid string)map[string]string{
|
||||||
|
info:=config.GetUserInfo(uid)
|
||||||
|
return info
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in new issue