- 去除auth.localpass(已经移到auth2.localpass)
This commit is contained in:
@@ -1,38 +0,0 @@
|
||||
package localpass
|
||||
|
||||
import (
|
||||
"crypto/md5"
|
||||
"fmt"
|
||||
|
||||
"git.rosy.net.cn/jx-callback/business/jxcallback/auth"
|
||||
"git.rosy.net.cn/jx-callback/business/model/dao"
|
||||
"git.rosy.net.cn/jx-callback/business/model/legacymodel"
|
||||
)
|
||||
|
||||
const (
|
||||
LoginType = "localpass"
|
||||
)
|
||||
|
||||
type Auther struct {
|
||||
}
|
||||
|
||||
func init() {
|
||||
auth.RegisterAuther(LoginType, new(Auther))
|
||||
}
|
||||
|
||||
func (a *Auther) Login(uname, password string) (userID, LoginType string, err error) {
|
||||
user := &legacymodel.JxBackendUser{
|
||||
UName: uname,
|
||||
}
|
||||
if err = dao.GetEntity(nil, user, "UName"); err == nil {
|
||||
if fmt.Sprintf("%x", md5.Sum([]byte(password))) == user.UPass {
|
||||
return "", "", nil
|
||||
}
|
||||
err = auth.ErrUIDAndPassNotMatch
|
||||
}
|
||||
return "", "", err
|
||||
}
|
||||
|
||||
func (a *Auther) Logout(loginInfo *auth.LoginInfo) error {
|
||||
return nil
|
||||
}
|
||||
Reference in New Issue
Block a user