diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..6245b64 --- /dev/null +++ b/.gitignore @@ -0,0 +1,4 @@ +app.db + +__pycache__/ +app/__pycache__/ diff --git a/README.md b/README.md index b2f9414..cee7f2c 100644 --- a/README.md +++ b/README.md @@ -1 +1,6 @@ -projet v5 +# Planète Casio v5 + +## Style de code + +* L'indentation se fait avec des tabulations +* Merci d'essayer de respecter les 80 colonnes max diff --git a/app/routes.py b/app/routes.py index c7e0fd2..fe7f6f6 100644 --- a/app/routes.py +++ b/app/routes.py @@ -8,48 +8,45 @@ from app.models import User @app.route('/', methods=['GET', 'POST']) def index(): - - form = LoginForm() - if form.validate_on_submit(): - user = User.query.filter_by(username=form.username.data).first() - if user is None or not user.check_password(form.password.data): - flash('pseudo ou mot de passe invalide') - return redirect(url_for('index')) - login_user(user, remember=form.remember_me.data) - - - return render_template('index.html', form=form) + form = LoginForm() + if form.validate_on_submit(): + user = User.query.filter_by(username=form.username.data).first() + if user is None or not user.check_password(form.password.data): + flash('pseudo ou mot de passe invalide') + return redirect(url_for('index')) + login_user(user, remember=form.remember_me.data) + return render_template('index.html', form=form) @app.route('/logout/') def logout(): - logout_user() - return redirect(url_for('index')) + logout_user() + return redirect(url_for('index')) @app.route('/register', methods=['GET', 'POST']) def register(): - if current_user.is_authenticated: - return redirect(url_for('index')) - form = LoginForm() - form2 = RegistrationForm() - if form2.validate_on_submit(): - user = User(username=form2.username.data, email=form2.email.data) - user.set_password(form2.password.data) - db.session.add(user) - db.session.commit() - flash('Congratulations, you are now a registered user!') - return redirect(url_for('validation')) - return render_template('register.html', title='Register', form=form, form2 = form2) + if current_user.is_authenticated: + return redirect(url_for('index')) + form = LoginForm() + form2 = RegistrationForm() + if form2.validate_on_submit(): + user = User(username=form2.username.data, email=form2.email.data) + user.set_password(form2.password.data) + db.session.add(user) + db.session.commit() + flash('Congratulations, you are now a registered user!') + return redirect(url_for('validation')) + return render_template('register.html', title='Register', form=form, form2 = form2) @app.route('/register/validation/') def validation(): - if current_user.is_authenticated : - return redirect(url_for('index')) - form = LoginForm() - return render_template('validation.html', form = form) \ No newline at end of file + if current_user.is_authenticated : + return redirect(url_for('index')) + form = LoginForm() + return render_template('validation.html', form = form) diff --git a/app/static/css/navbar.css b/app/static/css/navbar.css index 5dec525..4e8009e 100644 --- a/app/static/css/navbar.css +++ b/app/static/css/navbar.css @@ -98,15 +98,15 @@ nav a:focus { #menu { position: fixed; z-index: 5; left: -240px; width: 300px; /* left-to-right animation */ - /*left: 60px; width: 0;*/ /* scroll animation */ + /*left: 60px; width: 0;*/ /* scroll animation */ height: 100%; overflow-x: hidden; overflow-y: auto; font-family: NotoSans; font-size: 14px; background: #22292c; box-shadow: 0 0 5px rgba(0, 0, 0, 0.3); - transition: 2s ease; + transition: .15s ease; } #menu.opened { - left: 60px; /* left-to-right animation */ + left: 60px; /* left-to-right animation */ /*width: 300px;*/ /* scroll animation */ } diff --git a/app/templates/base/base.html b/app/templates/base/base.html new file mode 100644 index 0000000..a5eb781 --- /dev/null +++ b/app/templates/base/base.html @@ -0,0 +1,14 @@ + + + {% include "base/head.html" %} +
+ {% include "base/navbar.html" %} + + {% block container %} + {% endblock container %} + + {% include "base/footer.html" %} + + {% include "base/scripts.html" %} + + diff --git a/app/templates/base/container.html b/app/templates/base/container.html new file mode 100644 index 0000000..cf4302e --- /dev/null +++ b/app/templates/base/container.html @@ -0,0 +1,10 @@ +{% extends "base/base.html" %} + +{% block container %} +du contenu....
-du contenu....
+New User? Click to Register!
+New User? Click to Register!
{% endblock %} diff --git a/app/templates/navbar.html b/app/templates/navbar.html deleted file mode 100644 index c19c470..0000000 --- a/app/templates/navbar.html +++ /dev/null @@ -1,327 +0,0 @@ -{% extends "head.html" %} - - -{% block body%} - - - - - - -{% block container %} - -{% endblock container %} - -{% endblock body %} \ No newline at end of file diff --git a/app/templates/validation.html b/app/templates/validation.html index 9521226..cf2108b 100644 --- a/app/templates/validation.html +++ b/app/templates/validation.html @@ -1,4 +1,4 @@ -{% extends "footer.html" %} +{% extends "base/container.html" %} {% block content %}