mirror of
https://github.com/fnproject/fn.git
synced 2022-10-28 21:29:17 +03:00
18 lines
411 B
Go
18 lines
411 B
Go
package models
|
|
|
|
import "golang.org/x/crypto/bcrypt"
|
|
|
|
type User struct {
|
|
Username string `json:"username" bson:"_id,omitempty"`
|
|
Password []byte `json:"-" bson:"password"`
|
|
NewPassword string `json:"password" bson:"-"`
|
|
}
|
|
|
|
func UserPasswordEncrypt(pass []byte) []byte {
|
|
hashedPassword, err := bcrypt.GenerateFromPassword(pass, bcrypt.DefaultCost)
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
return hashedPassword
|
|
}
|