add more registration stuff, admin interface

This commit is contained in:
TuxCoder 2020-06-01 23:43:10 +02:00
parent c1c8876b63
commit 67b69104d6
23 changed files with 369 additions and 92 deletions

View file

@ -0,0 +1,37 @@
{% extends 'base.html.j2' %}
{% block body %}
<div class="container-fluid">
<div class="row">
{% for message in get_flashed_messages() %}
<div class="alert alert-warning">
<button type="button" class="close" data-dismiss="alert">&times;</button>
{{ message }}
</div>
{% endfor %}
</div>
<div class="row">
<nav class="col-md-2 d-none d-md-block bg-light sidebar fixed-top">
<div class="sidebar-sticky active">
<li class="nav-item"><a class="nav-link" href="{{ url_for('admin.users') }}">{{ gettext('users') }}</a></li>
<li class="nav-item"><a class="nav-link" href="{{ url_for('admin.registrations') }}">{{ gettext('registrations') }}</a></li>
</div>
</nav>
<main class="col-md-9 ml-sm-auto col-lg-10 px-4" role="main">
<h1>{% block title %}{% endblock %}</h1>
<div class="card">
<div class="card-body mt-5 mb-5">
<div class="tab-content">
{% block content %}{% endblock %}
</div>
</div>
</div>
</main>
</div>
</div>
{% endblock %}

View file

@ -0,0 +1,2 @@
{% extends 'admin/base.html.j2' %}

View file

@ -0,0 +1,28 @@
{% extends 'admin/base.html.j2' %}
{% block title %}{{ gettext('registrations') }}{% endblock %}
{% block content %}
<table class="table">
<thead>
<tr>
<th>username</th>
<th>created_at</th>
<th>action<th>
</tr>
</thead>
<tbody>
{% for user in users %}
<tr>
<td>{{ user.username }}</td>
<td>{{ user.created_at }}</td>
<td>
<a title="{{ gettext('Reject')}}" href="{{ url_for('.registration_delete', registration_id=user.id) }}" onclick="admin.registration.delete(this.href, '{{ user.username }}'); return false;"><i class="fas fa-ban"></i></a>
<a title="{{ gettext('Reject')}}" href="{{ url_for('.registration_accept', registration_id=user.id) }}" onclick="admin.registration.accept(this.href, '{{ user.username }}'); return false;"><i class="fas fa-check"></i></a>
</td>
</tr>
{% endfor %}
</tbody>
</table>
{% endblock%}

View file

@ -0,0 +1,26 @@
{% extends 'admin/base.html.j2' %}
{% block title %}{{ gettext('users') }}{% endblock %}
{% block content %}
<table class="table">
<thead>
<tr>
<th>username</th>
<th>created_at</th>
<th>modified_at<th>
</tr>
</thead>
<tbody>
{% for user in users %}
<tr>
<td>{{ user.username }}</td>
<td>{{ user.created_at }}</td>
<td>{{ user.modified_at }}</td>
<td></td>
</tr>
{% endfor %}
</tbody>
</table>
{% endblock%}

View file

@ -2,12 +2,7 @@
{% block body %}
<nav class="navbar navbar-dark fixed-top bg-dark flex-md-nowrap p-0 shadow">
<div class="col-xs-1"><button id="sidebarCollapse" class="btn btn-primary d-xs-block d-md-none" ><i class="fa fa-bars fa-2x"></i></button></div>
<div class="col-xs-11"><a class="navbar-brand col-xs-11 col-sm-3 col-md-2 mr-0" href="/">Lenticular Cloud</a></div>
</nav>
<div style="height: 40px"></div>
<div class="container-fluid">
<div class="row">
{% for message in get_flashed_messages() %}

View file

@ -5,7 +5,7 @@
{% block content %}
{{ render_form(form) }}
{{ render_form(form, onsubmit="return auth.sign_up.submit(this)", action_url=url_for('auth.sign_up_submit')) }}
{% endblock %}

View file

@ -153,9 +153,9 @@
action_text - text of submit button
class_ - sets a class for form
#}
{% macro render_form(form, action_url='', class_='', method='post') -%}
{% macro render_form(form, action_url='', class_='', method='post', onsubmit='') -%}
<form method="{{ method }}" {% if action_url %}action="{{ action_url }}" {% endif %}role="form" class="{{ class_ }}">
<form method="{{ method }}" {% if action_url %}action="{{ action_url }}" {% endif %}role="form" class="{{ class_ }}" {% if onsubmit %}onsubmit="{{ onsubmit }}"{% endif %}>
<input name="form" type="hidden" value="{{ form.__class__.__name__ }}">
{{ _render_form(form) }}
</form>

View file

@ -3,13 +3,6 @@
{% block body %}
<nav class="navbar navbar-dark fixed-top bg-dark flex-md-nowrap p-0 shadow">
<div class="col-xs-1"><button id="sidebarCollapse" class="btn btn-primary d-xs-block d-md-none" ><i class="fa fa-bars fa-2x"></i></button></div>
<div class="col-xs-11"><a class="navbar-brand col-xs-11 col-sm-3 col-md-2 mr-0" href="/">Lenticular Cloud</a></div>
</nav>
<div style="height: 40px"></div>
<div class="container-fluid">
<div class="row">
{% for message in get_flashed_messages() %}

View file

@ -7,20 +7,25 @@
<table class="table">
<thead>
<th>{{ gettext('Client ID') }}</th>
<th>{{ gettext('Remember me') }}</th>
<th>{{ gettext('Created at') }}
<th>{{ gettext('Action') }}
<tr>
<th>{{ gettext('Client ID') }}</th>
<th>{{ gettext('Remember') }}</th>
<th>{{ gettext('Created at') }}
<th>{{ gettext('Action') }}
</tr>
</thead>
{% for consent_session in consent_sessions %}
<tr>
<td>{{ consent_session.consent_request.client.client_id }}</td>
<td>{{ consent_session.remember }}</td>
<td>{{ consent_session.handled_at }}</td>
<td>
<a title="{{ gettext('Revoke')}}" href="{{ url_for('.oauth2_token_revoke', client_id=consent_session.consent_request.client.client_id) }}" onclick="oauth2_token.revoke(this.href, '{{ consent_session.consent_request.client.client_id }}'); return false;"><i class="fas fa-ban"></i></a>
</td>
</tr>
<tbody>
{% for consent_session in consent_sessions %}
<tr>
<td>{{ consent_session.consent_request.client.client_id }}</td>
<td>{{ consent_session.remember }}</td>
<td>{{ consent_session.handled_at }}</td>
<td>
<a title="{{ gettext('Revoke')}}" href="{{ url_for('.oauth2_token_revoke', client_id=consent_session.consent_request.client.client_id) }}" onclick="oauth2_token.revoke(this.href, '{{ consent_session.consent_request.client.client_id }}'); return false;"><i class="fas fa-ban"></i></a>
</td>
</tr>
</tbody>
{% endfor %}
</table>
{% endblock %}

View file

@ -10,26 +10,27 @@
<body>
<div class='messages-box'>
</div>
<template id='confirm-dialog-template'>
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title"></h5>
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
</div>
<nav class="navbar navbar-dark fixed-top bg-dark flex-md-nowrap p-0 shadow">
{% if current_user.is_authenticated %}
<a class="nav-link" href="{{ url_for('frontend.logout') }}">{{ gettext('Logout') }}</a>
Hallo {{ current_user.username }}
{% endif %}
<div class="col-xs-1"><button id="sidebarCollapse" class="btn btn-primary d-xs-block d-md-none" ><i class="fa fa-bars fa-2x"></i></button></div>
<div class="col-xs-11"><a class="navbar-brand col-xs-11 col-sm-3 col-md-2 mr-0" href="/">Lenticular Cloud</a></div>
</nav>
<div class="modal-body">
</div>
<div class="modal-footer">
<button type="button" class="btn btn-danger close" data-dismiss="modal">Cancel</button>
<button type="button" class="btn btn-primary btn-ok process">Process</button>
</div>
</div>
</div>
</template>
<div style="height: 40px"></div>
{% block body %}{% endblock %}
<div class='container'>
<div class="mt-5 row justify-content-center">
<footer>
<span class="text-muted">Render Time: {{ g.request_time() }}</span> | <span class="text-muted">{{ gettext('All right reserved. &copy;') + '2020' }}</span>
</footer>
</div>
</div>
<script type="application/javascript" src="/static/main.js?v={{ GIT_HASH }}" ></script>
<script type="application/javascript" >
{% block script_js %}{% endblock %}