-
Notifications
You must be signed in to change notification settings - Fork 15
/
login.ejs
48 lines (46 loc) · 1.59 KB
/
login.ejs
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
<html>
<head>
<style>
body {
font-family: Helvetica Neue,Helvetica,Arial,sans-serif;
}
</style>
<script src="<%= cdnUrl %>/js/okta-sign-in.min.js" type="text/javascript"></script>
<link href="<%= cdnUrl %>/css/okta-sign-in.min.css" type="text/css" rel="stylesheet"/>
<script src="https://code.jquery.com/jquery-3.2.1.min.js" integrity="sha256-hwg4gsxgFZhOsEEamdOYGBf13FyQuiTwlAQgxVSNgt4=" crossorigin="anonymous"></script>
</head>
<body>
<div id="banner"><center>Custom Login Page</center></div>
<div id="app-container"></div>
<script type="text/javascript">
console.log('<%= baseUrl %>');
const signIn = new OktaSignIn({
baseUrl: '<%= baseUrl %>', // e.g. https://dev-1234.oktapreview.com
language: '<%= language %>',
i18n: {
en: {
'primaryauth.title': 'Sign in to Acme',
},
fr: {
'primaryauth.title': 'Connectez-vous à Acme',
}
}
});
signIn.renderEl({ el: '#app-container' }, (res) => {
var form = $('<form>', {
method: 'POST',
action: '/login'
});
$(document.body).append(form);
var sessionTokenField = $('<input type="hidden" name="sessionToken"/>');
var csrfTokenField = $('<input type="hidden" name="_csrf" value="<%= csrfToken %>"/>');
sessionTokenField.val(res.session.token)
form.append(sessionTokenField);
form.append(csrfTokenField);
form.submit();
}, (err) => {
console.error(err);
});
</script>
</body>
</html>