Repository :
http://git.fedorahosted.org/cgit/copr.git
On branch : master
---------------------------------------------------------------
commit e8d9af5e57e32d86d347afa3b58d03bdbe593622
Author: Pierre-Yves Chibon <pingou(a)pingoured.fr>
Date: Tue Jan 8 08:11:25 2013 +0100
Warn when user not in the allowed list.
At the moment when a user is not in the list of allowed user, the
application fails silently.
This commit adds an information message to the user explaining that
something happens but that he cannot log in as he is just not
allowed.
---------------------------------------------------------------
coprs_frontend/coprs/views/misc.py | 8 +++++++-
1 files changed, 7 insertions(+), 1 deletions(-)
diff --git a/coprs_frontend/coprs/views/misc.py b/coprs_frontend/coprs/views/misc.py
index ca67c75..be4be05 100644
--- a/coprs_frontend/coprs/views/misc.py
+++ b/coprs_frontend/coprs/views/misc.py
@@ -19,8 +19,14 @@ def login():
return flask.redirect(oid.get_next_url())
if flask.request.method == 'POST':
fasusername = flask.request.form.get('fasuname')
- if fasusername and ((app.config['USE_ALLOWED_USERS'] and fasusername in
app.config['ALLOWED_USERS']) or not app.config['USE_ALLOWED_USERS']):
+ if fasusername and ((app.config['USE_ALLOWED_USERS'] \
+ and fasusername in app.config['ALLOWED_USERS']) \
+ or not app.config['USE_ALLOWED_USERS']):
return
oid.try_login('http://{0}.id.fedoraproject.org/'.format(fasusername), ask_for =
["email"])
+ else:
+ return flask.render_template('login.html',
+ error='User "{0}" is not allowed'.format(
+ fasusername))
return flask.render_template('login.html',
next=oid.get_next_url(),
error=oid.fetch_error())