Authentication added. Login/Logout operational.
This commit is contained in:
@@ -0,0 +1,28 @@
|
||||
@model MileageTraker.Web.ViewModels.LoginViewModel
|
||||
|
||||
@{
|
||||
ViewBag.Title = "Log in";
|
||||
Layout = "~/Views/Shared/_Layout.login.cshtml";
|
||||
}
|
||||
@section Scripts
|
||||
{
|
||||
<script src="@Url.Content("~/Scripts/jquery.validate.min.js")" type="text/javascript"></script>
|
||||
<script src="@Url.Content("~/Scripts/jquery.validate.unobtrusive.min.js")" type="text/javascript"></script>
|
||||
}
|
||||
|
||||
<h2>@ViewBag.Title</h2>
|
||||
|
||||
@using (Html.BeginForm("Login", "Account", new { ViewBag.ReturnUrl }, FormMethod.Post)) {
|
||||
@Html.AntiForgeryToken()
|
||||
@Html.ValidationSummary(true)
|
||||
|
||||
<fieldset>
|
||||
<legend />
|
||||
@Html.EditorForModel()
|
||||
<div class="control-group">
|
||||
<div class="controls">
|
||||
<input type="submit" value="Log in" class="btn btn-primary" />
|
||||
</div>
|
||||
</div>
|
||||
</fieldset>
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
@model MileageTraker.Web.ViewModels.ChangePasswordViewModel
|
||||
@{
|
||||
ViewBag.Title = "Manage Account";
|
||||
}
|
||||
|
||||
<hgroup class="title">
|
||||
<h1>@ViewBag.Title</h1>
|
||||
</hgroup>
|
||||
|
||||
<p class="label label-success">@ViewBag.StatusMessage</p>
|
||||
|
||||
<p>You're logged in as <strong>@User.Identity.Name</strong>.</p>
|
||||
|
||||
@Html.Partial("_ChangePasswordPartial")
|
||||
@@ -0,0 +1,33 @@
|
||||
@model MileageTraker.Web.ViewModels.RegisterModel
|
||||
@{
|
||||
ViewBag.Title = "Register";
|
||||
}
|
||||
|
||||
<hgroup class="title">
|
||||
<h1>@ViewBag.Title</h1>
|
||||
<h2>Create a new account.</h2>
|
||||
</hgroup>
|
||||
|
||||
@using (Html.BeginForm()) {
|
||||
@Html.AntiForgeryToken()
|
||||
@Html.ValidationSummary()
|
||||
|
||||
<fieldset>
|
||||
<legend>Registration Form</legend>
|
||||
<ol>
|
||||
<li>
|
||||
@Html.LabelFor(m => m.UserName)
|
||||
@Html.TextBoxFor(m => m.UserName)
|
||||
</li>
|
||||
<li>
|
||||
@Html.LabelFor(m => m.Password)
|
||||
@Html.PasswordFor(m => m.Password)
|
||||
</li>
|
||||
<li>
|
||||
@Html.LabelFor(m => m.ConfirmPassword)
|
||||
@Html.PasswordFor(m => m.ConfirmPassword)
|
||||
</li>
|
||||
</ol>
|
||||
<input type="submit" value="Register" />
|
||||
</fieldset>
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
@model MileageTraker.Web.ViewModels.ChangePasswordViewModel
|
||||
|
||||
<h3>Change password</h3>
|
||||
|
||||
@using (Html.BeginForm("Manage", "Account")) {
|
||||
@Html.AntiForgeryToken()
|
||||
@Html.ValidationSummary()
|
||||
|
||||
<fieldset>
|
||||
<legend>Change Password Form</legend>
|
||||
<ol>
|
||||
<li>
|
||||
@Html.LabelFor(m => m.OldPassword)
|
||||
@Html.PasswordFor(m => m.OldPassword)
|
||||
</li>
|
||||
<li>
|
||||
@Html.LabelFor(m => m.NewPassword)
|
||||
@Html.PasswordFor(m => m.NewPassword)
|
||||
</li>
|
||||
<li>
|
||||
@Html.LabelFor(m => m.ConfirmPassword)
|
||||
@Html.PasswordFor(m => m.ConfirmPassword)
|
||||
</li>
|
||||
</ol>
|
||||
<input type="submit" value="Change password" />
|
||||
</fieldset>
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
@model MileageTraker.Web.ViewModels.ChangePasswordViewModel
|
||||
|
||||
<p>
|
||||
You do not have a password for this site.
|
||||
</p>
|
||||
|
||||
@using (Html.BeginForm("Manage", "Account")) {
|
||||
@Html.AntiForgeryToken()
|
||||
@Html.ValidationSummary()
|
||||
|
||||
<fieldset>
|
||||
<legend>Set Password Form</legend>
|
||||
<ol>
|
||||
<li>
|
||||
@Html.LabelFor(m => m.NewPassword)
|
||||
@Html.PasswordFor(m => m.NewPassword)
|
||||
</li>
|
||||
<li>
|
||||
@Html.LabelFor(m => m.ConfirmPassword)
|
||||
@Html.PasswordFor(m => m.ConfirmPassword)
|
||||
</li>
|
||||
</ol>
|
||||
<input type="submit" value="Set password" />
|
||||
</fieldset>
|
||||
}
|
||||
@@ -22,6 +22,7 @@
|
||||
{
|
||||
@Html.ValidationSummary(true)
|
||||
<fieldset>
|
||||
<legend />
|
||||
|
||||
@Html.EditorForModel()
|
||||
|
||||
|
||||
@@ -0,0 +1,4 @@
|
||||
<label class="checkbox">
|
||||
@Html.CheckBox("", ViewData.TemplateInfo.FormattedModelValue)
|
||||
@Html.LabelForModel()
|
||||
</label>
|
||||
@@ -0,0 +1,12 @@
|
||||
@{
|
||||
Layout = "~/Views/Shared/EditorTemplates/_FieldLayout.cshtml";
|
||||
var inputSize = (string)ViewData.ModelMetadata.AdditionalValues["InputSize"];
|
||||
}
|
||||
@if (!string.IsNullOrEmpty(inputSize))
|
||||
{
|
||||
@Html.Password("", ViewData.TemplateInfo.FormattedModelValue, new { @class = inputSize})
|
||||
}
|
||||
else
|
||||
{
|
||||
@Html.Password("", ViewData.TemplateInfo.FormattedModelValue)
|
||||
}
|
||||
@@ -17,6 +17,9 @@
|
||||
<li id="vehicle-nav">@Html.ActionLink("Vehicles", "Index", "Vehicle")</li>
|
||||
<li>@Html.ActionLink("Enter Mileage Log", "Index", "CreateLog")</li>
|
||||
</ul>
|
||||
<section id="account-management">
|
||||
@Html.Partial("_Layout.authentication.cshtml")
|
||||
</section>
|
||||
</div>
|
||||
</div>
|
||||
</header>
|
||||
|
||||
@@ -0,0 +1,15 @@
|
||||
@if (Request.IsAuthenticated) {
|
||||
<ul class="nav pull-right">
|
||||
<li>
|
||||
@Html.ActionLink(User.Identity.Name, "Manage", "Account", null, new { @class = "username", title = "Manage" })
|
||||
</li>
|
||||
<li>
|
||||
@using (Html.BeginForm("LogOff", "Account", FormMethod.Post, new { id = "form-logout" })) {
|
||||
@Html.AntiForgeryToken()
|
||||
<button type="submit" class="btn-link">
|
||||
Log Off
|
||||
</button>
|
||||
}
|
||||
</li>
|
||||
</ul>
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>Mileage Traker - ETHRA - @ViewBag.Title</title>
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0"/>
|
||||
<link href="@Url.Content("~/Content/themes/custom-theme/jquery-ui-1.9.2.custom.min.css")" rel="stylesheet" type="text/css" />
|
||||
<link href="@Url.Content("~/Content/bootstrap.min.css")" rel="stylesheet" type="text/css" />
|
||||
<link href="@Url.Content("~/Content/Site.css")" rel="stylesheet" type="text/css" />
|
||||
@RenderSection("Styles", false)
|
||||
</head>
|
||||
|
||||
<body>
|
||||
|
||||
<div class="container-fluid">
|
||||
@RenderBody()
|
||||
</div>
|
||||
|
||||
<script src="@Url.Content("~/Scripts/jquery-1.8.3.min.js")" type="text/javascript"></script>
|
||||
<script src="@Url.Content("~/Scripts/bootstrap.min.js")" type="text/javascript"></script>
|
||||
<script src="@Url.Content("~/Scripts/jquery.numeric.js")" type="text/javascript"></script>
|
||||
<script src="@Url.Content("~/Scripts/jquery-ui-1.9.2.custom.min.js")" type="text/javascript"></script>
|
||||
<script src="@Url.Content("~/Scripts/Shared/Site.js")" type="text/javascript"></script>
|
||||
@RenderSection("Scripts", false)
|
||||
</body>
|
||||
</html>
|
||||
Reference in New Issue
Block a user