Commit 9cfe5f25 authored by haoyanbin's avatar haoyanbin

user password

parent a2983b84
......@@ -2,7 +2,6 @@ package models
import (
"go-admin/common/models"
"golang.org/x/crypto/bcrypt"
"gorm.io/gorm"
)
......@@ -50,13 +49,13 @@ func (e *SysUser) Encrypt() (err error) {
return
}
var hash []byte
if hash, err = bcrypt.GenerateFromPassword([]byte(e.Password), bcrypt.DefaultCost); err != nil {
//var hash []byte
//if hash, err = bcrypt.GenerateFromPassword([]byte(e.Password), bcrypt.DefaultCost); err != nil {
// return
//} else {
// e.Password = string(hash)
return
} else {
e.Password = string(hash)
return
}
//}
}
func (e *SysUser) BeforeCreate(_ *gorm.DB) error {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment