Make modules contain their own static files and templates

This commit is contained in:
Chase Sterling 2016-08-15 23:06:05 -04:00
parent 4a38e896eb
commit 33aa2b851e
20 changed files with 9 additions and 8 deletions

View file

@ -0,0 +1,29 @@
{% from 'macros.html' import render_form, render_field %}
{% if config.get('AUTH_LOCAL_ENABLE') %}
<button type="button" class="btn btn-info" data-toggle="modal" data-target="#ldap-modal">
<i class="fa fa-folder-open-o"></i>&nbsp; Login with LDAP
</button>
<div class="modal fade" id="ldap-modal" tabindex="-1" role="dialog" aria-labelledby="ldap-login">
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
<h4 class="modal-title" id="ldap-login">LDAP Login</h4>
</div>
<div class="modal-body">
{% call render_form(form, action_url=url_for('auth.ldap.login'), action_text='Login', btn_class='btn btn-primary') %}
{{ render_field(form.username, placeholder='Username', type='text', required=1) }}
{{ render_field(form.password, placeholder='Password', type='password', required=1) }}
{% endcall %}
</div>
</div>
</div>
</div>
{% else %}
<h3><i class="fa fa-folder-open-o"></i>&nbsp;LDAP Login</h3>
{% call render_form(form, action_url=url_for('auth.ldap.login'), action_text='Login', btn_class='btn btn-primary') %}
{{ render_field(form.username, placeholder='Username', type='text', required=1) }}
{{ render_field(form.password, placeholder='Password', type='password', required=1) }}
{% endcall %}
{% endif %}

View file

@ -0,0 +1,5 @@
{% from 'macros.html' import render_form, render_field %}
{% call render_form(form, action_url=url_for('auth.local.login'), action_text='Login', btn_class='btn btn-primary') %}
{{ render_field(form.email, placeholder='Email', type='email', required=1) }}
{{ render_field(form.password, placeholder='Password', type='password', required=1) }}
{% endcall %}

View file

@ -0,0 +1,4 @@
{% extends 'layout.html' %}
{% block body %}
{{ forms|safe }}
{% endblock %}

View file

@ -0,0 +1,13 @@
{% extends 'layout.html' %}
{% from 'macros.html' import render_form, render_field %}
{% block body %}
{% call render_form(form, action_url=url_for('auth.local.register'), action_text='Register', btn_class='btn btn-primary') %}
{{ render_field(form.username, placeholder='Username', type='username', **{"required": 1, "data-parsley-type": "alphanum"}) }}
{{ render_field(form.email, placeholder='Email', type='email', required=1) }}
{{ render_field(form.password, placeholder='Password', type='password', **{"required": 1, "data-parsley-minlength": "6"}) }}
{{ render_field(form.confirm, placeholder='Confirm Password', type='password', **{"required": 1, "data-parsley-minlength": "6"}) }}
{% if config.RECAPTCHA_ENABLE %}
{{ render_field(form.recaptcha) }}
{% endif %}
{% endcall %}
{% endblock %}

View file

@ -0,0 +1,5 @@
{% extends 'layout.html' %}
{% from 'macros.html' import render_form, render_field %}
{% block body %}
{% endblock %}

View file

@ -2,7 +2,7 @@ from flask import current_app, render_template, request, redirect, Blueprint, fl
from flask.ext.login import logout_user
from realms.modules.auth.models import Auth
blueprint = Blueprint('auth', __name__)
blueprint = Blueprint('auth', __name__, template_folder='templates')
@blueprint.route("/login", methods=['GET', 'POST'])