action_singout.go 402 B

123456789101112131415161718192021
  1. package actions
  2. func (this *Action) Action_singout() {
  3. if err := this.use_database(); err != nil {
  4. this.msg_error(err.Error())
  5. return
  6. } else {
  7. defer this.db.Close()
  8. }
  9. if err := this.load_session_user(); err != nil {
  10. this.msg_error(err.Error())
  11. return
  12. }
  13. // Set to zero
  14. this.wrapper.Session.SetInt("UserId", 0)
  15. // Reload current page
  16. this.write(`window.location.reload(false);`)
  17. }