def get(self, request): # delete user from current session session.pop(request, 'user') # return logout success prompt and index link return redirect("/")
def get(self): self.wechat.logout() session.pop(self.request, 'user') session.pop(self.request, 'status') session.pop(self.request, 'is_login') session.pop(self.request, 'wechat') return redirect('/login')
def post(self, request): # put user commit information to database query ret = dbconn.execute('''SELECT * FROM user WHERE f_name = %(user)s''', request.form) # if have match result the means its had register, otherwise redirect login page and put state=0, notice page show login error information if ret.rows == 1: # if matched, get first item data f_name field for username user = ret.get_first()['f_name'] # put username to Session session.push(request, 'user', user) # Session check success, so redirect to index page return redirect('/') return redirect('/login?state=0')
def post(self, request): # put user commit information for parameter, execute SQL INSERT statement put information save to database table ret = dbconn.insert('INSERT INTO user(f_name) VALUES (%(user)s)', request.form) # if insert success, its means register success, redirect to login page if ret.suc: return redirect('/login') else: # if fail, put error information for debug return render_json(ret.to_dict())
def auth_fail_callback(request, *args, **options): ''' if auth fail, then return a lick, click it skip to login page ''' return redirect("/login")
def get(self): if 'user' in self.session_map: return redirect('/') return simple_template('login/login.html')