diff --git a/rhodecode/apps/login/tests/test_password_reset.py b/rhodecode/apps/login/tests/test_password_reset.py --- a/rhodecode/apps/login/tests/test_password_reset.py +++ b/rhodecode/apps/login/tests/test_password_reset.py @@ -74,20 +74,17 @@ class TestPasswordReset(TestController): 'default_password_reset': pwd_reset_setting, 'default_extern_activate': 'hg.extern_activate.auto', } - resp = self.app.post(route_path('admin_permissions_application_update'), params=params) + resp = self.app.post( + route_path('admin_permissions_application_update'), params=params) self.logout_user() login_page = self.app.get(route_path('login')) asr_login = AssertResponse(login_page) - index_page = self.app.get(h.route_path('home')) - asr_index = AssertResponse(index_page) if show_link: asr_login.one_element_exists('a.pwd_reset') - asr_index.one_element_exists('a.pwd_reset') else: asr_login.no_element_exists('a.pwd_reset') - asr_index.no_element_exists('a.pwd_reset') response = self.app.get(route_path('reset_password')) diff --git a/rhodecode/authentication/plugins/auth_rhodecode.py b/rhodecode/authentication/plugins/auth_rhodecode.py --- a/rhodecode/authentication/plugins/auth_rhodecode.py +++ b/rhodecode/authentication/plugins/auth_rhodecode.py @@ -24,6 +24,9 @@ RhodeCode authentication plugin for buil import logging +import colander + +from rhodecode.authentication.schema import AuthnPluginSettingsSchemaBase from rhodecode.translation import _ from rhodecode.authentication.base import RhodeCodeAuthPluginBase, hybrid_property @@ -43,6 +46,18 @@ class RhodecodeAuthnResource(AuthnPlugin pass +class RhodeCodeSettingsSchema(AuthnPluginSettingsSchemaBase): + + superadmin_restriction = colander.SchemaNode( + colander.Bool(), + default=False, + description=_('Only allow super-admins to log-in using this plugin.'), + missing=False, + title=_('Enabled'), + widget='bool', + ) + + class RhodeCodeAuthPlugin(RhodeCodeAuthPluginBase): uid = 'rhodecode' @@ -64,6 +79,9 @@ class RhodeCodeAuthPlugin(RhodeCodeAuthP route_name='auth_home', context=RhodecodeAuthnResource) + def get_settings_schema(self): + return RhodeCodeSettingsSchema() + def get_display_name(self): return _('RhodeCode Internal') diff --git a/rhodecode/lib/helpers.py b/rhodecode/lib/helpers.py --- a/rhodecode/lib/helpers.py +++ b/rhodecode/lib/helpers.py @@ -650,10 +650,9 @@ flash = Flash() # SCM FILTERS available via h. #============================================================================== from rhodecode.lib.vcs.utils import author_name, author_email -from rhodecode.lib.utils2 import credentials_filter, age as _age +from rhodecode.lib.utils2 import credentials_filter, age, age_from_seconds from rhodecode.model.db import User, ChangesetStatus -age = _age capitalize = lambda x: x.capitalize() email = author_email short_id = lambda x: x[:12] diff --git a/rhodecode/lib/utils2.py b/rhodecode/lib/utils2.py --- a/rhodecode/lib/utils2.py +++ b/rhodecode/lib/utils2.py @@ -564,6 +564,12 @@ def age(prevdate, now=None, show_short_v return _(u'just now') +def age_from_seconds(seconds): + seconds = safe_int(seconds) or 0 + prevdate = time_to_datetime(time.time() + seconds) + return age(prevdate, show_suffix=False, show_short_version=True) + + def cleaned_uri(uri): """ Quotes '[' and ']' from uri if there is only one of them. diff --git a/rhodecode/public/css/login.less b/rhodecode/public/css/login.less --- a/rhodecode/public/css/login.less +++ b/rhodecode/public/css/login.less @@ -73,9 +73,6 @@ } .sign-in-title { - h1 { - margin: 0; - } h4 { margin: @padding*2 0; diff --git a/rhodecode/templates/base/base.mako b/rhodecode/templates/base/base.mako --- a/rhodecode/templates/base/base.mako +++ b/rhodecode/templates/base/base.mako @@ -299,87 +299,54 @@ <%def name="usermenu(active=False)"> ## USER MENU