4922 |
10 Aug 18 |
nicklas |
1 |
<%@ page |
4922 |
10 Aug 18 |
nicklas |
2 |
pageEncoding="UTF-8" |
4922 |
10 Aug 18 |
nicklas |
3 |
session="false" |
4922 |
10 Aug 18 |
nicklas |
4 |
import="net.sf.basedb.core.SessionControl" |
4922 |
10 Aug 18 |
nicklas |
5 |
import="net.sf.basedb.core.DbControl" |
4922 |
10 Aug 18 |
nicklas |
6 |
import="net.sf.basedb.core.User" |
4922 |
10 Aug 18 |
nicklas |
7 |
import="net.sf.basedb.clients.web.Base" |
4922 |
10 Aug 18 |
nicklas |
8 |
import="net.sf.basedb.clients.web.util.HTML" |
4922 |
10 Aug 18 |
nicklas |
9 |
import="net.sf.basedb.clients.web.extensions.JspContext" |
4922 |
10 Aug 18 |
nicklas |
10 |
%> |
4922 |
10 Aug 18 |
nicklas |
11 |
<%@ taglib prefix="base" uri="/WEB-INF/base.tld" %> |
4922 |
10 Aug 18 |
nicklas |
12 |
<% |
4922 |
10 Aug 18 |
nicklas |
13 |
// Get the JspContext that was created on the main edit page |
4922 |
10 Aug 18 |
nicklas |
14 |
final JspContext jspContext = (JspContext)request.getAttribute(JspContext.ATTRIBUTE_KEY); |
4922 |
10 Aug 18 |
nicklas |
15 |
|
4922 |
10 Aug 18 |
nicklas |
16 |
// The current item is found in the context. NOTE! Can be null if a new item |
4922 |
10 Aug 18 |
nicklas |
17 |
final User user = (User)jspContext.getCurrentItem(); |
4922 |
10 Aug 18 |
nicklas |
18 |
|
4922 |
10 Aug 18 |
nicklas |
19 |
// Get the DbControl and SessionControl used to handle the request (do not close!) |
4922 |
10 Aug 18 |
nicklas |
20 |
final DbControl dc = jspContext.getDbControl(); |
4922 |
10 Aug 18 |
nicklas |
21 |
final SessionControl sc = dc.getSessionControl(); |
4922 |
10 Aug 18 |
nicklas |
22 |
final String ID = sc.getId(); |
4922 |
10 Aug 18 |
nicklas |
23 |
|
4922 |
10 Aug 18 |
nicklas |
24 |
final boolean hasOtp = user != null && user.getExtended("otpSecretKey") != null; |
4922 |
10 Aug 18 |
nicklas |
25 |
final boolean requireOtp = hasOtp || (user != null && Boolean.TRUE.equals(user.getExtended("otpIsRequired"))); |
4922 |
10 Aug 18 |
nicklas |
26 |
%> |
4922 |
10 Aug 18 |
nicklas |
27 |
<base:page type="include"> |
4922 |
10 Aug 18 |
nicklas |
28 |
<base:body> |
4922 |
10 Aug 18 |
nicklas |
29 |
<table class="fullform input100"> |
4922 |
10 Aug 18 |
nicklas |
30 |
<tr> |
4922 |
10 Aug 18 |
nicklas |
31 |
<th>Login</th> |
4922 |
10 Aug 18 |
nicklas |
32 |
<td> |
4922 |
10 Aug 18 |
nicklas |
33 |
<%=hasOtp ? "OTP" : "Password" %> |
4922 |
10 Aug 18 |
nicklas |
34 |
</td> |
4922 |
10 Aug 18 |
nicklas |
35 |
</tr> |
4922 |
10 Aug 18 |
nicklas |
36 |
<tr id="require-otp-row" style="<%=hasOtp ? "display: none;" : ""%>"> |
4922 |
10 Aug 18 |
nicklas |
37 |
<th>Require OTP</th> |
4922 |
10 Aug 18 |
nicklas |
38 |
<td> |
4922 |
10 Aug 18 |
nicklas |
39 |
<input type="hidden" name="ep.otpIsRequired" value="<%=requireOtp%>" id="otpIsRequired"> |
4922 |
10 Aug 18 |
nicklas |
40 |
<label><input type="radio" name="requireOtp" id="requireOtp.true" value="true" <%=requireOtp ? "checked" :"" %>>Yes</label> |
4922 |
10 Aug 18 |
nicklas |
41 |
<label><input type="radio" name="requireOtp" id="requireOtp.false" value="false" <%=requireOtp ? "" : "checked" %>>No</label> |
4922 |
10 Aug 18 |
nicklas |
42 |
</td> |
4922 |
10 Aug 18 |
nicklas |
43 |
</tr> |
4922 |
10 Aug 18 |
nicklas |
44 |
<tr class="dynamic"> |
4922 |
10 Aug 18 |
nicklas |
45 |
<th></th> |
4922 |
10 Aug 18 |
nicklas |
46 |
<td> |
4922 |
10 Aug 18 |
nicklas |
47 |
<div style="padding: 0.5em;"> |
4922 |
10 Aug 18 |
nicklas |
48 |
<div id="no-otp" style="<%=hasOtp ? "display: none;" : ""%>"> |
4922 |
10 Aug 18 |
nicklas |
49 |
<div class="messagecontainer note" style="margin: 0; padding: 0.5em;"> |
4922 |
10 Aug 18 |
nicklas |
50 |
This user has not configured OTP login. You can force the user |
4922 |
10 Aug 18 |
nicklas |
51 |
to setup OTP by enabling the option above. |
4922 |
10 Aug 18 |
nicklas |
52 |
<p style="margin-top: 1em;"> |
4922 |
10 Aug 18 |
nicklas |
53 |
Note that it is not possible for an administrator to configure OTP |
4922 |
10 Aug 18 |
nicklas |
54 |
for other users. |
4922 |
10 Aug 18 |
nicklas |
55 |
</p> |
4922 |
10 Aug 18 |
nicklas |
56 |
</div> |
4922 |
10 Aug 18 |
nicklas |
57 |
</div> |
4922 |
10 Aug 18 |
nicklas |
58 |
<div id="has-otp" style="<%=hasOtp ? "": "display: none;"%>"> |
4922 |
10 Aug 18 |
nicklas |
59 |
<div class="messagecontainer note" style="margin: 0; padding: 0.5em;"> |
4922 |
10 Aug 18 |
nicklas |
60 |
This user is currently configured to login with OTP.<br> |
4922 |
10 Aug 18 |
nicklas |
61 |
Click <b>Reset</b> to remove the OTP configuration.<br> |
4922 |
10 Aug 18 |
nicklas |
62 |
</div> |
4922 |
10 Aug 18 |
nicklas |
63 |
|
4922 |
10 Aug 18 |
nicklas |
64 |
<base:buttongroup style="margin-top: 1em;"> |
4922 |
10 Aug 18 |
nicklas |
65 |
<base:button id="btnOtpReset" title="Reset" image="remove.png" /> |
4922 |
10 Aug 18 |
nicklas |
66 |
</base:buttongroup> |
4922 |
10 Aug 18 |
nicklas |
67 |
</div> |
4922 |
10 Aug 18 |
nicklas |
68 |
|
4922 |
10 Aug 18 |
nicklas |
69 |
<div id="otp-was-reset" style="display: none;"> |
4922 |
10 Aug 18 |
nicklas |
70 |
<div class="messagecontainer note" style="margin: 0; padding: 0.5em;"> |
4922 |
10 Aug 18 |
nicklas |
71 |
The OTP configuration will be removed when you <b>Save</b> this dialog.<br> |
4922 |
10 Aug 18 |
nicklas |
72 |
You can force the user to re-configure OTP by enabling |
4922 |
10 Aug 18 |
nicklas |
73 |
the option above. |
4922 |
10 Aug 18 |
nicklas |
74 |
<p style="margin-top: 1em;"> |
4922 |
10 Aug 18 |
nicklas |
75 |
Note that it is not possible for an administrator to configure OTP |
4922 |
10 Aug 18 |
nicklas |
76 |
for other users. |
4922 |
10 Aug 18 |
nicklas |
77 |
</p> |
4922 |
10 Aug 18 |
nicklas |
78 |
</div> |
4922 |
10 Aug 18 |
nicklas |
79 |
</div> |
4922 |
10 Aug 18 |
nicklas |
80 |
</div> |
4922 |
10 Aug 18 |
nicklas |
81 |
</td> |
4922 |
10 Aug 18 |
nicklas |
82 |
</tr> |
4922 |
10 Aug 18 |
nicklas |
83 |
</table> |
4922 |
10 Aug 18 |
nicklas |
84 |
</base:body> |
4922 |
10 Aug 18 |
nicklas |
85 |
</base:page> |
4922 |
10 Aug 18 |
nicklas |
86 |
|