Skip to content

Commit

Permalink
only render "Other Log In Options" if there is more than one #3338
Browse files Browse the repository at this point in the history
  • Loading branch information
pdurbin committed Nov 29, 2016
1 parent 2e49d12 commit a405eb3
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 7 deletions.
6 changes: 1 addition & 5 deletions src/main/java/edu/harvard/iq/dataverse/LoginPage.java
Original file line number Diff line number Diff line change
Expand Up @@ -113,11 +113,7 @@ public void init() {
}
authProvider = authSvc.getAuthenticationProvider(provider);
}

public boolean isAuthenticationProvidersAvailable() {
return ! authSvc.getAuthenticationProviderIds().isEmpty();
}


public List<AuthenticationProviderDisplayInfo> listCredentialsAuthenticationProviders() {
List<AuthenticationProviderDisplayInfo> infos = new LinkedList<>();
for ( String id : authSvc.getAuthenticationProviderIdsOfType( CredentialsAuthenticationProvider.class ) ) {
Expand Down
4 changes: 2 additions & 2 deletions src/main/webapp/loginpage.xhtml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
<ui:param name="showMessagePanel" value="#{true}"/>
<ui:param name="loginRedirectPage" value="dataverse.xhtml"/>
<ui:define name="body">
<ui:fragment rendered="#{not LoginPage.authenticationProvidersAvailable}">
<ui:fragment rendered="#{LoginPage.listAuthenticationProviders().size() lt 1}">
<div class="row">
<div class="col-sm-12">
<div class="alert alert-danger">
Expand Down Expand Up @@ -198,7 +198,7 @@
</div>
</div>

<div id="otherProviders" jsf:rendered="#{LoginPage.authenticationProvidersAvailable}">
<div id="otherProviders" jsf:rendered="#{LoginPage.listAuthenticationProviders().size() > 1}">
<h4>#{bundle['auth.providers.title']}</h4>
<ui:repeat value="#{LoginPage.listAuthenticationProviders()}" var="provider">
<h:outputLink rendered="#{provider.id != LoginPage.authProvider.id}" styleClass="btn btn-default" value="/loginpage.xhtml?redirectPage=dataverseuser.xhtml&amp;provider=#{provider.id}">
Expand Down

0 comments on commit a405eb3

Please sign in to comment.