Merged OAuth2 handling into Misuzu.
This commit is contained in:
parent
1994a9892d
commit
534e947522
115 changed files with 4556 additions and 77 deletions
templates
|
@ -56,7 +56,7 @@
|
|||
</a>
|
||||
{% endfor %}
|
||||
|
||||
{% if globals.auth_info.isLoggedIn %}
|
||||
{% if globals.auth_info.loggedIn %}
|
||||
{% set user_info = globals.auth_info.userInfo %}
|
||||
<a href="{{ url('user-profile', {'user': user_info.id}) }}" class="avatar header__desktop__user__avatar" title="{{ user_info.name }}">
|
||||
{{ avatar(user_info.id, 60, user_info.name) }}
|
||||
|
@ -80,7 +80,7 @@
|
|||
</a>
|
||||
|
||||
<label class="header__mobile__icon header__mobile__avatar" for="toggle-mobile-header">
|
||||
{% if globals.auth_info.isLoggedIn %}
|
||||
{% if globals.auth_info.loggedIn %}
|
||||
{% set user_info = globals.auth_info.userInfo %}
|
||||
{{ avatar(user_info.id, 40, user_info.name) }}
|
||||
{% else %}
|
||||
|
|
29
templates/oauth2/authorise.twig
Normal file
29
templates/oauth2/authorise.twig
Normal file
|
@ -0,0 +1,29 @@
|
|||
{% extends 'oauth2/master.twig' %}
|
||||
|
||||
{% set body_header_icon = 'wait' %}
|
||||
{% set body_header_text = 'Loading...' %}
|
||||
{% set body_title = 'Authorisation Request' %}
|
||||
|
||||
{% block body_content %}
|
||||
<div class="js-loading"></div>
|
||||
|
||||
<div class="js-authorise-error hidden">
|
||||
<div class="oauth2-errorbody">
|
||||
<p class="js-authorise-error-text"></p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<form class="js-authorise-form hidden">
|
||||
<div class="oauth2-authorise-requesting">
|
||||
<p>A third-party application is requesting permission to access your account.</p>
|
||||
</div>
|
||||
|
||||
<div class="js-authorise-form-info"></div>
|
||||
<div class="js-authorise-form-scope"></div>
|
||||
|
||||
<div class="oauth2-authorise-buttons">
|
||||
<button name="approve" value="yes" class="oauth2-authorise-button oauth2-authorise-button-accept">Authorise</button>
|
||||
<button name="approve" value="no" class="oauth2-authorise-button oauth2-authorise-button-deny">Cancel</button>
|
||||
</div>
|
||||
</form>
|
||||
{% endblock %}
|
62
templates/oauth2/login.twig
Normal file
62
templates/oauth2/login.twig
Normal file
|
@ -0,0 +1,62 @@
|
|||
{% extends 'oauth2/master.twig' %}
|
||||
|
||||
{% set body_header_icon = 'login' %}
|
||||
{% set body_header_text = 'Not logged in' %}
|
||||
{% set body_title = 'Authorisation Request' %}
|
||||
|
||||
{% block body_content %}
|
||||
<div class="oauth2-authorise-requesting">
|
||||
{% if app is defined and not app.isTrusted %}
|
||||
<p>A third-party application is requesting permission to access your account.</p>
|
||||
{% endif %}
|
||||
|
||||
<p>You must be logged in to authorise applications. <a href="{{ login_url }}" target="_blank">Log in</a> or <a href="{{ register_url }}" target="_blank">create an account</a> and reload this page to try again.</p>
|
||||
|
||||
{% if app is defined and app.isTrusted %}
|
||||
<p>You will be redirected to the following application after logging in.</p>
|
||||
{% endif %}
|
||||
</div>
|
||||
|
||||
{% if app is defined %}
|
||||
<div class="oauth2-appinfo">
|
||||
<div class="oauth2-appinfo-name">
|
||||
{{ app.name }}
|
||||
</div>{# TODO: author should be listed #}
|
||||
<div class="oauth2-appinfo-links">
|
||||
<a href="{{ app.website }}" target="_blank" rel="noopener noreferrer" class="oauth2-appinfo-link" title="Website">
|
||||
<div class="oauth2-appinfo-link-icon oauth2-appinfo-link-icon-globe"></div>
|
||||
<div class="oauth2-appinfo-link-text">{{ app.websiteDisplay }}</div>
|
||||
</a>
|
||||
</div>
|
||||
<div class="oauth2-appinfo-summary">
|
||||
<p>{{ app.summary }}</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="oauth2-scope">
|
||||
<div class="oauth2-scope-header">This application will be able to:</div>
|
||||
<div class="oauth2-scope-perms">
|
||||
<div class="oauth2-scope-perm">
|
||||
<div class="oauth2-scope-perm-icon"></div>
|
||||
<div class="oauth2-scope-perm-text">Do anything because I have not made up scopes yet.</div>
|
||||
</div>
|
||||
<div class="oauth2-scope-perm">
|
||||
<div class="oauth2-scope-perm-icon"></div>
|
||||
<div class="oauth2-scope-perm-text">Eat soup.</div>
|
||||
</div>
|
||||
<div class="oauth2-scope-perm">
|
||||
<div class="oauth2-scope-perm-icon"></div>
|
||||
<div class="oauth2-scope-perm-text">These are placeholders.</div>
|
||||
</div>
|
||||
<div class="oauth2-scope-perm">
|
||||
<div class="oauth2-scope-perm-icon"></div>
|
||||
<div class="oauth2-scope-perm-text">This one is really long because I want to test wrapping and how the chevron icon thing will handle it so there will be a lot of text here, the app will not be gaining anything from it but yeah sometimes you just need to explode seventy times.</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{% else %}
|
||||
<div class="oauth2-authorise-device">
|
||||
<p>More details about the application will be displayed once you're logged in.</p>
|
||||
</div>
|
||||
{% endif %}
|
||||
{% endblock %}
|
39
templates/oauth2/master.twig
Normal file
39
templates/oauth2/master.twig
Normal file
|
@ -0,0 +1,39 @@
|
|||
{% extends 'html.twig' %}
|
||||
|
||||
{% set html_title = (title is defined ? (title ~ ' :: ') : '') ~ globals.site_info.name %}
|
||||
|
||||
{% block html_head %}
|
||||
<link href="{{ asset('oauth2.css') }}" rel="stylesheet">
|
||||
{% endblock %}
|
||||
|
||||
{% block html_body %}
|
||||
<div class="oauth2-wrapper">
|
||||
<div class="oauth2-dialog">
|
||||
<div class="oauth2-dialog-body">
|
||||
{% block body %}
|
||||
{% block body_header %}
|
||||
<header class="oauth2-header js-oauth2-header">
|
||||
{% set body_header_icon = body_header_icon|default('') %}
|
||||
<div class="oauth2-simplehead js-oauth2-header-simple{% if body_header_icon == '' %} hidden{% endif %}">
|
||||
<div class="oauth2-simplehead-icon oauth2-simplehead-icon--{{ body_header_icon }} js-oauth2-header-simple-icon"></div>
|
||||
<div class="oauth2-simplehead-text js-oauth2-header-simple-text">
|
||||
{{ body_header_text|default('') }}
|
||||
</div>
|
||||
</div>
|
||||
</header>
|
||||
{% endblock %}
|
||||
|
||||
<div class="oauth2-body">
|
||||
<div class="oauth2-banner">
|
||||
<div class="oauth2-banner-text">{{ body_title|default('') }}</div>
|
||||
<div class="oauth2-banner-logo">{{ globals.site_info.name }}</div>
|
||||
</div>
|
||||
|
||||
{% block body_content %}{% endblock %}
|
||||
</div>
|
||||
{% endblock %}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<script src="{{ asset('oauth2.js') }}"></script>
|
||||
{% endblock %}
|
58
templates/oauth2/verify.twig
Normal file
58
templates/oauth2/verify.twig
Normal file
|
@ -0,0 +1,58 @@
|
|||
{% extends 'oauth2/master.twig' %}
|
||||
|
||||
{% set body_header_icon = 'code' %}
|
||||
{% set body_header_text = 'Code authorisation' %}
|
||||
{% set body_title = 'Authorisation Request' %}
|
||||
|
||||
{% block body_content %}
|
||||
<div class="js-loading"></div>
|
||||
|
||||
<form class="js-verify-code hidden">
|
||||
<div class="oauth2-authorise-requesting">
|
||||
<p>A third-party application that cannot display websites on its own is requesting permission to access your account.</p>
|
||||
<p>Enter the code displayed on the device or application in the box below to continue authorisation.</p>
|
||||
</div>
|
||||
|
||||
<div class="oauth2-device-form">
|
||||
<input type="text" class="oauth2-device-code js-device-code" name="code" placeholder="XXX-XXX-XXX" autofocus>
|
||||
</div>
|
||||
|
||||
<div class="oauth2-authorise-buttons">
|
||||
<button class="oauth2-authorise-button">Next</button>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
<form class="js-verify-authorise hidden">
|
||||
<div class="oauth2-authorise-requesting">
|
||||
<p>A third-party application is requesting permission to access your account.</p>
|
||||
</div>
|
||||
|
||||
<div class="js-verify-authorise-info"></div>
|
||||
<div class="js-verify-authorise-scope"></div>
|
||||
|
||||
<div class="oauth2-authorise-buttons">
|
||||
<button name="approve" value="yes" class="oauth2-authorise-button oauth2-authorise-button-accept">Authorise</button>
|
||||
<button name="approve" value="no" class="oauth2-authorise-button oauth2-authorise-button-deny">Cancel</button>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
<div class="js-verify-approved hidden">
|
||||
<div class="oauth2-approval">
|
||||
<div class="oauth2-approval-icon oauth2-approval-icon-approved"></div>
|
||||
<div class="oauth2-approval-header">Approved!</div>
|
||||
<div class="oauth2-approval-text">
|
||||
<p>You have approved the authorisation request. You should now be signed in on the target device or application.</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="js-verify-denied hidden">
|
||||
<div class="oauth2-approval">
|
||||
<div class="oauth2-approval-icon oauth2-approval-icon-denied"></div>
|
||||
<div class="oauth2-approval-header">Denied!</div>
|
||||
<div class="oauth2-approval-text">
|
||||
<p>You have denied the authorisation request. Please return to the target device or application and follow displayed instructions.</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{% endblock %}
|
Loading…
Add table
Add a link
Reference in a new issue