-
-
-
-
-
+
@ViewData["Title"]
+@Html.Partial("_StatusMessage", Model.StatusMessage)
+
@section Scripts {
- @{ await Html.RenderPartialAsync("_ValidationScriptsPartial"); }
+ @await Html.PartialAsync("_ValidationScriptsPartial")
}
diff --git a/Sample/Views/Manage/Disable2fa.cshtml b/Sample/Views/Manage/Disable2fa.cshtml
new file mode 100644
index 0000000..cdd79cb
--- /dev/null
+++ b/Sample/Views/Manage/Disable2fa.cshtml
@@ -0,0 +1,24 @@
+@{
+ ViewData["Title"] = "Disable two-factor authentication (2FA)";
+ ViewData.AddActivePage(ManageNavPages.TwoFactorAuthentication);
+}
+
+
@ViewData["Title"]
+
+
+
+
+ This action only disables 2FA.
+
+
+ Disabling 2FA does not change the keys used in authenticator apps. If you wish to change the key
+ used in an authenticator app you should reset your
+ authenticator keys.
+
+
+
+
+
+
diff --git a/Sample/Views/Manage/EnableAuthenticator.cshtml b/Sample/Views/Manage/EnableAuthenticator.cshtml
new file mode 100644
index 0000000..79693d7
--- /dev/null
+++ b/Sample/Views/Manage/EnableAuthenticator.cshtml
@@ -0,0 +1,52 @@
+@model EnableAuthenticatorViewModel
+@{
+ ViewData["Title"] = "Enable authenticator";
+ ViewData.AddActivePage(ManageNavPages.TwoFactorAuthentication);
+}
+
+
@ViewData["Title"]
+
+
To use an authenticator app go through the following steps:
+
+ -
+
+ Download a two-factor authenticator app like Microsoft Authenticator for
+ Windows Phone,
+ Android and
+ iOS or
+ Google Authenticator for
+ Android and
+ iOS.
+
+
+ -
+
Scan the QR Code or enter this key @Model.SharedKey into your two factor authenticator app. Spaces and casing do not matter.
+
+
+
+
+ -
+
+ Once you have scanned the QR code or input the key above, your two factor authentication app will provide you
+ with a unique code. Enter the code in the confirmation box below.
+
+
+
+
+
+
+@section Scripts {
+ @await Html.PartialAsync("_ValidationScriptsPartial")
+}
diff --git a/Sample/Views/Manage/ExternalLogins.cshtml b/Sample/Views/Manage/ExternalLogins.cshtml
new file mode 100644
index 0000000..e6f5687
--- /dev/null
+++ b/Sample/Views/Manage/ExternalLogins.cshtml
@@ -0,0 +1,52 @@
+@model ExternalLoginsViewModel
+@{
+ ViewData["Title"] = "Manage your external logins";
+ ViewData.AddActivePage(ManageNavPages.ExternalLogins);
+}
+
+@Html.Partial("_StatusMessage", Model.StatusMessage)
+@if (Model.CurrentLogins?.Count > 0)
+{
+
Registered Logins
+
+
+ @foreach (var login in Model.CurrentLogins)
+ {
+
+ | @login.LoginProvider |
+
+ @if (Model.ShowRemoveButton)
+ {
+
+ }
+ else
+ {
+ @:
+ }
+ |
+
+ }
+
+
+}
+@if (Model.OtherLogins?.Count > 0)
+{
+
Add another service to log in.
+
+
+}
diff --git a/Sample/Views/Manage/GenerateRecoveryCodes.cshtml b/Sample/Views/Manage/GenerateRecoveryCodes.cshtml
new file mode 100644
index 0000000..669d13e
--- /dev/null
+++ b/Sample/Views/Manage/GenerateRecoveryCodes.cshtml
@@ -0,0 +1,24 @@
+@model GenerateRecoveryCodesViewModel
+@{
+ ViewData["Title"] = "Recovery codes";
+ ViewData.AddActivePage(ManageNavPages.TwoFactorAuthentication);
+}
+
+
@ViewData["Title"]
+
+
+
+ Put these codes in a safe place.
+
+
+ If you lose your device and don't have the recovery codes you will lose access to your account.
+
+
+
+
+ @for (var row = 0; row < Model.RecoveryCodes.Count(); row += 2)
+ {
+ @Model.RecoveryCodes[row] @Model.RecoveryCodes[row + 1]
+ }
+
+
\ No newline at end of file
diff --git a/Sample/Views/Manage/Index.cshtml b/Sample/Views/Manage/Index.cshtml
index 4f49441..c141c95 100644
--- a/Sample/Views/Manage/Index.cshtml
+++ b/Sample/Views/Manage/Index.cshtml
@@ -1,71 +1,45 @@
@model IndexViewModel
@{
- ViewData["Title"] = "Manage your account";
+ ViewData["Title"] = "Profile";
+ ViewData.AddActivePage(ManageNavPages.Index);
}
-
@ViewData["Title"].
-
@ViewData["StatusMessage"]
-
-
-
Change your account settings
-
-
- - Password:
- -
- @if (Model.HasPassword)
- {
- Change
- }
- else
- {
- Create
- }
-
- - External Logins:
- -
-
- @Model.Logins.Count Manage
-
- - Phone Number:
- -
-
- Phone Numbers can be used as a second factor of verification in two-factor authentication.
- See this article
- for details on setting up this ASP.NET application to support two-factor authentication using SMS.
-
- @*@(Model.PhoneNumber ?? "None")
- @if (Model.PhoneNumber != null)
+@ViewData["Title"]
+@Html.Partial("_StatusMessage", Model.StatusMessage)
+
+
+@section Scripts {
+ @await Html.PartialAsync("_ValidationScriptsPartial")
+}
diff --git a/Sample/Views/Manage/ManageLogins.cshtml b/Sample/Views/Manage/ManageLogins.cshtml
deleted file mode 100644
index cb764d4..0000000
--- a/Sample/Views/Manage/ManageLogins.cshtml
+++ /dev/null
@@ -1,54 +0,0 @@
-@model ManageLoginsViewModel
-@using Microsoft.AspNetCore.Http.Authentication
-@{
- ViewData["Title"] = "Manage your external logins";
-}
-
-@ViewData["Title"].
-
-@ViewData["StatusMessage"]
-@if (Model.CurrentLogins.Count > 0)
-{
- Registered Logins
-
-}
-@if (Model.OtherLogins.Count > 0)
-{
- Add another service to log in.
-
-
-}
diff --git a/Sample/Views/Manage/ManageNavPages.cs b/Sample/Views/Manage/ManageNavPages.cs
new file mode 100644
index 0000000..69cb68a
--- /dev/null
+++ b/Sample/Views/Manage/ManageNavPages.cs
@@ -0,0 +1,38 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Threading.Tasks;
+using Microsoft.AspNetCore.Mvc.Rendering;
+using Microsoft.AspNetCore.Mvc.ViewFeatures;
+
+namespace Sample.Views.Manage
+{
+ public static class ManageNavPages
+ {
+ public static string ActivePageKey => "ActivePage";
+
+ public static string Index => "Index";
+
+ public static string ChangePassword => "ChangePassword";
+
+ public static string ExternalLogins => "ExternalLogins";
+
+ public static string TwoFactorAuthentication => "TwoFactorAuthentication";
+
+ public static string IndexNavClass(ViewContext viewContext) => PageNavClass(viewContext, Index);
+
+ public static string ChangePasswordNavClass(ViewContext viewContext) => PageNavClass(viewContext, ChangePassword);
+
+ public static string ExternalLoginsNavClass(ViewContext viewContext) => PageNavClass(viewContext, ExternalLogins);
+
+ public static string TwoFactorAuthenticationNavClass(ViewContext viewContext) => PageNavClass(viewContext, TwoFactorAuthentication);
+
+ public static string PageNavClass(ViewContext viewContext, string page)
+ {
+ var activePage = viewContext.ViewData["ActivePage"] as string;
+ return string.Equals(activePage, page, StringComparison.OrdinalIgnoreCase) ? "active" : null;
+ }
+
+ public static void AddActivePage(this ViewDataDictionary viewData, string activePage) => viewData[ActivePageKey] = activePage;
+ }
+}
diff --git a/Sample/Views/Manage/ResetAuthenticator.cshtml b/Sample/Views/Manage/ResetAuthenticator.cshtml
new file mode 100644
index 0000000..54a2361
--- /dev/null
+++ b/Sample/Views/Manage/ResetAuthenticator.cshtml
@@ -0,0 +1,21 @@
+@{
+ ViewData["Title"] = "Reset authenticator key";
+ ViewData.AddActivePage(ManageNavPages.TwoFactorAuthentication);
+}
+
+@ViewData["Title"]
+
+
+
+ If you reset your authenticator key your authenticator app will not work until you reconfigure it.
+
+
+ This process disables 2FA until you verify your authenticator app and will also reset your 2FA recovery codes.
+ If you do not complete your authenticator app configuration you may lose access to your account.
+
+
+
+
+
\ No newline at end of file
diff --git a/Sample/Views/Manage/SetPassword.cshtml b/Sample/Views/Manage/SetPassword.cshtml
index 8f832ed..56c3599 100644
--- a/Sample/Views/Manage/SetPassword.cshtml
+++ b/Sample/Views/Manage/SetPassword.cshtml
@@ -1,38 +1,34 @@
@model SetPasswordViewModel
@{
- ViewData["Title"] = "Set Password";
+ ViewData["Title"] = "Set password";
+ ViewData.AddActivePage(ManageNavPages.ChangePassword);
}
+Set your password
+@Html.Partial("_StatusMessage", Model.StatusMessage)
You do not have a local username/password for this site. Add a local
account so you can log in without an external login.
-
-