diff --git a/rhodecode/controllers/login.py b/rhodecode/controllers/login.py --- a/rhodecode/controllers/login.py +++ b/rhodecode/controllers/login.py @@ -37,6 +37,7 @@ from pylons import request, response, se import rhodecode.lib.helpers as h from rhodecode.lib.auth import AuthUser, HasPermissionAnyDecorator from rhodecode.lib.base import BaseController, render +from rhodecode.lib.exceptions import UserCreationError from rhodecode.model.db import User from rhodecode.model.forms import LoginForm, RegisterForm, PasswordResetForm from rhodecode.model.user import UserModel @@ -120,6 +121,12 @@ class LoginController(BaseController): errors=errors.error_dict or {}, prefix_error=False, encoding="UTF-8") + except UserCreationError, e: + # container auth or other auth functions that create users on + # the fly can throw this exception signaling that there's issue + # with user creation, explanation should be provided in + # Exception itself + h.flash(e, 'error') return render('/login.html') @@ -147,6 +154,12 @@ class LoginController(BaseController): errors=errors.error_dict or {}, prefix_error=False, encoding="UTF-8") + except UserCreationError, e: + # container auth or other auth functions that create users on + # the fly can throw this exception signaling that there's issue + # with user creation, explanation should be provided in + # Exception itself + h.flash(e, 'error') return render('/register.html')