forked from privacyidea/keycloak-provider
-
Notifications
You must be signed in to change notification settings - Fork 0
/
privacyIDEA.ftl
84 lines (81 loc) · 5.31 KB
/
privacyIDEA.ftl
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
<#import "template.ftl" as layout>
<@layout.registrationLayout; section>
<#if section = "title">
${msg("loginTitle",realm.name)}
<#elseif section = "header">
${msg("loginTitleHtml",realm.name)}
<#elseif section = "form">
<form id="loginform" class="${properties.kcFormClass!}" action="${url.loginAction}" method="post">
<div class="${properties.kcFormGroupClass!}">
<div class="${properties.kcInputWrapperClass!}">
<#if tokenType = "push">
${pushMessage}
<#else>
${otpMessage}
</#if>
<#-- Show QR code for new token, if one has been enrolled -->
<#if tokenEnrollmentQR != "">
<div style="text-align: center;">
<img width="256" height="256" src="${tokenEnrollmentQR}">
</div>
Please scan the QR-Code with an authenticator app like "privacyIDEA Authenticator" or "Google Authenticator"
</#if>
<input id="pi_otp" name="pi_otp" type="hidden" class="${properties.kcInputClass!}" autofocus/>
</div>
</div>
<div class="${properties.kcFormGroupClass!}">
<div id="kc-form-options" class="${properties.kcFormOptionsClass!}">
<div class="${properties.kcFormOptionsWrapperClass!}"/>
</div>
<#--These inputs will be returned to privacyIDEAAuthenticator-->
<input id="tokenEnrollmentQR" name="tokenEnrollmentQR" value="${tokenEnrollmentQR}" type="hidden">
<input id="tokenType" name="tokenType" value="${tokenType}" type="hidden">
<input id="pushToken" name="pushToken" value="${pushToken?c}" type="hidden">
<input id="otpToken" name="otpToken" value="${otpToken?c}" type="hidden">
<input id="pushMessage" name="pushMessage" value="${pushMessage}" type="hidden">
<input id="otpMessage" name="otpMessage" value="${otpMessage}" type="hidden">
<input id="tokenTypeChanged" name="tokenTypeChanged" value="false" type="hidden">
<div id="kc-form-buttons" class="${properties.kcFormButtonsClass!}">
<div class="${properties.kcFormButtonsWrapperClass!}">
<#if tokenType = "push">
<#--The form will be reloaded if push token is enabled to check if it is confirmed.
The interval can be set in the configuration-->
<script>
window.onload = function () {
window.setTimeout(function () {
document.forms["loginform"].submit();
}, parseInt(${pushTokenInterval}) * 1000);
};
</script>
<#if otpToken>
<#--The token type can be changed if we can use push or otp-->
<input class="${properties.kcButtonClass!} ${properties.kcButtonDefaultClass!} ${properties.kcButtonLargeClass!}" name="changeTokenTypeButton" id="changeTokenTypeButton" onClick="changeTokenType('otp')" type="button" value="Use OTP"/>
</#if>
<#else>
<#--If token type is not push, an input field and login button is needed-->
<script>
document.getElementById("pi_otp").type = "password";
document.getElementById("pi_otp").required = true;
</script>
<input class="${properties.kcButtonClass!} ${properties.kcButtonPrimaryClass!} ${properties.kcButtonLargeClass!}" name="login" id="kc-login" type="submit" value="${msg("doLogIn")}"/>
<#if pushToken>
<#--The token type can be changed if we can use push or otp-->
<input class="${properties.kcButtonClass!} ${properties.kcButtonDefaultClass!} ${properties.kcButtonLargeClass!}" name="changeTokenTypeButton" id="changeTokenTypeButton" onClick="changeTokenType('push')" type="button" value="Use Push Token"/>
</#if>
</#if>
<#--If we change the token type, this information must be transmitted to privacyIDEAAuthenticator-->
<script>
function changeTokenType(tokenType) {
document.getElementById("tokenType").value = tokenType;
document.getElementById("tokenTypeChanged").value = "true";
document.forms["loginform"].submit();
}
</script>
<input class="${properties.kcButtonClass!} ${properties.kcButtonDefaultClass!} ${properties.kcButtonLargeClass!}"
name="cancel" id="kc-cancel" type="submit" value="${msg("doCancel")}"/>
</div>
</div>
</div>
</form>
</#if>
</@layout.registrationLayout>