结构调整添加cmd
This commit is contained in:
1 parent
f2829bfd98
commit
a2f4c00246
72 files changed
+838
-597
No files matched your search
+4
-4
@@ -2,7 +2,7 @@ package models
|
||||
|
||||
import (
|
||||
orm "go-admin/database"
|
||||
"go-admin/pkg"
|
||||
"go-admin/tools"
|
||||
"log"
|
||||
"strings"
|
||||
)
|
||||
@@ -19,15 +19,15 @@ func (u *Login) GetUser() (user SysUser, role SysRole, e error) {
|
||||
e = orm.Eloquent.Table("sys_user").Where("username = ? ", u.Username).Find(&user).Error
|
||||
if e != nil {
|
||||
if strings.Contains(e.Error(), "record not found") {
|
||||
pkg.HasError(e, "账号或密码错误(代码204)", 500)
|
||||
tools.HasError(e, "账号或密码错误(代码204)", 500)
|
||||
}
|
||||
log.Print(e)
|
||||
return
|
||||
}
|
||||
_, e = pkg.CompareHashAndPassword(user.Password, u.Password)
|
||||
_, e = tools.CompareHashAndPassword(user.Password, u.Password)
|
||||
if e != nil {
|
||||
if strings.Contains(e.Error(), "hashedPassword is not the hash of the given password") {
|
||||
pkg.HasError(e, "账号或密码错误(代码201)", 500)
|
||||
tools.HasError(e, "账号或密码错误(代码201)", 500)
|
||||
}
|
||||
log.Print(e)
|
||||
return
|
||||
|
||||
Reference in new issue
Block a user