aboutsummaryrefslogtreecommitdiffstats
path: root/mediagoblin/plugins
diff options
context:
space:
mode:
Diffstat (limited to 'mediagoblin/plugins')
-rw-r--r--mediagoblin/plugins/piwigo/tools.py3
-rw-r--r--mediagoblin/plugins/piwigo/views.py9
2 files changed, 6 insertions, 6 deletions
diff --git a/mediagoblin/plugins/piwigo/tools.py b/mediagoblin/plugins/piwigo/tools.py
index 30bb4b97..484ea531 100644
--- a/mediagoblin/plugins/piwigo/tools.py
+++ b/mediagoblin/plugins/piwigo/tools.py
@@ -84,7 +84,8 @@ def response_xml(result):
err = ET.SubElement(r, "err")
err.set("code", str(result.code))
err.set("msg", result.msg)
- status = result.code
+ if result.code >= 100 and result.code < 600:
+ status = result.code
else:
_fill_element(r, result)
return Response(ET.tostring(r, encoding="utf-8", xml_declaration=True),
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()