auth: UI changes

- make buttons wider to handle longer names for SAML plugins
- make order of plugins sorted again because it tends to jump arround in order
  without that sorting.
- social is now external auth
This commit is contained in:
Marcin Kuzminski 2018-11-29 18:15:55 +01:00
parent 739fc96fe7
commit 4dc9d4463e
6 changed files with 13 additions and 11 deletions

View file

@ -88,15 +88,15 @@ class AuthnRootResource(AuthnResourceBase):
# TODO: Store this info in the resource element.
return self._resource_name_map[resource_name]
def get_sorted_list(self):
def get_sorted_list(self, sort_key=None):
"""
Returns a sorted list of sub resources for displaying purposes.
"""
def sort_key(resource):
def default_sort_key(resource):
return str.lower(safe_str(resource.display_name))
active = [item for item in self]
return sorted(active, key=sort_key)
return sorted(active, key=sort_key or default_sort_key)
def get_nav_list(self, sort=True):
"""

View file

@ -254,7 +254,7 @@ input[type="button"] {
.btn-social {
&:extend(.btn-default);
margin: 5px 5px 5px 0px;
min-width: 150px;
min-width: 160px;
}
// TODO: johbo: check these exceptions

View file

@ -29,7 +29,7 @@
<div class="sidebar">
<ul class="nav nav-pills nav-stacked">
% for item in resource.get_root().get_nav_list(sort=False):
% for item in resource.get_root().get_nav_list():
<li ${'class=active' if item == resource else ''}>
<a href="${request.resource_path(item, route_name='auth_home')}">${item.display_name}</a>
</li>

View file

@ -32,8 +32,8 @@
<div id="register" class="right-column">
<!-- login -->
<div class="sign-in-title">
% if social_auth_provider:
<h1>${_('Create an account linked with {}').format(social_auth_provider)}</h1>
% if external_auth_provider:
<h1>${_('Create an account linked with {}').format(external_auth_provider)}</h1>
% else:
<h1>${_('Create an account')}</h1>
% endif
@ -50,7 +50,9 @@
<br />
%endif
% if social_auth_provider:
% if external_auth_provider:
## store internal marker about external identity
${h.hidden('external_identity', external_auth_provider)}
## hide password prompts for social auth
<div style="display: none">
% endif
@ -69,7 +71,7 @@
<br />
%endif
% if social_auth_provider:
% if external_auth_provider:
## hide password prompts for social auth
</div>
% endif

View file

@ -45,7 +45,7 @@ class RhodeCodeAuthPlugin(RhodeCodeExternalAuthPlugin):
@hybrid_property
def name(self):
return "external_test"
return u"external_test"
def settings(self):
settings = [

View file

@ -30,7 +30,7 @@ from rhodecode.model import db
class RcTestAuthPlugin(RhodeCodeAuthPluginBase):
def name(self):
return 'stub_auth'
return u'stub_auth'
def test_authenticate_returns_from_auth(stub_auth_data):