11.5
This commit is contained in:
@@ -214,7 +214,15 @@ func (app *application) userLoginPost(w http.ResponseWriter, r *http.Request) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (app *application) userLogoutPost(w http.ResponseWriter, r *http.Request) {
|
func (app *application) userLogoutPost(w http.ResponseWriter, r *http.Request) {
|
||||||
fmt.Fprintln(w, "Logout the user...")
|
err := app.sessionManager.RenewToken(r.Context())
|
||||||
|
if err != nil {
|
||||||
|
app.serverError(w, err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
app.sessionManager.Remove(r.Context(), "authenticatedUserId")
|
||||||
|
app.sessionManager.Put(r.Context(), "flash", "You've been logged out succefully!")
|
||||||
|
|
||||||
|
http.Redirect(w, r, "/", http.StatusSeeOther)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (app *application) userSignup(w http.ResponseWriter, r *http.Request) {
|
func (app *application) userSignup(w http.ResponseWriter, r *http.Request) {
|
||||||
|
|||||||
Reference in New Issue
Block a user