need add migrate for uniq email and add index for email column
This commit is contained in:
@@ -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
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user