swaf/views/auth/auth.njk

49 lines
2.4 KiB
Plaintext
Raw Normal View History

2020-07-14 15:06:30 +02:00
{% extends 'layouts/base.njk' %}
{% import 'macros.njk' as macros %}
{% set title = 'Authentication / Registration' %}
{% set decription = 'Join ' + app.name + ' and share your files!' %}
{% set h1 = 'Authentication and registration' %}
{% block body %}
<div class="container">
<div class="panel">
2020-07-15 11:42:49 +02:00
{% set queryStr = '' %}
{% if query.redirect_uri | length %}
{% set queryStr = '?' + querystring.stringify({redirect_uri: query.redirect_uri}) %}
{% endif %}
{% set action = route('auth') + queryStr %}
2020-07-14 15:06:30 +02:00
{% if register_confirm_email %}
<form action="{{ action }}" method="POST" id="register-form">
2020-07-14 15:06:30 +02:00
<h2>Register</h2>
{{ macros.message('question', 'Do you wish to create a new account with ' + register_confirm_email + '?', false, false) }}
{{ macros.message('warning', 'If you already have an account, please log in with your existing email first and then add your new email in the Account page.', false, true) }}
<input type="hidden" name="email" value="{{ register_confirm_email }}">
<input type="hidden" name="confirm_register" value="confirm">
<div class="form-field">
<div class="form-display">Email: {{ register_confirm_email }}</div>
</div>
<a href="/auth" class="button transparent">Go back</a>
<button type="submit" class="primary">Register</button>
{{ macros.csrf(getCsrfToken) }}
2020-07-14 15:06:30 +02:00
</form>
{% else %}
<form action="{{ action }}" method="POST" id="login-form">
2020-07-14 15:06:30 +02:00
<h2>Log in or register</h2>
{# {{ macros.message('info', 'If we don\'t find your email address in our database, you will be able to register.', false, true) }} #}
2020-07-14 15:06:30 +02:00
<div class="input-field">
{{ macros.field(_locals, 'email', 'email', query.email or '', 'Your email address', "If we don't find your email address in our database, you will be able to register.", 'required') }}
</div>
<button type="submit">Authenticate</button>
{{ macros.csrf(getCsrfToken) }}
2020-07-14 15:06:30 +02:00
</form>
{% endif %}
</div>
</div>
{% endblock %}