refactor: structure of an hexagonal architecture
Created a kernel crate to store models and future action implementations. Will be useful to create admin cli.
This commit is contained in:
parent
69af48bb62
commit
3713cc2443
87 changed files with 834 additions and 474 deletions
34
lib/http_server/src/templates/pages/apps.html
Normal file
34
lib/http_server/src/templates/pages/apps.html
Normal file
|
|
@ -0,0 +1,34 @@
|
|||
{% extends "layouts/base.html" %}
|
||||
{% block body %}
|
||||
<h1>Available apps</h1>
|
||||
<p>List of apps you can use with Single-Sign-On in this organization.</p>
|
||||
<div class="apps-mosaic">
|
||||
<div class="row">
|
||||
{% for app in apps %}
|
||||
<div class="col-xs-12 col-sm-6 col-lg-3 mb-3 mb-sm-0">
|
||||
<div class="card">
|
||||
<div class="card-body">
|
||||
{% if app.logo_uri %}
|
||||
<img src="{{ app.logo_uri}}" class="card-img-top" alt="{{ app.name }} logo">
|
||||
{% endif %}
|
||||
<h5 class="card-title">
|
||||
{{ app.name }}
|
||||
</h5>
|
||||
<p class="card-text">
|
||||
{{ app.description }}
|
||||
</p>
|
||||
<a
|
||||
href="{{ app.login_uri }}"
|
||||
class="btn btn-primary"
|
||||
title="Open the app or login"
|
||||
>
|
||||
Open app
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{% endfor %}
|
||||
</div>
|
||||
</div>
|
||||
{% endblock %}
|
||||
|
||||
32
lib/http_server/src/templates/pages/authorize.html
Normal file
32
lib/http_server/src/templates/pages/authorize.html
Normal file
|
|
@ -0,0 +1,32 @@
|
|||
{% extends "layouts/base.html" %}
|
||||
{% block body %}
|
||||
<!-- Authorize form -->
|
||||
{% if error %}
|
||||
<div>
|
||||
Error: {{ error }}
|
||||
</div>
|
||||
{% endif %}
|
||||
<form id="authorize-form" method="post" action="/authorize">
|
||||
<h1>Do you authorize this app?</h1>
|
||||
<p>
|
||||
You're about to log-in and give some of your personal data to an application.
|
||||
If you accept, you will be redirected to "{{ redirect_uri_host }}".
|
||||
</p>
|
||||
<ul>
|
||||
<li>App name: {{ app.name }}</li>
|
||||
<li>App description: <i>{{ app.description }}</i></li>
|
||||
<li>Permissions: {{ authorization_params.scope }}</li>
|
||||
</ul>
|
||||
<input type="hidden" name="client_id" value="{{ authorization_params.client_id }}" />
|
||||
<input type="hidden" name="scope" value="{{ authorization_params.scope }}" />
|
||||
<input type="hidden" name="state" value="{{ authorization_params.state }}" />
|
||||
<input type="hidden" name="response_type" value="{{ authorization_params.response_type }}" />
|
||||
<input type="hidden" name="redirect_uri" value="{{ authorization_params.redirect_uri }}" />
|
||||
|
||||
<div class="d-flex justify-content-end">
|
||||
<!-- TODO: implements authorization rejection -->
|
||||
<a href="/me" class="btn btn-outlined">Don't authorize</a>
|
||||
<button type="submit" class="btn btn-primary">Authorize</button>
|
||||
</div>
|
||||
</form>
|
||||
{% endblock %}
|
||||
11
lib/http_server/src/templates/pages/home.html
Normal file
11
lib/http_server/src/templates/pages/home.html
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
{% extends "layouts/base.html" %}
|
||||
{% block body %}
|
||||
<h1>Bienvenue sur Minauthator</h1>
|
||||
|
||||
<p>
|
||||
Minauthator is free software under <a href="https://www.gnu.org/licenses/gpl-3.0.txt">GPLv3</a> licence.
|
||||
|
||||
You can find source code on a <a href="https://forge.lefuturiste.fr/mbess/minauth">self-hosted forge repository</a>.
|
||||
</p>
|
||||
{% endblock %}
|
||||
|
||||
34
lib/http_server/src/templates/pages/login.html
Normal file
34
lib/http_server/src/templates/pages/login.html
Normal file
|
|
@ -0,0 +1,34 @@
|
|||
{% extends "layouts/base.html" %}
|
||||
{% block body %}
|
||||
<h1>Login</h1>
|
||||
<!-- Login form -->
|
||||
{% if error %}
|
||||
<div class="alert alert-danger">
|
||||
Error: {{ error }}
|
||||
</div>
|
||||
{% endif %}
|
||||
<form id="login-form" method="post">
|
||||
<div class="mb-3">
|
||||
<label for="login" class="form-label">Email or username</label>
|
||||
<input
|
||||
id="login" name="login" type="text"
|
||||
required
|
||||
class="form-control"
|
||||
/>
|
||||
</div>
|
||||
<div class="mb-3">
|
||||
<label for="password" class="form-label">Password</label>
|
||||
<input
|
||||
id="password" name="password" type="password"
|
||||
required
|
||||
class="form-control"
|
||||
/>
|
||||
</div>
|
||||
<div class="mb-3 form-check">
|
||||
<input id="keep_session" type="checkbox" class="form-check-input">
|
||||
<label class="form-check-label" for="keep_session">Check me out</label>
|
||||
</div>
|
||||
|
||||
<button type="submit" class="btn btn-primary">Submit</button>
|
||||
</form>
|
||||
{% endblock %}
|
||||
72
lib/http_server/src/templates/pages/me/details-form.html
Normal file
72
lib/http_server/src/templates/pages/me/details-form.html
Normal file
|
|
@ -0,0 +1,72 @@
|
|||
{% extends "layouts/base.html" %}
|
||||
{% block body %}
|
||||
<h1>Update your user details</h1>
|
||||
{% if error %}
|
||||
<div class="alert alert-danger">
|
||||
Error: {{ error }}
|
||||
</div>
|
||||
{% endif %}
|
||||
{% if success %}
|
||||
<div class="alert alert-success">
|
||||
Your details have been updated.
|
||||
</div>
|
||||
{% endif %}
|
||||
<form
|
||||
id="register-form"
|
||||
enctype="multipart/form-data"
|
||||
method="post"
|
||||
>
|
||||
<div class="mb-3">
|
||||
<label for="handle" class="form-label">Handle</label>
|
||||
<input
|
||||
id="handle" name="handle" type="text"
|
||||
minlength="2"
|
||||
maxlength="255"
|
||||
required
|
||||
class="form-control"
|
||||
value="{{ user.handle }}"
|
||||
/>
|
||||
</div>
|
||||
<div class="mb-3">
|
||||
<label for="email">Email</label>
|
||||
<input
|
||||
id="email" name="email" type="email"
|
||||
required
|
||||
class="form-control"
|
||||
value="{{ user.email }}"
|
||||
/>
|
||||
</div>
|
||||
<div class="mb-3">
|
||||
<label for="full_name">Full name</label>
|
||||
<input
|
||||
id="full_name" name="full_name" type="text"
|
||||
maxlength="255"
|
||||
class="form-control"
|
||||
value="{{ user.full_name or '' }}"
|
||||
/>
|
||||
</div>
|
||||
<div class="mb-3">
|
||||
<label for="website">Public website</label>
|
||||
<input
|
||||
id="website" name="website" type="url"
|
||||
maxlength="512"
|
||||
class="form-control"
|
||||
value="{{ user.website or '' }}"
|
||||
/>
|
||||
</div>
|
||||
<div class="mb-3">
|
||||
<label for="picture">Profile picture</label>
|
||||
<!-- for now, no JPEG -->
|
||||
<input
|
||||
id="picture" name="picture"
|
||||
type="file"
|
||||
accept="image/gif, image/png, image/jpeg"
|
||||
class="form-control"
|
||||
>
|
||||
|
||||
</div>
|
||||
<button type="submit" class="btn btn-primary">
|
||||
Update details
|
||||
</button>
|
||||
</form>
|
||||
{% endblock %}
|
||||
28
lib/http_server/src/templates/pages/me/index.html
Normal file
28
lib/http_server/src/templates/pages/me/index.html
Normal file
|
|
@ -0,0 +1,28 @@
|
|||
{% extends "layouts/base.html" %}
|
||||
{% block body %}
|
||||
<h1>Welcome {{ user.full_name or user.handle }}!</h1>
|
||||
|
||||
<a href="/me/details-form">Update details.</a>
|
||||
<a href="/me/authorizations">Manage authorizations.</a>
|
||||
|
||||
<p>
|
||||
{% if user.picture %}
|
||||
<img src="data:image/*;base64,{{ encode_b64str(user.picture) }}" style="width: 150px; height: 150px; object-fit: contain">
|
||||
{% endif %}
|
||||
<ul>
|
||||
<li>
|
||||
My user id: {{ user.id }}
|
||||
</li>
|
||||
<li>
|
||||
My handle: {{ user.handle }}
|
||||
</li>
|
||||
<li>
|
||||
My full name: {{ user.full_name }}
|
||||
</li>
|
||||
<li>
|
||||
My email: {{ user.email }}
|
||||
</li>
|
||||
</ul>
|
||||
</p>
|
||||
{% endblock %}
|
||||
|
||||
47
lib/http_server/src/templates/pages/register.html
Normal file
47
lib/http_server/src/templates/pages/register.html
Normal file
|
|
@ -0,0 +1,47 @@
|
|||
{% extends "layouts/base.html" %}
|
||||
{% block body %}
|
||||
<!-- Register form -->
|
||||
<h1>Register</h1>
|
||||
{% if error %}
|
||||
<div class="alert alert-danger">
|
||||
Error: {{ error }}
|
||||
</div>
|
||||
{% endif %}
|
||||
{% if success %}
|
||||
<div class="alert alert-success">
|
||||
If all the information you submitted are valid and unique, you're account
|
||||
has been created and we've sent you a confirmation email.
|
||||
</div>
|
||||
{% endif %}
|
||||
<form id="register-form" method="post">
|
||||
<div class="mb-3">
|
||||
<label for="handle" class="form-label">Handle</label>
|
||||
<input
|
||||
id="handle" name="handle" type="text"
|
||||
minlength="2"
|
||||
maxlength="255"
|
||||
required
|
||||
class="form-control"
|
||||
/>
|
||||
</div>
|
||||
<div class="mb-3">
|
||||
<label for="email">Email</label>
|
||||
<input
|
||||
id="email" name="email" type="email"
|
||||
required
|
||||
class="form-control"
|
||||
/>
|
||||
</div>
|
||||
<div class="mb-3">
|
||||
<label for="password">Password</label>
|
||||
<input
|
||||
id="password" name="password" type="password"
|
||||
required
|
||||
class="form-control"
|
||||
/>
|
||||
</div>
|
||||
<button type="submit" class="btn btn-primary">
|
||||
Register
|
||||
</button>
|
||||
</form>
|
||||
{% endblock %}
|
||||
|
|
@ -0,0 +1,24 @@
|
|||
{% extends "layouts/base.html" %}
|
||||
{% block body %}
|
||||
<h1>Your authorizations</h1>
|
||||
|
||||
<p>
|
||||
{% if user_authorizations | length == 0 %}
|
||||
<i>You didn't authorized or accessed any applications for now.</i>
|
||||
{% endif %}
|
||||
<ul>
|
||||
{% for item in user_authorizations %}
|
||||
<li>
|
||||
{{ item.client_id }}
|
||||
Scopes: {{ item.scopes }}
|
||||
Last_used_at: {{ item.last_used_at }}
|
||||
<form method="post" action="/me/authorizations/revoke">
|
||||
<input type="hidden" name="authorization_id" value="{{ item.id }}" />
|
||||
<button class="btn btn-primary">Revoke</button>
|
||||
</form>
|
||||
</li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
</p>
|
||||
{% endblock %}
|
||||
|
||||
Loading…
Add table
Add a link
Reference in a new issue