more
This commit is contained in:
parent
8aeab8bb3e
commit
e7110491d3
7
auth.go
7
auth.go
|
@ -16,7 +16,12 @@ func Login(username, password string) bool {
|
||||||
}
|
}
|
||||||
if bcrypt.CompareHashAndPassword([]byte(u.Password), []byte(password)) != nil {
|
if bcrypt.CompareHashAndPassword([]byte(u.Password), []byte(password)) != nil {
|
||||||
rc, ok := u.Get("recoverycode")
|
rc, ok := u.Get("recoverycode")
|
||||||
if !ok || bcrypt.CompareHashAndPassword([]byte(u.Password), []byte(rc)) != nil {
|
if !ok {
|
||||||
|
log.Println("No recovery code")
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
log.Printf("Checking against recovery code %s", rc)
|
||||||
|
if bcrypt.CompareHashAndPassword([]byte(u.Password), []byte(rc)) != nil {
|
||||||
log.Printf("scsusers.Login: Failed password for " + username)
|
log.Printf("scsusers.Login: Failed password for " + username)
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,7 +8,6 @@ import (
|
||||||
"golang.org/x/crypto/bcrypt"
|
"golang.org/x/crypto/bcrypt"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
func RecoverByEmail(email string) {
|
func RecoverByEmail(email string) {
|
||||||
u, ok := Get(email)
|
u, ok := Get(email)
|
||||||
if !ok {
|
if !ok {
|
||||||
|
|
Loading…
Reference in New Issue