// If redirect is nil, the redirect will go to "/" func LogoutView(redirect view.URL) view.View { return view.RenderView( func(context *view.Context, writer *utils.XMLWriter) (err error) { Logout(context) if redirect != nil { return view.Redirect(redirect.URL(context.PathArgs...)) } return view.Redirect("/") }, ) }
// If redirect is nil, the redirect will go to "/" func LogoutView(redirect view.URL) view.View { return view.RenderView( func(ctx *view.Context) (err error) { Logout(ctx.Session) if redirect != nil { return view.Redirect(redirect.URL(ctx)) } return view.Redirect("/") }, ) }
func (self *Auth) Authenticate(context *view.Context) (ok bool, err error) { id, ok := context.SessionID() if !ok { return false, nil } ok, err = IsConfirmedUserID(id) if !ok && err == nil && self.LoginURL != nil { err = view.Redirect(self.LoginURL.URL(context.PathArgs...)) } return ok, err }
func (self *Auth) Authenticate(ctx *view.Context) (ok bool, err error) { id := ctx.Session.ID() if id == "" { return false, nil } /// todo: Use hashed logged in cookie instead of user ID!! ok, err = IsConfirmedUserID(id) if !ok && err == nil && self.LoginURL != nil { err = view.Redirect(self.LoginURL.URL(ctx)) } return ok, err }