func (self LoginResource) Post(ctx *rfweb.Context) { res := RespData{} email := strings.ToLower(ctx.Get("email")) email = strings.TrimSpace(email) pwd := strings.TrimSpace(ctx.Get("pwd")) // remember := ctx.Get("remember") user, err := auth.LoginUser(email, pwd) if err != nil { res.Error = err.Error() } else { res.Success = true // res.Data = ctx.Get("returnurl") session := ctx.Session() session.SetStuct(constant.SS_KEY_USER, user) } util.WriteJson(ctx.W, res) }
func (self *LogoutResource) Get(ctx *rfweb.Context) { session := ctx.Session() session.Clear(ctx.W) redirectToLogin(ctx.W, ctx.R, false) }