Hashing password

Using postgres' pgcrypt
This commit is contained in:
cdricms
2025-01-17 10:39:59 +01:00
parent 89f44f4469
commit fdc3122b68
7 changed files with 88 additions and 28 deletions

View File

@@ -53,13 +53,8 @@ func HandleLogin(w http.ResponseWriter, r *http.Request) {
return
}
var user core.User
count, err := core.DB.NewSelect().
Model(&user).
Where("email = ? AND password = ?", login.Email, login.Password).
Limit(1).
ScanAndCount(context.Background())
if count == 0 {
user, err := core.Verify(context.Background(), login.Email, login.Password)
if user == nil {
core.JSONError{
Status: core.Error,
Message: "User not found.",