Commit e115298d authored by colmoneill's avatar colmoneill

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

parents 2bf1b7d2 77750370
......@@ -6,6 +6,7 @@ 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
DEBUG = True
......@@ -99,6 +100,11 @@ app.config['MONGODB_PORT'] = 27017
# Create database connection object
db = MongoEngine(app)
# class ExtendedRegisterForm(RegisterForm):
# first_name = db.StringField('First Name')
# last_name = db.StringField('Last Name')
class Role(db.Document, RoleMixin):
name = db.StringField(max_length=80, unique=True)
description = db.StringField(max_length=255)
......@@ -109,13 +115,18 @@ class User(db.Document, UserMixin):
active = db.BooleanField(default=True)
confirmed_at = db.DateTimeField()
roles = db.ListField(db.ReferenceField(Role), default=[])
badge = db.BooleanField(default=True)
login_count = db.StringField(max_length=3)
badges = db.ListField(default=[])
# Setup Flask-Security
user_datastore = MongoEngineUserDatastore(db, User, Role)
user_datastore = MongoEngineUserDatastore(db, User, Role )
security = Security(app, user_datastore)
#security = Security(app, user_datastore, register_form=ExtendedRegisterForm)
# Create a user to test with
# Note the decorator, this runs only once on startup of the server.
# @app.before_first_request
......
......@@ -316,6 +316,65 @@ ul#menuSecond li a:hover {
border-radius: 4px;
}
.badgeImg {
border-radius: 50%;
background-color: #ecf0f1;
overflow: hidden;
flex: 1 0 auto;
height: auto;
position: relative;
background-repeat: no-repeat;
background-position: center center;
background-size: 50%;
}
.laser {
background-image: url(../img/electronique.png);
}
.cnc {
background-image: url(../img/cnc.png);
}
.electronique {
background-image: url(../img/electronique.png);
}
.cad {
background-image: url(../img/electronique.png);
}
.impression3d {
background-image: url(../img/3dprint.png);
}
.badgeImg.active {
background-color: #2ecc71;
}
.badgeImg.fail {
background-color: #e74c3c;
}
/*.badgeImg img{
width: 50%;
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%,-50%);
}*/
.badgeImg:before {
content: "";
float: left;
padding-top: 100%;
}
.badgeItem {
display: block;
text-align: center;
justify-content: space-around;
}
footer {
background: #2c3e50;
height: 200px;
......
......@@ -329,6 +329,80 @@ ul {
}
}
.badgeImg{
border-radius: 50%;
background-color: #ecf0f1;
overflow: hidden;
flex: 1 0 auto;
height:auto;
position: relative;
background-repeat :no-repeat;
background-position: center center ;
background-size: 50%
}
.laser{
background-image: url(../img/electronique.png) ;
}
.cnc{
background-image: url(../img/cnc.png) ;
}
.electronique{
background-image: url(../img/electronique.png) ;
}
.cad{
background-image: url(../img/electronique.png) ;
}
.impression3d {
background-image: url(../img/3dprint.png) ;
}
.badgeImg.active{
background-color:#2ecc71;
}
.badgeImg.fail{
background-color:#e74c3c;
}
/*.badgeImg img{
width: 50%;
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%,-50%);
}*/
.badgeImg:before {
content:'';
float:left;
padding-top:100%;
}
.badgeItem {
display: block;
text-align: center;
justify-content: space-around;
}
footer {
background: #2c3e50;
height: 200px;
......
......@@ -23,87 +23,35 @@
<h3> dashboard for user {{current_user.email}}</h3>
{{ current_user.badges }}
<!-- {{ current_user.badges }} -->
<div class="badgesList">
<div class="row">
<div class="col-2">
<div class="badgeItem">
<div class="badgeImg">
<img src="{{ url_for('static', filename='img/chip.png')}}">
</div>
<span> Electronique </span>
</div>
</div>
<div class="col-2">
<div class="badgeItem">
<div class="badgeImg">
<img src="{{ url_for('static', filename='img/3dprint.png')}}">
</div>
<span> cnc </span>
</div>
</div>
{% for badge in current_user.badges %}
<div class="col-2">
<div class="badgeItem">
<div class="badgeImg active">
<img src="{{ url_for('static', filename='img/cncico.png')}}">
{% if badge.lvl == 1 %}
<div class="badgeImg {{badge.name}} active">
{% elif badge.lvl == 2 %}
<div class="badgeImg {{badge.name}} fail">
{% else %}
<div class="badgeImg {{badge.name}}">
{% endif %}
</div>
<span> arduino </span>
<span>{{ badge.name }}</span>
</div>
</div>
<div class="col-2">
<div class="badgeItem">
<div class="badgeImg">
<img src="{{ url_for('static', filename='img/chip.png')}}">
</div>
<span> cnc </span>
</div>
</div>
{% endfor %}
<div class="col-2">
<div class="badgeItem">
<div class="badgeImg">
<img src="{{ url_for('static', filename='img/chip.png')}}">
</div>
<span> maker </span>
</div>
</div>
<div class="col-2">
<div class="badgeItem">
<div class="badgeImg active">
<img src="{{ url_for('static', filename='img/cncico.png')}}">
</div>
<span> arduino </span>
</div>
</div>
<div class="col-2">
<div class="badgeItem">
<div class="badgeImg fail">
<img src="{{ url_for('static', filename='img/chip.png')}}">
</div>
<span> cnc </span>
</div>
</div>
<div class="col-2">
<div class="badgeItem">
<div class="badgeImg">
<img src="{{ url_for('static', filename='img/chip.png')}}">
</div>
<span> maker </span>
</div>
......@@ -114,45 +62,6 @@
</div>
<style type="text/css">
.badgeImg{
border-radius: 50%;
background-color: #ecf0f1;
overflow: hidden;
flex: 1 0 auto;
height:auto;
position: relative;
}
.badgeImg.active{
background-color:#2ecc71;
}
.badgeImg.fail{
background-color:#e74c3c;
}
.badgeImg img{
width: 50%;
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%,-50%);
}
.badgeImg:before {
content:'';
float:left;
padding-top:100%;
}
.badgeItem {
display: block;
text-align: center;
justify-content: space-around;
}
</style>
{% endblock %}
......@@ -4,14 +4,26 @@
{% block content %}
{% include "security/_messages.html" %}
<h1>{{ _('Register') }}</h1>
<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.password) }}
{% if register_user_form.password_confirm %}
{{ render_field_with_errors(register_user_form.password_confirm) }}
{% endif %}
{{ render_field(register_user_form.submit) }}
</form>
{% include "security/_menu.html" %}
<div class="container ">
<div class="row no-gutters justify-content-md-center align-items-center">
<div class=" col col-12 col-sm-8 col-md-4 col-lg-4">
<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.password) }}
{% if register_user_form.password_confirm %}
{{ render_field_with_errors(register_user_form.password_confirm) }}
{% endif %}
{{ render_field(register_user_form.submit) }}
</form>
</div>
</div>
</div>
{% endblock %}
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