parent
2b437a6206
commit
e71c095cc8
@ -0,0 +1,25 @@
|
||||
package config
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"github.com/taoshihan1991/imaptool/tools"
|
||||
"io/ioutil"
|
||||
)
|
||||
|
||||
const Dir = "config/"
|
||||
const AccountConf = Dir +"account.json"
|
||||
|
||||
func GetAccount()map[string]string{
|
||||
var account map[string]string
|
||||
isExist,_:=tools.IsFileExist(AccountConf)
|
||||
if !isExist{
|
||||
return account
|
||||
}
|
||||
info,err:=ioutil.ReadFile(AccountConf)
|
||||
if err!=nil{
|
||||
return account
|
||||
}
|
||||
|
||||
err=json.Unmarshal(info,&account)
|
||||
return account
|
||||
}
|
@ -0,0 +1,12 @@
|
||||
package controller
|
||||
|
||||
import "github.com/taoshihan1991/imaptool/config"
|
||||
|
||||
func AuthLocal(username string,password string)bool{
|
||||
account:=config.GetAccount()
|
||||
if username==account["Username"] && password==account["Password"]{
|
||||
return true
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
@ -0,0 +1,8 @@
|
||||
package session
|
||||
|
||||
func Set(name string,value string){
|
||||
|
||||
}
|
||||
func Get(name string){
|
||||
|
||||
}
|
Loading…
Reference in new issue