mirror of
https://git.freecumextremist.com/grumbulon/pomme.git
synced 2024-11-22 11:43:47 +00:00
fixed a big oops
This commit is contained in:
parent
e2fbc9b1a1
commit
ec4a7ed396
1 changed files with 5 additions and 5 deletions
|
@ -23,10 +23,6 @@ func Login(w http.ResponseWriter, r *http.Request) {
|
|||
|
||||
username := r.Form.Get("username")
|
||||
|
||||
if username == "" {
|
||||
username = autoUname()
|
||||
}
|
||||
|
||||
password := r.Form.Get("password")
|
||||
|
||||
if password == "" {
|
||||
|
@ -40,8 +36,12 @@ func Login(w http.ResponseWriter, r *http.Request) {
|
|||
return
|
||||
}
|
||||
|
||||
db.Model(internal.User{Username: username}).First(&result)
|
||||
db.Where("username = ?", username).First(&result)
|
||||
if result.Username == "" {
|
||||
http.Error(w, "User not registered", http.StatusUnauthorized)
|
||||
|
||||
return
|
||||
}
|
||||
err = bcrypt.CompareHashAndPassword([]byte(result.HashedPassword), []byte(password))
|
||||
|
||||
if err != nil {
|
||||
|
|
Loading…
Reference in a new issue