Skip to content

Commit

Permalink
Add templates for Django OAuth Toolkit authorization views
Browse files Browse the repository at this point in the history
  • Loading branch information
brianhelba committed Sep 30, 2022
1 parent 82dd17a commit fecf75e
Show file tree
Hide file tree
Showing 3 changed files with 111 additions and 0 deletions.
40 changes: 40 additions & 0 deletions auth_style/templates/oauth2_provider/authorize.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
{% extends "oauth2_provider/base.html" %}

{% load i18n %}
{% block content %}
<div class="block-center">
{% if not error %}
<form id="authorizationForm" method="post">
<h3 class="block-center-heading">{% trans "Authorize" %} {{ application.name }}?</h3>
{% csrf_token %}

{% for field in form %}
{% if field.is_hidden %}
{{ field }}
{% endif %}
{% endfor %}

<p>{% trans "Application requires the following permissions" %}</p>
<ul>
{% for scope in scopes_descriptions %}
<li>{{ scope }}</li>
{% endfor %}
</ul>

{{ form.errors }}
{{ form.non_field_errors }}

<div class="control-group">
<div class="controls">
<input type="submit" class="btn btn-large" value="{% trans 'Cancel' %}"/>
<input type="submit" class="btn btn-large btn-primary" name="allow" value="{% trans 'Authorize' %}"/>
</div>
</div>
</form>

{% else %}
<h2>Error: {{ error.error }}</h2>
<p>{{ error.description }}</p>
{% endif %}
</div>
{% endblock %}
23 changes: 23 additions & 0 deletions auth_style/templates/oauth2_provider/authorized-oob.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{% extends "oauth2_provider/base.html" %}

{% load i18n %}

{% block title %}
Success code={{code}}
{% endblock %}

{% block content %}
<div class="block-center">
{% if not error %}
<h2>{% trans "Success" %}</h2>

<p>{% trans "Please return to your application and enter this code:" %}</p>

<p><code>{{ code }}</code></p>

{% else %}
<h2>Error: {{ error.error }}</h2>
<p>{{ error.description }}</p>
{% endif %}
</div>
{% endblock %}
48 changes: 48 additions & 0 deletions auth_style/templates/oauth2_provider/base.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>{% block title %}{% endblock title %}</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="description" content="">
<meta name="author" content="">

{% block css %}
<link href="//netdna.bootstrapcdn.com/twitter-bootstrap/2.3.2/css/bootstrap-combined.no-icons.min.css" rel="stylesheet">
{% endblock css %}

<style>
body {
padding-top: 40px;
padding-bottom: 40px;
background-color: #f5f5f5;
}
.block-center {
max-width: 500px;
padding: 19px 29px 29px;
margin: 0 auto 20px;
background-color: #fff;
border: 1px solid #e5e5e5;
-webkit-border-radius: 5px;
-moz-border-radius: 5px;
border-radius: 5px;
-webkit-box-shadow: 0 1px 2px rgba(0,0,0,.05);
-moz-box-shadow: 0 1px 2px rgba(0,0,0,.05);
box-shadow: 0 1px 2px rgba(0,0,0,.05);
}
.block-center .block-center-heading {
margin-bottom: 10px;
}

</style>
</head>

<body>

<div class="container">
{% block content %}
{% endblock content %}
</div>

</body>
</html>

0 comments on commit fecf75e

Please sign in to comment.