def authorized(resp): access_token = resp['access_token'] session['access_token'] = access_token, '' user = UsersAuthenticator(False, oauth_token=access_token) user.o_auth_validate() if user.is_authenticated: login_user(user) return redirect(url_for('home')) return redirect(url_for('login'))
def do_login(user_email, password): user = UsersAuthenticator(user_email) if user.exist: user.validate_user(password) if user.is_authenticated: login_user(user) return True else: return None return False
def load_user(user_id): user = UsersAuthenticator.get_user_obj(user_id) if user: return user return None