Admin auth functionally complete

This commit is contained in:
2012-12-31 14:49:41 -05:00
parent 8739251066
commit 2ec2a752cd
30 changed files with 260 additions and 79 deletions
+3 -1
View File
@@ -10,7 +10,9 @@
}
@using (Html.BeginForm("Login", "Account", new { ViewBag.ReturnUrl }, FormMethod.Post, new {@class = "form-login"})) {
@Html.Partial("_StatusMessage")
<div class="header"></div>
<h2>@ViewBag.Title</h2>
+2
View File
@@ -4,6 +4,8 @@
ViewBag.Title = "Enter Mileage Log";
}
@Html.Partial("_StatusMessage")
<h2 class="center-content">@ViewBag.Title</h2>
@using (Html.BeginForm("Index", "CreateLog", FormMethod.Post, new { @class = "form-horizontal well center-content" }))
-17
View File
@@ -1,17 +0,0 @@
@model MileageTraker.Web.ViewModels.CreateLog.CreateLogViewModel
@{
ViewBag.Title = "Success";
}
<p class="alert alert-success center-content">
You've successfully created an entry
for <strong>@Html.DisplayTextFor(m => m.EmployeeName)</strong>
traveling to <strong>@Html.DisplayTextFor(m => m.CityName)</strong>
on <strong>@Html.Encode(Model.Date.ToShortDateString())</strong>
in Vehicle Id <strong>@Html.DisplayTextFor(m => m.VehicleId)</strong>
ending in <strong>@Html.DisplayTextFor(m => m.EndOdometer)</strong>
miles on the odometer.
</p>
<p class="center-content">
@Html.ActionLink("Create another", "Index", null, new { @class = "btn" })
</p>
+2
View File
@@ -6,6 +6,8 @@
@{ Html.RenderPartial("BackToLogs"); }
@Html.Partial("_StatusMessage")
<h2 class="center-content">@ViewBag.Title</h2>
@using (Html.BeginForm("Create", "Log", FormMethod.Post, new { @class = "form-horizontal well center-content" }))
+2
View File
@@ -6,6 +6,8 @@
@{ Html.RenderPartial("BackToLogs"); }
@Html.Partial("_StatusMessage")
<h2 class="center-content">@ViewBag.Title</h2>
<div class="center-content label label-warning">Are you sure you wish to delete this log?</div>
-3
View File
@@ -15,9 +15,6 @@
<li class="previous">
@Html.ActionLink("Previous", "PreviousDetails", new { id = Model.LogId })
</li>
@if(TempData["Message"] != null) { // so, yeah, span doesn't go here, but it renders
<span class="alert">@TempData["Message"]</span>
}
<li class="next">
@Html.ActionLink("Next", "NextDetails", new { id = Model.LogId })
</li>
+2
View File
@@ -6,6 +6,8 @@
@{ Html.RenderPartial("BackToLogs"); }
@Html.Partial("_StatusMessage")
<h2 class="center-content">@ViewBag.Title</h2>
@using (Html.BeginForm("Edit", "Log", FormMethod.Post, new { @class = "form-horizontal well center-content" }))
@@ -5,6 +5,8 @@
@{ Html.RenderPartial("BackToLogs"); }
@Html.Partial("_StatusMessage")
<h2>@ViewBag.Title</h2>
<div>
@@ -5,6 +5,8 @@
@{ Html.RenderPartial("BackToLogs"); }
@Html.Partial("_StatusMessage")
<h2>@ViewBag.Title</h2>
<div>
+3 -3
View File
@@ -1,12 +1,12 @@
@if (TempData.ContainsKey("StatusMessage"))
{
<p class="center-content alert alert-info">
<p class="center-content alert @Html.Raw(TempData["StatusMessage-Type"])">
<button type="button" class="close" data-dismiss="alert">&times;</button>
@TempData["StatusMessage"]
@Html.Raw(TempData["StatusMessage"])
</p>
} else if (ViewBag.StatusMessage != null)
{
<p class="center-content alert alert-info">
<p class="center-content alert">
<button type="button" class="close" data-dismiss="alert">&times;</button>
@ViewBag.StatusMessage
</p>
+75 -5
View File
@@ -12,9 +12,20 @@
<h2 class="center-content">@ViewBag.Title</h2>
<div class="center-content well">
<dl class="dl-horizontal username">
<dt>
@Html.DisplayNameFor(m => m.Username)
</dt>
<dd>
@Html.Encode(Model.Username)
@Html.Partial("_UserStatusLabels")
</dd>
</dl>
@Html.DisplayFor(m => m.Email)
@Html.DisplayFor(m => m.Username)
@Html.DisplayFor(m => m.FullName)
<dl class="dl-horizontal roles">
<dt>
@@ -33,7 +44,7 @@
</dd>
</dl>
<dl class="dl-horizontal lastActivity">
<dl class="dl-horizontal lastActivityDate">
<dt>
@Html.DisplayNameFor(m => m.LastActivityDate)
</dt>
@@ -50,14 +61,73 @@
</dd>
</dl>
<dl class="dl-horizontal lastLoginDate">
<dt>
@Html.DisplayNameFor(m => m.LastLoginDate)
</dt>
<dd>
@if (!Model.LastLoginDate.IsSqlMinValue())
{
@Html.Encode(Model.LastLoginDate)
<span class="muted">(@Html.Encode((DateTime.Now - Model.LastLoginDate).ToVerboseStringHistoric()))</span>
}
else
{
<span class='label label-info'>Never Logged In</span>
}
</dd>
</dl>
<dl class="dl-horizontal lastPasswordChangedDate">
<dt>
@Html.DisplayNameFor(m => m.LastPasswordChangedDate)
</dt>
<dd>
@if (!Model.LastPasswordChangedDate.IsSqlMinValue())
{
@Html.Encode(Model.LastPasswordChangedDate)
<span class="muted">(@Html.Encode((DateTime.Now - Model.LastPasswordChangedDate).ToVerboseStringHistoric()))</span>
}
else
{
<span class='label label-info'>Never Changed</span>
}
</dd>
</dl>
@if (Model.IsLockedOut) {
<p class="alert alert-info">
Locked out on @Html.DisplayTextFor(m => m.LastLockoutDate)
</p>
<dl class="dl-horizontal lastLockoutDate">
<dt>
Lockout Password Date
</dt>
<dd>
@if (!Model.LastLockoutDate.IsSqlMinValue())
{
@Html.Encode(Model.LastLockoutDate)
<span class="muted">(@Html.Encode((DateTime.Now - Model.LastLockoutDate).ToVerboseStringHistoric()))</span>
}
else
{
<span class='label label-info'>Never Locked (?)</span>
}
</dd>
</dl>
}
</div>
<div class="btn-toolbar center-content">
@Html.ActionLink("Edit", "Edit", new { id = Model.UserId }, new { @class = "btn" })
@Html.ActionLink("Set Password", "SetPassword", new { id = Model.UserId }, new { @class = "btn" })
@if (Model.IsApproved)
{
@Html.ActionLink("Disable Account", "DisableUser", new {id = Model.UserId}, new {@class = "btn"})
}
else
{
@Html.ActionLink("Enable Account", "EnableUser", new {id = Model.UserId}, new {@class = "btn"})
}
@if (Model.IsLockedOut)
{
@Html.ActionLink("Unlock", "UnlockUser", new {id = Model.UserId}, new {@class = "btn"})
}
</div>
+3 -1
View File
@@ -6,6 +6,8 @@
@{ Html.RenderPartial("BackToUsers"); }
@Html.Partial("_StatusMessage")
<h2 class="center-content">@ViewBag.Title</h2>
@using (Html.BeginForm("Edit", "User", FormMethod.Post, new { @class = "form-horizontal well center-content" }))
@@ -25,5 +27,5 @@
}
<div class="btn-toolbar center-content">
@Html.ActionLink("Set Password", "SetPassword", new { id = Model.UserId }, new { @class = "btn" })
@Html.ActionLink("Details", "Details", new { id = Model.UserId }, new { @class = "btn" })
</div>
+15 -18
View File
@@ -1,5 +1,5 @@
@using MileageTraker.Web.Utility
@model IEnumerable<MileageTraker.Web.Models.User>
@using MileageTraker.Web.Models
@model IEnumerable<User>
@{
ViewBag.Title = "Users";
@@ -21,23 +21,20 @@
grid.Columns(
grid.Column("Username", format:
@<text>
<span title="@Html.Encode(item.Email)">
@Html.Encode(item.Username)
</span>
@if (item.LastActivityDate > CustomExtensions.UserOnlineThreshold()) {
<span class='label label-info'>Online</span>
}
@if (item.IsLockedOut) {
<span class='label label-warning' title="@string.Format("Locked out on {0:d}", item.LastLockoutDate)">Locked Out</span>
}
@if (!item.IsApproved)
{
<span class='label label-inverse'>Account Disabled</span>
}</text> ),
<span title="@Html.Encode(item.Email)">
@Html.Encode(item.Username)
</span>
@Html.Partial("_UserStatusLabels",
new User{
LastActivityDate = item.LastActivityDate,
IsLockedOut = item.IsLockedOut,
LastLockoutDate = item.LastLockoutDate,
IsApproved = item.IsApproved})
</text> ),
grid.Column("FullName", "Full Name"),
grid.Column("Roles", format:
@<text>
@{ var roles = Roles.Provider.GetRolesForUser(item.Username); }
@{var roles = Roles.Provider.GetRolesForUser(item.Username);}
@if (roles.Length > 0)
{
@Html.Encode(string.Join(", ", roles))
@@ -49,8 +46,8 @@
</text>),
grid.Column(format:
@<div class='btn-group'>
@Html.ActionLink("Edit", "Edit", new { id = item.UserId }, new { @class = "btn btn-mini" })
@Html.ActionLink("Details", "Details", new { id = item.UserId }, new { @class = "btn btn-mini" })
@*Html.ActionLink("Edit", "Edit", new { id = item.UserId }, new { @class = "btn btn-mini" })*@
@Html.ActionLink("Details / Edit", "Details", new { id = item.UserId }, new { @class = "btn btn-mini" })
</div>)
),
htmlAttributes: new { @class = "table table-striped table-bordered table-hover table-condensed"},
+2
View File
@@ -3,6 +3,8 @@
ViewBag.Title = "Change Password";
}
@Html.Partial("_StatusMessage")
<h2 class="center-content">@ViewBag.Title</h2>
@using (Html.BeginForm("SetPassword", "User", FormMethod.Post, new { @class = "form-horizontal well center-content" }))
+15
View File
@@ -0,0 +1,15 @@
@using MileageTraker.Web.Utility
@model MileageTraker.Web.Models.User
@if (Model.LastActivityDate > CustomExtensions.UserOnlineThreshold())
{
<span class='label label-info'>Online</span>
}
@if (Model.IsLockedOut)
{
<span class='label label-warning' title="@string.Format("Locked out on {0:d} (too many failed login attempts)", Model.LastLockoutDate)">Locked Out</span>
}
@if (!Model.IsApproved)
{
<span class='label label-inverse'>Account Disabled</span>
}
+2
View File
@@ -6,6 +6,8 @@
@{ Html.RenderPartial("BackToVehicles"); }
@Html.Partial("_StatusMessage")
<h2 class="center-content">@ViewBag.Title</h2>
@using (Html.BeginForm("Create", "Vehicle", FormMethod.Post, new { @class = "form-horizontal well center-content" }))
+2
View File
@@ -6,6 +6,8 @@
@{ Html.RenderPartial("BackToVehicles"); }
@Html.Partial("_StatusMessage")
<h2 class="center-content">@ViewBag.Title</h2>
@using (Html.BeginForm("Edit", "Vehicle", FormMethod.Post, new { @class = "form-horizontal well center-content" }))