need add migrate for uniq email and add index for email column

This commit is contained in:
valitovgaziz
2024-08-18 16:54:07 +05:00
parent 4b7af37296
commit aa6f10cd40
3 changed files with 83 additions and 2 deletions
+2 -2
View File
@@ -17,7 +17,7 @@ var jwtKey = []byte(os.Getenv("SECRET_KEY"))
func Login(w http.ResponseWriter, r *http.Request) {
var creds models.Crenetials
if err := json.NewDecoder(r.Body).Decode(&creds); err != nil {
w.WriteHeader(http.StatusInternalServerError)
w.WriteHeader(http.StatusBadRequest)
return
}
// check user
@@ -54,4 +54,4 @@ func Login(w http.ResponseWriter, r *http.Request) {
func checkPasswordHash(password, hash string) bool {
err := bcrypt.CompareHashAndPassword([]byte(hash), []byte(password))
return err == nil
}
}