diff options
author | Elrond <elrond+mediagoblin.org@samba-tng.org> | 2013-05-20 17:50:04 +0200 |
---|---|---|
committer | Elrond <elrond+mediagoblin.org@samba-tng.org> | 2013-05-20 19:36:28 +0200 |
commit | 4adc3a85dda878b40f44e07b2283d4c55c6c5d02 (patch) | |
tree | f234c81d29999d8f171df8a4b3bae5935b149720 /mediagoblin/plugins/piwigo/views.py | |
parent | 68910f6797e7e5a2e0d8e5b966861f9df0523e42 (diff) | |
download | mediagoblin-4adc3a85dda878b40f44e07b2283d4c55c6c5d02.tar.lz mediagoblin-4adc3a85dda878b40f44e07b2283d4c55c6c5d02.tar.xz mediagoblin-4adc3a85dda878b40f44e07b2283d4c55c6c5d02.zip |
piwigo: Return proper error for wrong user/password.
And fix tests.
Diffstat (limited to 'mediagoblin/plugins/piwigo/views.py')
-rw-r--r-- | mediagoblin/plugins/piwigo/views.py | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/mediagoblin/plugins/piwigo/views.py b/mediagoblin/plugins/piwigo/views.py index 5633f136..1c655bf5 100644 --- a/mediagoblin/plugins/piwigo/views.py +++ b/mediagoblin/plugins/piwigo/views.py @@ -28,8 +28,8 @@ from mediagoblin.media_types import sniff_media from mediagoblin.submit.lib import check_file_field, prepare_queue_task, \ run_process_media -from .tools import CmdTable, PwgNamedArray, response_xml, check_form, \ - PWGSession +from .tools import CmdTable, response_xml, check_form, \ + PWGSession, PwgNamedArray, PwgError from .forms import AddSimpleForm, AddForm @@ -40,15 +40,14 @@ _log = logging.getLogger(__name__) def pwg_login(request): username = request.form.get("username") password = request.form.get("password") - _log.debug("Login for %r/%r...", username, password) user = request.db.User.query.filter_by(username=username).first() if not user: _log.info("User %r not found", username) fake_login_attempt() - return False + return PwgError(999, 'Invalid username/password') if not user.check_login(password): _log.warn("Wrong password for %r", username) - return False + return PwgError(999, 'Invalid username/password') _log.info("Logging %r in", username) request.session["user_id"] = user.id request.session.save() |