Refactoring

This commit is contained in:
2013-01-17 20:14:04 -05:00
parent dccadd3d42
commit ffb6961fe0
7 changed files with 26 additions and 54 deletions
+1
View File
@@ -6,6 +6,7 @@ namespace MileageTraker.Web.ViewModels.Account
public class LoginViewModel
{
[Required]
[RegularExpression("[^@]*", ErrorMessage = "Enter just your username, not your email")]
public string Username { get; set; }
[Required]
+9 -38
View File
@@ -1,5 +1,4 @@
@using MileageTraker.Web.Utility
@model MileageTraker.Web.Models.User
@model MileageTraker.Web.Models.User
@{
ViewBag.Title = "User Details";
@@ -49,15 +48,8 @@
@Html.DisplayNameFor(m => m.LastActivityDate)
</dt>
<dd>
@if (!Model.LastActivityDate.IsSqlMinValue())
{
@Html.Encode(Model.LastActivityDate)
<span class="muted">(@Html.Encode((DateTime.Now - Model.LastActivityDate).ToVerboseStringHistoric()))</span>
}
else
{
<span class='label label-info'>No Activity</span>
}
@Html.Partial("_DateTimeHistoric",
new Tuple<DateTime,string>(Model.LastActivityDate, "No Activity"))
</dd>
</dl>
@@ -66,15 +58,8 @@
@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>
}
@Html.Partial("_DateTimeHistoric",
new Tuple<DateTime,string>(Model.LastLoginDate, "Never Logged In"))
</dd>
</dl>
@@ -83,15 +68,8 @@
@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>
}
@Html.Partial("_DateTimeHistoric",
new Tuple<DateTime,string>(Model.LastPasswordChangedDate, "Never Changed"))
</dd>
</dl>
@@ -101,15 +79,8 @@
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>
}
@Html.Partial("_DateTimeHistoric",
new Tuple<DateTime,string>(Model.LastLockoutDate, "Never Locked (?)"))
</dd>
</dl>
}
+1 -1
View File
@@ -57,7 +57,7 @@
</text>),
grid.Column("LastActivityDate", "Last Activity",
@<text>
@Html.Partial("_LastActivity", (DateTime)item.LastActivityDate)
@Html.Partial("_DateTimeHistoric", new Tuple<DateTime,string>((DateTime)item.LastActivityDate, "No Activity"))
</text>),
grid.Column(format:
@<div class='btn-group'>
+12
View File
@@ -0,0 +1,12 @@
@using MileageTraker.Web.Utility
@model Tuple<DateTime,string>
@if (!Model.Item1.IsSqlMinValue())
{
@Html.Encode((DateTime.Now - Model.Item1).ToVerboseStringHistoric())
<span class="muted">(@Html.Encode(Model.Item1))</span>
}
else
{
<span class='label label-info'>@Model.Item2</span>
}
-12
View File
@@ -1,12 +0,0 @@
@using MileageTraker.Web.Utility
@model DateTime
@if (!Model.IsSqlMinValue())
{
@Html.Encode(Model)
<span class="muted">(@Html.Encode((DateTime.Now - Model).ToVerboseStringHistoric()))</span>
}
else
{
<span class='label label-info'>No Activity</span>
}
+2 -2
View File
@@ -14,8 +14,8 @@
<add key="UnobtrusiveJavaScriptEnabled" value="true" />
<add key="enableSimpleMembership" value="false" />
<add key="EmailFromAddress" value="Mileage Traker &lt;noreply@ethra.org&gt;" />
<add key="ResetPasswordSubject" value="New Password Request" />
<add key="ResetPasswordBody" value="{1}, please open this link to set a new password for your Mileage Traker account: {0}" />
<add key="ResetPasswordSubject" value="New Mileage Traker Password Request" />
<add key="ResetPasswordBody" value="Hello {1}, please open this link to set a new password for your Mileage Traker account: {0}" />
<add key="InitializePasswordSubject" value="Initialize Mileage Traker Account" />
<add key="InitializetPasswordBody" value="Hello {1}, welcome to Mileage Traker. Your username is {2}. Please open this link to initialize your password: {0}" />
</appSettings>
+1 -1
View File
@@ -300,9 +300,9 @@
<Content Include="Views\User\_UserStatusLabels.cshtml" />
<Content Include="Views\Account\ResetPassword.cshtml" />
<Content Include="Views\Account\NewPassword.cshtml" />
<Content Include="Views\User\_LastActivity.cshtml" />
<Content Include="Views\Shared\EditorTemplates\CheckBoxViewModel.cshtml" />
<Content Include="Views\User\InviteUninitialized.cshtml" />
<Content Include="Views\User\_DateTimeHistoric.cshtml" />
</ItemGroup>
<ItemGroup>
<Content Include="packages.config">