/
EnableAuthenticator.cshtml
89 lines (80 loc) · 3.59 KB
/
EnableAuthenticator.cshtml
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
85
86
87
88
@using Safewhere.Web.Mvc
@using System.Web.Mvc.Html
@using Safewhere.IdentityProvider.Otp
@using Safewhere.IdentityProvider.Otp.Authenticator
@using Safewhere.IdentityProvider.RuntimeModel
@model EnableAuthenticatorViewModel
@section TitleHeader{
@*Login Page*@
@Resources.OtpResources.OtpAuthenticationView_TitleHeader
}
@section InitScript{
<script src="~/Scripts/jquery.qrcode.js"></script>
<script src="~/Scripts/qrcode.js"></script>
}
@section MainContent{
<div class="form-box" style="max-width: 560px">
<div class="form-top">
<div class="form-top-left text-left">
<h4>
@Resources.OtpResources.EnableAuthenticator_UseAuthenticatorAppFollowingSteps
</h4>
</div>
</div>
<div class="form-bottom">
@if (!string.IsNullOrEmpty(Model.ErrorMessage))
{
<div class="form-group" style="text-align:center">
<span for="errorMessageLb" class="text-danger">
@Model.ErrorMessage
</span>
</div>
}
<ol class="list" style="padding-right: 28px">
<li>
<p>
@Html.Raw(string.Format(Resources.OtpResources.EnableAuthenticator_ScanQRCodeOrEnterKeyHelpText, "<kbd>" + HttpUtility.HtmlEncode(@Model.SharedKey) + "</kbd>"))
</p>
<div class="form-group text-center unset-margin-bottom">
<div id="qrCodeOfWithoutWizard" style="display: inline-block; margin-top: 10px" class="text-center"></div>
<div id="qrCodeData" data-url="@Model.AuthenticatorUri"></div>
</div>
</li>
<li>
<p>
@Resources.OtpResources.EnableAuthenticator_ScannedTheQACodeHelpText
</p>
</li>
</ol>
@{
var showOnboardAnotherMethods = Model.OnboardAnotherMethods != null && Model.OnboardAnotherMethods.Count > 0;
var style = showOnboardAnotherMethods ? "padding: 0px 25px" : "";
}
<form method="post" action="/runtime/otpauth/twofactor/validate?ici_ci=@Model.ContextId" style="@style">
@Safewhere.Web.Mvc.Security.HtmlHelper.AntiForgeryToken()
<div class="form-group">
<input type="text" name="password" autocomplete="off" class="form-password form-control required" id="form-password">
</div>
<button type="submit" class="btn btn-default">@Resources.OtpResources.EnableAuthenticator_VerifyText</button>
@Html.Partial("RenderFormParameters", new RenderFormParametersModel(Model.ContextId))
<script type="text/javascript">
jQuery('#qrCodeOfWithoutWizard').qrcode({
text: "@Html.Raw(Model.AuthenticatorUri)",
width: 200,
height: 200
});
</script>
</form>
@if (showOnboardAnotherMethods)
{
<hr/>
var chooseAnotherOtpMethodViewModel = new ChooseAnotherOtpMethodViewModel
{
OnboardingOtpTypes = Model.OnboardAnotherMethods,
ContextId = Model.ContextId
};
@Html.Partial("OnboardAnotherOtpMethods", chooseAnotherOtpMethodViewModel)
}
</div>
</div>
}