Commit afe1e0d5 authored by erreur401's avatar erreur401

Merge branch 'master' of gitlab.com:bemaker/eu.bemaker.flask

parents a5336459 89f6631b
......@@ -6,7 +6,8 @@ import glob
from flask_mongoengine import *
from flask_security import Security, MongoEngineUserDatastore, UserMixin, RoleMixin, login_required, current_user
from flask_mail import Mail
from flask_security.forms import RegisterForm
from flask_security.forms import RegisterForm, StringField
from wtforms.validators import DataRequired
DEBUG = True
......@@ -117,14 +118,18 @@ class User(db.Document, UserMixin):
roles = db.ListField(db.ReferenceField(Role), default=[])
badges = db.ListField(default=[])
dashboard_view_count = db.StringField(max_length=3)
first_name = db.StringField(max_length=255)
last_name = db.StringField(max_length=255)
class ExtendedRegisterForm(RegisterForm):
first_name = StringField('First Name', validators=[DataRequired()])
last_name = StringField('Last Name', validators=[DataRequired()])
# Setup Flask-Security
user_datastore = MongoEngineUserDatastore(db, User, Role )
security = Security(app, user_datastore)
#security = Security(app, user_datastore)
#security = Security(app, user_datastore, register_form=ExtendedRegisterForm)
security = Security(app, user_datastore, register_form=ExtendedRegisterForm)
# Create a user to test with
......
......@@ -2,7 +2,12 @@
{% if messages %}
<ul class="flashes">
{% for category, message in messages %}
<li class="{{ category }}">{{ message }}</li>
<div class="alert alert-{{ category }} alert-dismissible fade show" role="alert">
{{ message }}
<button type="button" class="close" data-dismiss="alert" aria-label="Close">
<span aria-hidden="true">&times;</span>
</button>
</div>
{% endfor %}
</ul>
{% endif %}
......
......@@ -13,7 +13,9 @@
<form action="{{ url_for_security('register') }}" method="POST" name="register_user_form">
{{ register_user_form.hidden_tag() }}
{{ render_field_with_errors(register_user_form.email) }}
{{ render_field_with_errors(register_user_form.first_name) }}
{{ render_field_with_errors(register_user_form.last_name) }}
{{ render_field_with_errors(register_user_form.email) }}
{{ render_field_with_errors(register_user_form.password) }}
{% if register_user_form.password_confirm %}
{{ render_field_with_errors(register_user_form.password_confirm) }}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment