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
+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>
}