From da3deedb0cc13712f1d71cefd086ffe137fdb19b Mon Sep 17 00:00:00 2001 From: Eden Kirin Date: Thu, 26 Oct 2023 00:25:19 +0200 Subject: [PATCH] Readme --- README.md | 3 +++ app/models/user.go | 10 +++++++++- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 459b2b3..ab7c4e9 100644 --- a/README.md +++ b/README.md @@ -11,3 +11,6 @@ - [Source](https://github.com/CloudyKit/jet) - [Syntax reference](https://github.com/CloudyKit/jet/blob/master/docs/syntax.md) +## Howto + +- [Password Hashing (bcrypt)](https://gowebexamples.com/password-hashing/) diff --git a/app/models/user.go b/app/models/user.go index dd7c5b5..14ad147 100644 --- a/app/models/user.go +++ b/app/models/user.go @@ -1,6 +1,8 @@ package models -import "time" +import ( + "time" +) type User struct { Id string `gorm:"type(uuid);unique"` @@ -16,3 +18,9 @@ type User struct { func (u *User) TableName() string { return "users" } + +// func (u *User) SetPassword(password string) (string, error) { +// secretKey := Config.Application.SecretKey +// bytes, err := bcrypt.GenerateFromPassword([]byte(password), 14) +// return string(bytes), err +// }