mv crypto to lea
This commit is contained in:
@ -1,5 +1,5 @@
|
||||
// Package crypto contains two cryptographic functions for both storing and comparing passwords.
|
||||
package crypto
|
||||
// contains two cryptographic functions for both storing and comparing passwords.
|
||||
package lea
|
||||
|
||||
import (
|
||||
"golang.org/x/crypto/bcrypt"
|
@ -4,7 +4,6 @@ import (
|
||||
"gopkg.in/mgo.v2/bson"
|
||||
// "github.com/leanote/leanote/app/db"
|
||||
"github.com/leanote/leanote/app/info"
|
||||
. "github.com/leanote/leanote/app/crypto"
|
||||
// "github.com/revel/revel"
|
||||
"strings"
|
||||
. "github.com/leanote/leanote/app/lea"
|
||||
@ -26,7 +25,8 @@ func (this *AuthService) Login(emailOrUsername, pwd string) (info.User, error) {
|
||||
passwd := userInfo.Pwd
|
||||
if len(passwd) == 32 && Md5(pwd) != passwd {
|
||||
return userInfo, errors.New("wrong username or password")
|
||||
} else {
|
||||
}
|
||||
if len(passwd) > 32 {
|
||||
hex := []byte(passwd)
|
||||
if !CompareHash(hex, pwd) {
|
||||
return userInfo, errors.New("wrong username or password")
|
||||
|
@ -4,7 +4,7 @@ import (
|
||||
"gopkg.in/mgo.v2/bson"
|
||||
"github.com/leanote/leanote/app/db"
|
||||
"github.com/leanote/leanote/app/info"
|
||||
. "github.com/leanote/leanote/app/crypto"
|
||||
. "github.com/leanote/leanote/app/lea"
|
||||
)
|
||||
|
||||
// 找回密码
|
||||
|
Reference in New Issue
Block a user