Skip to content

Commit

Permalink
Update to support logout flow and have the base template link to the …
Browse files Browse the repository at this point in the history
…account flows
  • Loading branch information
joshSzep committed Jul 22, 2024
1 parent 73a7f99 commit 7c8b9fd
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 1 deletion.
19 changes: 19 additions & 0 deletions templates/account/logout.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{% extends "base.html" %}

{% block title %}Sign Out{% endblock %}

{% block content %}
<div class="bg-white shadow-md rounded px-8 pt-6 pb-8 mb-4">
<h2 class="text-2xl font-bold mb-6">Sign Out</h2>
<p class="mb-4">Are you sure you want to sign out?</p>
<form method="post" action="{% url 'account_logout' %}">
{% csrf_token %}
{% if redirect_field_value %}
<input type="hidden" name="{{ redirect_field_name }}" value="{{ redirect_field_value }}"/>
{% endif %}
<button type="submit" class="bg-red-500 hover:bg-red-700 text-white font-bold py-2 px-4 rounded focus:outline-none focus:shadow-outline">
Sign Out
</button>
</form>
</div>
{% endblock %}
10 changes: 9 additions & 1 deletion templates/base.html
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,16 @@
</head>
<body class="bg-gray-100">
<header class="bg-white shadow">
<div class="container mx-auto px-6 py-4">
<div class="container mx-auto px-6 py-4 flex justify-between items-center">
<h1 class="text-3xl font-bold text-gray-800">Hangul Typing Tutor</h1>
<nav>
{% if user.is_authenticated %}
<a href="{% url 'account_logout' %}" class="text-blue-500 hover:text-blue-700">Sign Out</a>
{% else %}
<a href="{% url 'account_login' %}" class="text-blue-500 hover:text-blue-700 mr-4">Log In</a>
<a href="{% url 'account_signup' %}" class="text-blue-500 hover:text-blue-700">Sign Up</a>
{% endif %}
</nav>
</div>
</header>

Expand Down

0 comments on commit 7c8b9fd

Please sign in to comment.