def load_user_from_request(request): token = request.headers.get('Authorization') if token: user = Usuario().verify_auth_token(token) if user: return user return None
def login(): user_name = request.form.get('name') user_psw = request.form.get('password') remember_me = True if request.form.get('rememberme') else False if Usuario().login(user_name, user_psw, remember_me): return redirect('{}/minhasAvaliacoes'.format( os.environ.get('HOST_ENDPOINT', request.url_root[:-1]))) return render_template('login.html', mensagem='Usuário/senha incorretos')
def test_logout(self, mock_logout): Usuario().logout() mock_logout.assert_called_once_with()
def load_user(user_id): return Usuario().obter_por_id(user_id)
def logout(): Usuario().logout() return redirect('{}/'.format( os.environ.get('HOST_ENDPOINT', request.url_root[:-1])))