Backend/e-suite.API/eSuite.API/Views/Account/Login.cshtml

80 lines
3.7 KiB
Plaintext

@using e_suite.API.Common.models
@model e_suite.API.Common.models.Login
@{
ViewBag.Title = "e-suite";
Layout = "~/Views/Shared/_layout.cshtml";
}
<div class="logo"></div>
<div className="loginForm">
<h1>Login</h1>
@using (Html.BeginForm(method: FormMethod.Post, antiforgery:true, htmlAttributes: new { data_full_page_redirect = "true" }))
{
<fieldset>
@Html.AntiForgeryToken()
@switch (ViewBag.loginResponse)
{
case LoginResult.EmailNotConfirmed:
<div>Password reset e-mail has been sent.</div>
<a href="/">Back to login</a>
break;
case LoginResult.TwoFactorAuthenticationRemovalRequested:
<div>Two factor authentication removal has been requested</div>
<a href="/">Back to login</a>
break;
case LoginResult.TwoFactorAuthenticationCodeRequired:
case LoginResult.TwoFactorAuthenticationCodeIncorrect:
@Html.HiddenFor(m => m.Email)
@Html.HiddenFor(m => m.Password)
<div class="editor-label">
@Html.LabelFor(m => m.SecurityCode)
</div>
<div class="editor-field">
@Html.EditorFor(m => m.SecurityCode, new { htmlAttributes = new { autocomplete = "one-time-code" } })
@Html.ValidationMessageFor(m => m.Email)
</div>
<button type="submit" class="btn btn-primary btn-spaced" name="Submit">Login</button>
<button type="submit" class="btn btn-primary btn-spaced" name="RequestTfaRemoval" value="true">My Authenticator is not working</button>
break;
case LoginResult.Failed:
default:
<div class="editor-label">
@Html.LabelFor(m => m.Email)
</div>
<div class="editor-field">
@Html.EditorFor(m => m.Email, new { htmlAttributes = new { type = "email", autocomplete = "username", @class = "form-control" } })
@Html.ValidationMessageFor(m => m.Email)
</div>
@if (Model.ForgotPassword)
{
<div>Password reset e-mail has been sent.</div>
<a href="/">Back to login</a>
}
else
{
@if (string.IsNullOrWhiteSpace(Model.Email))
{
<button type="submit" class="btn btn-primary btn-spaced" name="Submit">Next</button>
}
else
{
<div class="editor-label">
@Html.LabelFor(m => m.Password)
</div>
<div class="editor-field">
@Html.EditorFor(m => m.Password, new { htmlAttributes = new { type = "password", autocomplete = "current-password" } })
@Html.ValidationMessageFor(m => m.Password)
</div>
<button type="submit" class="btn btn-primary btn-spaced" name="Submit">Login</button>
<button type="submit" class="btn btn-primary btn-spaced" name="ForgotPassword" value="true">I forgot my password</button>
}
}
break;
}
</fieldset>
}
</div>