Skip to content

Commit 90a1568

Browse files
committed
Improve built in idp-disco
- Fix not working rememberchecked config option - Tweak layout a bit - Improve display when there are no IdPs configured/found
1 parent b511c70 commit 90a1568

4 files changed

Lines changed: 68 additions & 15 deletions

File tree

lib/SimpleSAML/XHTML/IdPDisco.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -637,6 +637,7 @@ function (array $idpentry1, array $idpentry2) {
637637
$t->data['entityID'] = $this->spEntityId;
638638
$t->data['urlpattern'] = htmlspecialchars($httpUtils->getSelfURLNoQuery());
639639
$t->data['rememberenabled'] = $this->config->getBoolean('idpdisco.enableremember', false);
640+
$t->data['rememberchecked'] = $this->config->getBoolean('idpdisco.rememberchecked', false);
640641
$t->send();
641642
}
642643

src/css/default.scss

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -601,6 +601,13 @@ input[type="file"] {
601601
border-radius: 0;
602602
}
603603

604+
.pure-button {
605+
margin-left: 1ex;
606+
}
607+
608+
.pure-control-group {
609+
margin-bottom: 1ex;
610+
}
604611
.pure-form-aligned .pure-controls {
605612
margin: 0 0 0 11em;
606613
}
@@ -886,3 +893,18 @@ div.preferredidp {
886893
.hidden {
887894
display: none;
888895
}
896+
897+
.idp {
898+
border: 1px solid silver;
899+
padding: 1ex;
900+
margin: 1ex;
901+
}
902+
903+
.idp .idpname {
904+
font-size: larger;
905+
font-weight: bold;
906+
}
907+
.idp .idpdesc {
908+
font-size: small;
909+
color: gray;
910+
}

templates/selectidp-dropdown.twig

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,10 @@
44
{% block content %}
55
<h2>{{ pagetitle }}</h2>
66

7+
{% if idplist|length == 0 %}
8+
<div class="message-box message-box-error">{{ "No identity providers found. Cannot continue." | trans }}</div>
9+
{% else %}
10+
711
<p>{{ "Please select the identity provider where you want to authenticate:" | trans }}</p>
812
<form method="get" action="{{ urlpattern }}" class="pure-form">
913
<input type="hidden" name="entityID" value="{{ entityID }}">
@@ -23,9 +27,12 @@
2327
</div>
2428
{% if rememberenabled %}
2529
<div class="pure-control-group">
26-
<input type="checkbox" name="remember" id="remember" value="1">
27-
<label for="remember">{{ 'Remember my choice' | trans }}</label>
30+
<label for="remember">
31+
<input type="checkbox" name="remember" id="remember" value="1"{% if rememberchecked %} checked{% endif %}>
32+
{{ 'Remember my choice' | trans }}
33+
</label>
2834
</div>
2935
{% endif %}
3036
</form>
37+
{% endif %}
3138
{% endblock %}

templates/selectidp-links.twig

Lines changed: 36 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -4,42 +4,65 @@
44
{% block content %}
55
<h2>{{ pagetitle }}</h2>
66

7+
{% if idplist|length == 0 %}
8+
<div class="message-box message-box-error">{{ "No identity providers found. Cannot continue." | trans }}</div>
9+
{% else %}
10+
711
<p>{{ "Please select the identity provider where you want to authenticate:" | trans }}</p>
812
<form method="get" action="{{ urlpattern }}">
913
<input type="hidden" name="entityID" value="{{ entityID }}">
1014
<input type="hidden" name="return" value="{{ return }}">
1115
<input type="hidden" name="returnIDParam" value="{{ returnIDParam }}">
1216
{% if rememberenabled %}
13-
<p><input type="checkbox" name="remember" id="remember" value="1">
14-
<label for="remember">{{ 'Remember my choice' | trans }}</label></p>
17+
<div class="pure-control-group">
18+
<label for="remember">
19+
<input type="checkbox" name="remember" id="remember" value="1"{% if rememberchecked %} checked{% endif %}>
20+
{{ 'Remember my choice' | trans }}
21+
</label>
22+
</div>
1523
{% endif %}
1624

1725
{% for idpentry in idplist %}
1826
{% if idpentry.entityid == preferredidp %}
19-
<div class="preferredidp">
27+
<div class="idp preferredidp pure-g">
28+
<div class="pure-u-1-8">
29+
<button type="submit" class="pure-button pure-button-primary" name="idp_{{ idpentry.entityid }}">{{'Select'|trans}}</button>
30+
</div>
2031
{% if idpentry.iconurl is defined %}
21-
<img class="float-l" src="{{ idpentry.iconurl }}">
32+
<div class="pure-u-1-8">
33+
<img src="{{ idpentry.iconurl }}" alt="">
34+
</div>
2235
{% endif %}
23-
<h3><i class="fa fa-star"></i> {{ idpentry.name }}</h3>
24-
{% if idpentry.description is defined %}
25-
<p>{{ idpentry.description }}</p>
36+
<div class="pure-u-7-8">
37+
<span class="idpname"><i class="fa fa-star"></i> {{ idpentry.name }}</span>
38+
{% if idpentry.description is defined and idpentry.description != idpentry.name %}
39+
<br><span class="idpdesc">{{ idpentry.description }}</span>
2640
{% endif %}
27-
<button type="submit" class="btn" name="idp_{{ idpentry.entityid }}">{{'Select'|trans}}</button>
41+
</div>
2842
</div>
2943
{% endif %}
3044
{% endfor %}
3145

3246
{% for idpentry in idplist %}
3347
{% if idpentry.entityid != preferredidp %}
48+
<div class="idp pure-g">
49+
<div class="pure-u-1-8">
50+
<button type="submit" class="pure-button" name="idp_{{ idpentry.entityid }}">{{'Select'|trans}}</button>
51+
</div>
3452
{% if idpentry.iconurl is defined %}
35-
<img class="float-l" src="{{ idpentry.iconurl }}">
53+
<div class="pure-u-1-8">
54+
<img src="{{ idpentry.iconurl }}" alt="">
55+
</div>
3656
{% endif %}
37-
<h3>{{ idpentry.name }}</h3>
38-
{% if idpentry.description is defined %}
39-
<p>{{ idpentry.description }}</p>
57+
<div class="pure-u-7-8">
58+
<span class="idpname">{{ idpentry.name }}</span>
59+
{% if idpentry.description is defined and idpentry.description != idpentry.name %}
60+
<br><span class="idpdesc">{{ idpentry.description }}</span>
4061
{% endif %}
41-
<button type="submit" class="btn" name="idp_{{ idpentry.entityid }}">{{'Select'|trans}}</button>
62+
</div>
63+
</div>
4264
{% endif %}
4365
{% endfor %}
4466
</form>
67+
{% endif %}
4568
{% endblock %}

0 commit comments

Comments
 (0)