KEYCLOAK-211 Enable social only login
This commit is contained in:
parent
84396d0da1
commit
8fa3425886
2 changed files with 66 additions and 45 deletions
|
@ -5,6 +5,7 @@
|
|||
<#elseif section = "header">
|
||||
${rb.loginTitle} <strong>${(realm.name)!''}</strong>
|
||||
<#elseif section = "form">
|
||||
<#if realm.password>
|
||||
<form id="kc-form-login" class="${properties.kcFormClass!}" action="${url.loginAction}" method="post">
|
||||
<div class="${properties.kcFormGroupClass!}">
|
||||
<div class="${properties.kcLabelWrapperClass!}">
|
||||
|
@ -50,14 +51,23 @@
|
|||
</div>
|
||||
</div>
|
||||
</form>
|
||||
<#elseif realm.social>
|
||||
<div id="kc-social-providers">
|
||||
<ul>
|
||||
<#list social.providers as p>
|
||||
<li><a href="${p.loginUrl}" class="zocial ${p.id}"> <span class="text">${p.name}</span></a></li>
|
||||
</#list>
|
||||
</ul>
|
||||
</div>
|
||||
</#if>
|
||||
<#elseif section = "info" >
|
||||
<#if realm.registrationAllowed>
|
||||
<#if realm.password && realm.registrationAllowed>
|
||||
<div id="kc-registration">
|
||||
<span>${rb.noAccount} <a href="${url.registrationUrl}">${rb.register}</a></span>
|
||||
</div>
|
||||
</#if>
|
||||
|
||||
<#if social.providers??>
|
||||
<#if realm.password && social.providers??>
|
||||
<div id="kc-social-providers">
|
||||
<ul>
|
||||
<#list social.providers as p>
|
||||
|
|
|
@ -22,6 +22,8 @@
|
|||
package org.keycloak.login.freemarker.model;
|
||||
|
||||
import org.keycloak.models.RealmModel;
|
||||
import org.keycloak.models.RequiredCredentialModel;
|
||||
import org.keycloak.representations.idm.CredentialRepresentation;
|
||||
|
||||
/**
|
||||
* @author <a href="mailto:sthorger@redhat.com">Stian Thorgersen</a>
|
||||
|
@ -54,4 +56,13 @@ public class RealmBean {
|
|||
return realm.isRememberMe();
|
||||
}
|
||||
|
||||
public boolean isPassword() {
|
||||
for (RequiredCredentialModel r : realm.getRequiredCredentials()) {
|
||||
if (r.getType().equals(CredentialRepresentation.PASSWORD)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue