add more mail / ui stuff

This commit is contained in:
TuxCoder 2022-05-27 12:35:28 +02:00
parent 18863bee7f
commit 2b86fa89c4
9 changed files with 86 additions and 3006 deletions

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View file

@ -19,7 +19,7 @@
<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>
<a title="{{ gettext('Accept')}}" 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 %}

View file

@ -0,0 +1,25 @@
{% extends 'auth/base.html.j2' %}
{% block title %}{{ gettext('Out of Bound Token') }}{% endblock %}
{% block content %}
<h2> Out of bound token exchange</h2>
<p>
Data:
<div>
<label>code</label>
<input disabled="disabled" value="{{ token_info["code"]|e }}" />
</div>
<div>
<label>scope</label>
<input disabled="disabled" value="{{ token_info["scope"]|e }}" />
</div>
<div>
<label>state</label>
<input disabled="disabled" value="{{ token_info["state"]|e }}" />
</div>
</p>
{% endblock %}

View file

@ -213,9 +213,9 @@
action_text - text of submit button
class_ - sets a class for form
#}
{% macro render_form(form, action_url='', action_text='Submit', class_='', btn_class='btn btn-primary', method='post') -%}
{% macro render_form(form, action_url='', action_text='Submit', class_='', btn_class='btn btn-primary', 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 %}{% if onsubmit %}onsubmit="{{ onsubmit }}" {% endif %}role="form" class="{{ class_ }}">
<input name="form" type="hidden" value="{{ form.__class__.__name__ }}">
{{ _render_form(form) }}
{% if not form.submit %}

View file

@ -49,7 +49,6 @@ def introspect() -> ResponseReturnValue:
return jsonify({}), 500
token_info = resp.json()
#token_info = introspect_o_auth_2_token.sync(_client=hydra_service, token=token)
logger.error(f'debug hydra: {token_info}')
if not token_info['active']:
return jsonify({'active': False})
@ -59,3 +58,20 @@ def introspect() -> ResponseReturnValue:
return jsonify(token_info)
@api_views.route('email/login', methods=['POST'])
def email_login() -> ResponseReturnValue:
logger.error(f'{request}')
logger.error(f'{request.headers}')
if not request.is_json:
return {}, 400
req_payload = request.get_json()
logger.error(f'{req_payload}')
password = req_payload["password"]
username = req_payload["username"]
if password == "123456":
return jsonify({})
return jsonify({}), 403

View file

@ -227,3 +227,15 @@ def sign_up_submit():
'status': 'error',
'errors': form.errors
})
@auth_views.route("/oob", methods=["GET"])
def oob_token():
token_info = {
'code': request.args.get('code', default="", type=str),
'scope': request.args.get('scope', default="", type=str),
'state': request.args.get('state', default="", type=str),
}
return render_template('auth/oob.html.j2', token_info=token_info)