Merge branch 'maintenance' of github.com:foosel/OctoPrint into dev/permission

This commit is contained in:
Marc Hannappel committed 2017-10-25 14:43:38 +02:00
commit 68c57cc4eb
2 files changed
+22 -2

No files matched your search

+3
View File
@@ -206,6 +206,9 @@ def login():
user = octoprint.server.userManager.findUser(username)
if user is not None:
if not user.is_active():
return make_response(("Your account is deactivated", 403, []))
if octoprint.server.userManager.checkPassword(username, password):
if octoprint.server.userManager.enabled:
user = octoprint.server.userManager.login_user(user)
@@ -120,8 +120,25 @@ $(function() {
history.replaceState({success: true}, document.title, window.location.pathname);
}
})
.fail(function() {
new PNotify({title: gettext("Login failed"), text: gettext("User unknown or wrong password"), type: "error"});
.fail(function(response) {
switch(response.status) {
case 401: {
new PNotify({
title: gettext("Login failed"),
text: gettext("User unknown or wrong password"),
type: "error"
});
break;
}
case 403: {
new PNotify({
title: gettext("Login failed"),
text: gettext("Your account is deactivated"),
type: "error"
});
break;
}
}
});
};