Add remember me functionality, handle both types of sessions appropriately
This commit is contained in:
1 parent
ec9c1a8fb5
commit
5f7e674d32
4 files changed
+47
-23
No files matched your search
@@ -24,13 +24,14 @@ func (postController *PostController) Login(w http.ResponseWriter, r *http.Reque
|
||||
|
||||
username := r.FormValue("username")
|
||||
password := r.FormValue("password")
|
||||
remember := r.FormValue("remember") == "on"
|
||||
|
||||
if username == "" || password == "" {
|
||||
log.Println("Tried to login user with empty username or password")
|
||||
http.Redirect(w, r, "/login", http.StatusFound)
|
||||
}
|
||||
|
||||
_, err = models.AuthenticateUser(postController.App, w, username, password)
|
||||
_, err = models.AuthenticateUser(postController.App, w, username, password, remember)
|
||||
if err != nil {
|
||||
log.Println("Error authenticating user")
|
||||
log.Println(err)
|
||||
|
||||
Reference in new issue
Block a user