X-Git-Url: http://git.cyclocoop.org/?a=blobdiff_plain;f=main.py;h=c3ebd37b640605b240f0eba6202da1a7d22851b7;hb=ea22ed15253ede8591a26e4c7b91a8bf2abcadbc;hp=6b391c3beb319fa00722c0786262fbd987e31e66;hpb=9dccdd0b2023a045dc7d1cd53c2c7925e8fea7b1;p=cavote.git diff --git a/main.py b/main.py index 6b391c3..c3ebd37 100755 --- a/main.py +++ b/main.py @@ -92,6 +92,8 @@ def login(): else: connect_user(user) flash(u'Vous êtes connecté. Bienvenue, %s !' % user['name'], 'success') + if request.args.get('continue'): + return redirect(request.args['continue']) return redirect(url_for('home')) return render_template('login.html') @@ -99,6 +101,8 @@ def login(): def logout(): disconnect_user() flash(u'Vous avez été déconnecté.', 'info') + if request.args.get('continue') and not "admin" in request.args.get('continue'): + return redirect(request.args['continue']) return redirect(url_for('home')) #----------------- @@ -120,7 +124,7 @@ def password_lost(): "From: %s" % EMAIL, "To: %s" % user['email'], "Subject: [Cavote] Password lost", - "Date: %s" % time.strftime("%a, %d %b %Y %H:%M:%S +0000", time.gmtime()), + "Date: %s" % time.strftime("%a, %d %b %Y %H:%M:%S +0000", time.gmtime()).decode('utf-8'), "X-Mailer: %s" % VERSION, "", "You have lost your password.", @@ -250,7 +254,7 @@ def admin_user_add(): "From: %s" % EMAIL, "To: %s" % user['email'], "Subject: [Cavote] Welcome", - "Date: %s" % time.strftime("%a, %d %b %Y %H:%M:%S +0000", time.gmtime()), + "Date: %s" % time.strftime("%a, %d %b %Y %H:%M:%S +0000", time.gmtime()).decode('utf-8'), "X-Mailer: %s" % VERSION, "", "Hi %s!" % user['name'], @@ -428,7 +432,7 @@ def has_voted(idvote, iduser=-1): @app.route('/vote/', methods=['GET', 'POST']) def vote(idvote): - vote = query_db('select votes.*, groups.name as groupname from votes join groups on groups.id=votes.id_group where votes.id=?', [idvote], one=True) + vote = query_db('select votes.*, groups.name as groupname, users.name as author from votes join groups on groups.id=votes.id_group join users on users.id=votes.id_author where votes.id=?', [idvote], one=True) if vote is None: abort(404) if can_see_vote(idvote, get_userid()):