Files
fn-serverless/examples/blog/models/user.go
Carlos C d5fb1afda7 Revert "Assert License (#224)"
This reverts commit a61c4dab78.
2016-11-06 09:25:12 -08:00

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
}