From 725a23979b499efa49b3b9dae2b9348939de8191 Mon Sep 17 00:00:00 2001 From: Holger Frey Date: Wed, 27 Sep 2017 13:01:14 +0200 Subject: [PATCH] added basic user login / logout --- ordr2/resources/__init__.py | 4 +- ordr2/scripts/initializedb.py | 1 + ordr2/static/css/style.css | 34 ++++++++-------- ordr2/templates/account/login.jinja2 | 36 +++++++++++++++++ ordr2/templates/layout.jinja2 | 5 +-- ordr2/views/account.py | 60 ++++++++++++++++++++++++++++ 6 files changed, 118 insertions(+), 22 deletions(-) create mode 100644 ordr2/templates/account/login.jinja2 create mode 100644 ordr2/views/account.py diff --git a/ordr2/resources/__init__.py b/ordr2/resources/__init__.py index fea0e0a..f8358bf 100644 --- a/ordr2/resources/__init__.py +++ b/ordr2/resources/__init__.py @@ -10,9 +10,9 @@ class Root(BaseResource): __name__ = None __parent__ = None - _nodes = [ + _nodes = { 'account': Account - ] + } def __init__(self, request): self._request = request diff --git a/ordr2/scripts/initializedb.py b/ordr2/scripts/initializedb.py index 924285e..5a7c676 100644 --- a/ordr2/scripts/initializedb.py +++ b/ordr2/scripts/initializedb.py @@ -49,3 +49,4 @@ def main(argv=sys.argv): role=Role.ADMIN ) model.set_password('holgi') + dbsession.add(model) diff --git a/ordr2/static/css/style.css b/ordr2/static/css/style.css index 7cc3812..ca5b5ba 100755 --- a/ordr2/static/css/style.css +++ b/ordr2/static/css/style.css @@ -4,7 +4,7 @@ html, body { body { background-color: #FCFCFC; - + } /*Opera Fix*/ @@ -81,7 +81,7 @@ body:before {/* thanks to Maleika (Kohoutec)*/ display: table; height: 86px; margin-bottom: -47px; - width: 100%; + width: 100%; } .content .container-fluid, .content .container { @@ -99,8 +99,8 @@ footer { footer a { display: inline-block; - height: 26px; - opacity: 0.5; + height: 26px; + opacity: 0.5; -webkit-transition: all 0.5s ease 0s; -moz-transition: all 0.5s ease 0s; -o-transition: all 0.5s ease 0s; @@ -127,7 +127,7 @@ footer .icon-dbs { background-image: url(../img/sprite.png); background-position: 0px -214px; height: 26px; - width: 174px; + width: 174px; } /*================================ BUTTONS ================================*/ @@ -310,7 +310,7 @@ button.btn-flat { width: 18px; display: inline-block; overflow: hidden; - text-indent: -9999px; + text-indent: -9999px; } .search .autocomplete { @@ -321,7 +321,7 @@ button.btn-flat { width: 18px; display: inline-block; overflow: hidden; - text-indent: -9999px; + text-indent: -9999px; } .search .add-on:active { @@ -474,7 +474,7 @@ table .action.edit:hover { } .modal-body .option a { - font-weight: bold; + font-weight: bold; } .modal-body .checklist { @@ -542,7 +542,7 @@ table .action.edit:hover { #register-successful, #access-denied { margin: 90px 0 50px; - text-align: center; + text-align: center; } #register-successful h1, #access-denied h1 { @@ -566,7 +566,7 @@ hgroup .info { line-height: 24px; } -.account.login_failed h1 { +.account.login h1 { border-bottom: 1px solid #EEEEEE; font-family: 'Anton',sans-serif; font-size: 50px; @@ -582,7 +582,7 @@ hgroup .info { -webkit-transition: background-color 0.50s linear; -moz-transition: background-color 0.50s linear; -o-transition: background-color 0.50s linear; - transition: background-color 0.50s linear; + transition: background-color 0.50s linear; } .admin-options .option { @@ -626,7 +626,7 @@ hgroup .info { margin-bottom: 5px; -webkit-border-radius: 5px; -moz-border-radius: 5px; - border-radius: 5px; + border-radius: 5px; } .faq section { @@ -668,7 +668,7 @@ hgroup .info { -webkit-transition: background-color 0.1s ease 0s; -moz-transition: background-color 0.1s ease 0s; -o-transition: background-color 0.1s ease 0s; - transition: background-color 0.1s ease 0s; + transition: background-color 0.1s ease 0s; } .accordion li:hover { @@ -686,11 +686,11 @@ hgroup .info { padding: 0; -webkit-border-radius: 5px; -moz-border-radius: 5px; - border-radius: 5px; + border-radius: 5px; -webkit-transition: background-color 0.1s ease 0s; -moz-transition: background-color 0.1s ease 0s; -o-transition: background-color 0.1s ease 0s; - transition: background-color 0.1s ease 0s; + transition: background-color 0.1s ease 0s; } .accordion-heading a { @@ -698,14 +698,14 @@ hgroup .info { display: block; font-size: 18px; font-weight: bold; - line-height: 27px; + line-height: 27px; padding: 8px 15px; text-decoration: none; outline: none; -webkit-transition: color 0.1s ease 0s; -moz-transition: color 0.1s ease 0s; -o-transition: color 0.1s ease 0s; - transition: color 0.1s ease 0s; + transition: color 0.1s ease 0s; } .accordion-heading a:hover { diff --git a/ordr2/templates/account/login.jinja2 b/ordr2/templates/account/login.jinja2 new file mode 100644 index 0000000..000564f --- /dev/null +++ b/ordr2/templates/account/login.jinja2 @@ -0,0 +1,36 @@ +{% extends "ordr2:templates/layout.jinja2" %} + +{% block subtitle %} Login {% endblock subtitle %} + +{% block content %} +
+
+
+

Log in

+ session->flashdata('message'); ?> +
+
+
+
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+ + +
+
+
+
+
+{% endblock content %} diff --git a/ordr2/templates/layout.jinja2 b/ordr2/templates/layout.jinja2 index fc25c77..f5b6dce 100644 --- a/ordr2/templates/layout.jinja2 +++ b/ordr2/templates/layout.jinja2 @@ -34,13 +34,13 @@ @@ -51,7 +51,6 @@