mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-08-24 00:07:02 -04:00
Logout functionality and test added.
This commit is contained in:
@@ -4,5 +4,6 @@ main = Blueprint('main', __name__)
|
||||
|
||||
|
||||
from app.main.views import (
|
||||
index, sign_in, register, two_factor, verify, sms, add_service, code_not_received, jobs, dashboard, templates
|
||||
index, sign_in, sign_out, register, two_factor, verify, sms, add_service,
|
||||
code_not_received, jobs, dashboard, templates
|
||||
)
|
||||
|
||||
@@ -1,11 +1,13 @@
|
||||
from flask import render_template
|
||||
|
||||
from flask_login import login_required
|
||||
from app.main import main
|
||||
|
||||
|
||||
from ._jobs import jobs
|
||||
|
||||
|
||||
@main.route("/dashboard")
|
||||
@login_required
|
||||
def dashboard():
|
||||
return render_template(
|
||||
'views/dashboard.html',
|
||||
|
||||
13
app/main/views/sign_out.py
Normal file
13
app/main/views/sign_out.py
Normal file
@@ -0,0 +1,13 @@
|
||||
from flask import (render_template, redirect, url_for)
|
||||
from flask import session
|
||||
from flask_login import login_required, logout_user
|
||||
|
||||
from app.main import main
|
||||
|
||||
|
||||
@main.route('/sign-out', methods=(['GET']))
|
||||
@login_required
|
||||
def sign_out():
|
||||
logout_user()
|
||||
return redirect(url_for('main.render_sign_in'))
|
||||
|
||||
@@ -28,6 +28,11 @@
|
||||
<div class="phase-banner-beta">
|
||||
<strong class="phase-tag">BETA</strong>
|
||||
</div>
|
||||
{% if current_user.is_authenticated %}
|
||||
<div class="">
|
||||
<a class="" href="{{ url_for('main.sign_out') }}">Sign out</a>
|
||||
</div>
|
||||
{% endif %}
|
||||
{% endblock %}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user