Skip to content

Commit

Permalink
update oauth forms
Browse files Browse the repository at this point in the history
  • Loading branch information
aumetra committed Oct 14, 2023
1 parent 53062b8 commit 487e279
Show file tree
Hide file tree
Showing 4 changed files with 64 additions and 49 deletions.
25 changes: 25 additions & 0 deletions kitsune/templates/base.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
<!DOCTYPE html>
<html lang="en">

<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" href="/public/template.css">

{% block head %}
{% endblock %}

<title>
{% block title %}
{{ title }} - Kitsune
{% endblock %}
</title>
</head>

<body>
{% block body %}
{% endblock %}
</body>

</html>
37 changes: 18 additions & 19 deletions kitsune/templates/oauth/consent.html
Original file line number Diff line number Diff line change
@@ -1,24 +1,22 @@
<!DOCTYPE html>
<html lang="en">
{% extends "../base.html" %}

<head>
<meta charset="UTF-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<link rel="stylesheet" href="/public/template.css">
<title>OAuth Login</title>
</head>
{% block title %}
OAuth Login
{% endblock %}

{% macro add_query_params() %}
<input type="hidden" name="client_id" value="{{ query.client_id }}" />
<input type="hidden" name="redirect_uri" value="{{ query.redirect_uri }}" />
<input type="hidden" name="response_type" value="{{ query.response_type }}" />
<input type="hidden" name="scope" value="{{ query.scope }}" />
<input type="hidden" name="state" value="{{ query.state.as_deref().unwrap_or("") }}" />
<input type="hidden" name="client_id" value="{{ query.client_id }}" />
<input type="hidden" name="redirect_uri" value="{{ query.redirect_uri }}" />
<input type="hidden" name="response_type" value="{{ query.response_type }}" />
<input type="hidden" name="scope" value="{{ query.scope }}" />
<input type="hidden" name="state" value="{{ query.state.as_deref().unwrap_or("") }}" />
{% endmacro %}

<body>
<p class="header">Kitsune</p>
{% block body %}
<p class="header">
Kitsune
</p>

<div class="consent-text">
<span class="appName">{{app_name}}</span> wants the following access to your Kitsune account:
<p>
Expand All @@ -29,23 +27,24 @@
</ul>
</p>
</div>

<div class="consent-forms">
<form method="get">
{% call add_query_params() %}
<input type="hidden" name="login_consent" value="accept" />
<input class="formButton" type="submit" value="Accept" />
</form>

<form method="get">
{% call add_query_params() %}
<input type="hidden" name="login_consent" value="deny" />
<input class="formButton" type="submit" value="Deny" />
</form>
</div>

<div class="disclaimer">
Authenticated as <span class="authUsername">{{ authenticated_username }}</span> ~
<a href="#"
onclick="document.cookie='user_id=; expires=Thu, 01 Jan 1970 00:00:00 UTC;';window.navigation.reload();">Logout</a>
</div>
</body>

</html>
{% endblock %}
27 changes: 11 additions & 16 deletions kitsune/templates/oauth/login.html
Original file line number Diff line number Diff line change
@@ -1,21 +1,18 @@
<!DOCTYPE html>
<html lang="en">
{% extends "../base.html" %}

<head>
<meta charset="UTF-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<link rel="stylesheet" href="/public/template.css">
<title>OAuth Login</title>
</head>
{% block title %}
OAuth Login
{% endblock %}

<body>
{% block body %}
<p class="header">Kitsune</p>

{% for (_level, msg) in flash_messages %}
<div class="message">
{{ msg }}
</div>
<div class="message">
{{ msg }}
</div>
{% endfor %}

<form method="post">
<div>
<label class="label" for="username">Username</label><br />
Expand All @@ -25,6 +22,4 @@
</div>
<input class="formButton" type="submit" value="Submit" />
</form>
</body>

</html>
{% endblock %}
24 changes: 10 additions & 14 deletions kitsune/templates/oauth/token.html
Original file line number Diff line number Diff line change
@@ -1,20 +1,16 @@
<!DOCTYPE html>
<html lang="en">
{% extends "../base.html" %}

<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" href="/public/template.css">
<title>OAuth Token</title>
</head>
{% block title %}
OAuth Token
{% endblock %}

{% block body %}
<p class="header">
{{domain}}
</p>

<body>
<p class="header">{{domain}}</p>
<div class="tokenContainer">
<p>Copy & Paste this token into <span class="appName">{{app_name}}</span></p>
<code class="token">{{token}}</code>
</div>
</body>

</html>
{% endblock %}

0 comments on commit 487e279

Please sign in to comment.