Commit 1cdadfa1 authored by Sacha's avatar Sacha Committed by SXibolet@2PITAU
Browse files

tweaks for the anonymous account

parent 45b4024e
......@@ -3,7 +3,8 @@
Controversy: joint mining of news text and social media to discover controversial points in news.
Controversy: joint mining of news text and
social media to discover controversial points in news.
Runs server.
......@@ -90,11 +91,15 @@ def api_docs():
@application.route('/login/<username>', methods=['GET', 'POST'])
@application.route("/login", defaults={'username': None}, methods=['GET', 'POST'])
defaults={'username': None},
methods=['GET', 'POST'])
def login(username):
if loggedin():
return redirect('/')
form = forms.Login()
if form.validate_on_submit():
session['username'] = form.username
......@@ -112,7 +117,8 @@ def login(username):
def register():
form = forms.Register()
if form.validate_on_submit():
flash("thanks, %s; please confirm your password" % first_name(
flash('thanks, %s; please confirm your password' %
return redirect('login/%s' % form.username)
return render_template('register.html',
......@@ -127,15 +133,18 @@ def logout():
u = session['username']
session.pop('username', None)
session.pop('user', None)
flash("<b>%s</b>, you were logged out" % u)
flash('<b>%s</b>, you were logged out' % u)
return redirect('/login')
def register_anon():
def clear_anon():
u = session.get('username')
if u is not None:
session.pop('username', None)
session.pop('user', None)
def register_anon():
return redirect('/register')
......@@ -145,7 +154,7 @@ def account():
form = forms.Login()
if form.validate_on_submit():
flash("Account destroyed with vengeance!")
flash('Account destroyed with vengeance!')
return logout()
return render_template('account.html',
......@@ -161,7 +170,8 @@ def account():
def clear_queries():
if session['username'] != ANON_UNAME:
return redirect('account')
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