diff frontend/mfrontend/views/frontend.py @ 10:58a993029d9f

Dodawanie nowych zadań i dekorator sprawdzający zalogowanie.
author Michał Rudowicz <michal.rudowicz@fl9.eu>
date Mon, 07 Mar 2011 10:47:48 +0100
parents d86794939fe4
children c87f82a15606
line wrap: on
line diff
--- a/frontend/mfrontend/views/frontend.py	Mon Feb 28 19:25:51 2011 +0100
+++ b/frontend/mfrontend/views/frontend.py	Mon Mar 07 10:47:48 2011 +0100
@@ -2,7 +2,7 @@
 # -*- coding: utf-8 -*-
 
 from flask import Module, render_template, request, url_for
-from flask import escape, session, redirect, flash, abort
+from flask import escape, session, redirect, flash, abort, g
 from mfrontend import db, utils, exceptions
 frontend = Module(__name__)
 
@@ -26,8 +26,9 @@
         try:
             if db.user_can_login(request.form['username'],
                                  request.form['password']) :
+                session['user_id'] = db.get_user_id(request.form['username'])
+                session['user_name'] = request.form['username']
                 session['logged_in'] = True
-                session['logged_user'] = request.form['username']
                 flash(u'Zalogowano')
                 return redirect(url_for('index'))
             else:
@@ -44,6 +45,7 @@
        a w efekcie wylogowanie z systemu.
     """
     session.clear()
+    g.user = None
     flash('Wylogowano')
     return redirect(url_for('index'))