1 | <%@ page |
---|
2 | pageEncoding="UTF-8" |
---|
3 | session="false" |
---|
4 | import="net.sf.basedb.core.SessionControl" |
---|
5 | import="net.sf.basedb.core.DbControl" |
---|
6 | import="net.sf.basedb.core.User" |
---|
7 | import="net.sf.basedb.util.extensions.Extension" |
---|
8 | import="net.sf.basedb.clients.web.Base" |
---|
9 | import="net.sf.basedb.clients.web.util.HTML" |
---|
10 | import="net.sf.basedb.clients.web.extensions.JspContext" |
---|
11 | %> |
---|
12 | <%@ taglib prefix="base" uri="/WEB-INF/base.tld" %> |
---|
13 | <% |
---|
14 | // Get the JspContext that was created on the main edit page |
---|
15 | final JspContext jspContext = (JspContext)request.getAttribute(JspContext.ATTRIBUTE_KEY); |
---|
16 | final Extension extension = (Extension)request.getAttribute(JspContext.EXTENSION_KEY); |
---|
17 | |
---|
18 | // The current item is found in the context. NOTE! Can be null if a new item |
---|
19 | final User user = (User)jspContext.getCurrentItem(); |
---|
20 | |
---|
21 | // Get the DbControl and SessionControl used to handle the request (do not close!) |
---|
22 | final DbControl dc = jspContext.getDbControl(); |
---|
23 | final SessionControl sc = dc.getSessionControl(); |
---|
24 | final String ID = sc.getId(); |
---|
25 | |
---|
26 | final String yubiKeyId = user == null ? null : (String)user.getExtended("yubiKeyId"); |
---|
27 | final String yubiKeySerial = user == null ? null : (String)user.getExtended("yubiKeySerial"); |
---|
28 | |
---|
29 | String HOME = jspContext.getHome(extension); |
---|
30 | %> |
---|
31 | <base:page type="include"> |
---|
32 | <base:body> |
---|
33 | <div id="yubikey-data" class="datacontainer" |
---|
34 | data-home="<%=HOME%>" |
---|
35 | ></div> |
---|
36 | <table class="fullform input100"> |
---|
37 | <tr> |
---|
38 | <th>Public ID</th> |
---|
39 | <td> |
---|
40 | <input type="hidden" name="ep.yubiKeyId" id="yubiKeyId" value="<%=HTML.encodeTags(yubiKeyId) %>"> |
---|
41 | <span id="yubiKeyId2"><%=yubiKeyId == null ? "<i>No YubiKey</i>" : HTML.encodeTags(yubiKeyId) %></span> |
---|
42 | </td> |
---|
43 | <td></td> |
---|
44 | </tr> |
---|
45 | <tr> |
---|
46 | <th>Serial #</th> |
---|
47 | <td> |
---|
48 | <input type="text" name="ep.yubiKeySerial" id="yubiKeySerial" |
---|
49 | value="<%=HTML.encodeTags(yubiKeySerial)%>" |
---|
50 | maxlength="32"> |
---|
51 | </td> |
---|
52 | <td></td> |
---|
53 | </tr> |
---|
54 | <tr class="dynamic"> |
---|
55 | <th>YubiKey</th> |
---|
56 | <td> |
---|
57 | <div style="padding: 1em;"> |
---|
58 | <div id="no-yubikey" style="<%=yubiKeyId == null ? "" : "display: none;"%>"> |
---|
59 | <div class="messagecontainer note" style="margin: 0;"> |
---|
60 | This user is currently not configured to login with YubiKey. |
---|
61 | Assign a YubiKey to this user by inserting a one-time-password |
---|
62 | in the field below. Press <b>ENTER</b> to verify. |
---|
63 | </div> |
---|
64 | |
---|
65 | <div style="margin-top: 1em;"> |
---|
66 | <b>YubiKey one-time-password</b><br> |
---|
67 | <input type="text" name="yubiKeyOtp" id="yubiKeyOtp" autocomplete="off"> |
---|
68 | </div> |
---|
69 | |
---|
70 | <div id="yubikey-verifying" |
---|
71 | style="display: none; font-style: italic; margin-top: 1em;"> |
---|
72 | Verifying YubiKey. Please wait... |
---|
73 | </div> |
---|
74 | |
---|
75 | <div id="yubikey-error" class="messagecontainer error" |
---|
76 | style="display: none; margin: 0; margin-top: 1em;"> |
---|
77 | </div> |
---|
78 | |
---|
79 | </div> |
---|
80 | |
---|
81 | <div id="has-yubikey" style="<%=yubiKeyId == null ? "display: none;" : ""%>"> |
---|
82 | <div class="messagecontainer note" style="margin: 0;"> |
---|
83 | This user is currently configured to login with YubiKey. |
---|
84 | Click <b>Remove</b> to remove the YubiKey from this user. |
---|
85 | </div> |
---|
86 | |
---|
87 | <base:buttongroup style="margin-top: 1em;"> |
---|
88 | <base:button id="btnYubiKeyRemove" title="Remove" /> |
---|
89 | </base:buttongroup> |
---|
90 | </div> |
---|
91 | </div> |
---|
92 | |
---|
93 | </td> |
---|
94 | <td></td> |
---|
95 | </tr> |
---|
96 | </table> |
---|
97 | </base:body> |
---|
98 | </base:page> |
---|
99 | |
---|