CHANGE: finalized user auth + added booking edit view
This commit is contained in:
@@ -45,7 +45,7 @@ func loginUser(w http.ResponseWriter, r *http.Request){
|
||||
log.Println("No card_uid provided!")
|
||||
http.Error(w, "No card_uid provided", http.StatusBadRequest)
|
||||
}
|
||||
user, err := (*models.User).GetById(nil, card_uid)
|
||||
user, err := (*models.User).GetByCardUID(nil, card_uid)
|
||||
if(err != nil){
|
||||
log.Println("No user found under this card_uid!")
|
||||
http.Error(w, "No user found!", http.StatusNotFound)
|
||||
@@ -54,7 +54,7 @@ func loginUser(w http.ResponseWriter, r *http.Request){
|
||||
password := r.FormValue("password")
|
||||
if(user.Login(password)){
|
||||
log.Printf("New succesfull user login from %s %s!\n", user.Vorname, user.Name)
|
||||
Session.Put(r.Context(), "user", user.CardUID)
|
||||
Session.Put(r.Context(), "user", user.PersonalNummer)
|
||||
http.Redirect(w, r, "/time", http.StatusSeeOther) //with this browser always uses GET
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user