Просмотр исходного кода

Fixed 'LastSeen' not being updated at login.

Added AM/PM to last seen display.
master
Teknikode 6 лет назад
Родитель
Сommit
644c7eefd1
  1. 7
      Teknik/Areas/User/Controllers/UserController.cs
  2. 2
      Teknik/Areas/User/Views/User/Index.cshtml

7
Teknik/Areas/User/Controllers/UserController.cs

@ -155,10 +155,11 @@ namespace Teknik.Areas.Users.Controllers @@ -155,10 +155,11 @@ namespace Teknik.Areas.Users.Controllers
{
user.HashedPassword = SHA384.Hash(model.Username, model.Password);
user.TransferAccount = false;
db.Entry(user).State = EntityState.Modified;
db.SaveChanges();
}
HttpCookie authcookie = Utility.UserHelper.CreateAuthCookie(model.Username, model.RememberMe, Request.Url.Host.GetDomain(), Request.IsLocal);
user.LastSeen = DateTime.Now;
db.Entry(user).State = EntityState.Modified;
db.SaveChanges();
HttpCookie authcookie = UserHelper.CreateAuthCookie(model.Username, model.RememberMe, Request.Url.Host.GetDomain(), Request.IsLocal);
Response.Cookies.Add(authcookie);
if (string.IsNullOrEmpty(model.ReturnUrl))

2
Teknik/Areas/User/Views/User/Index.cshtml

@ -73,7 +73,7 @@ @@ -73,7 +73,7 @@
<li class="list-group-item text-right"><span class="pull-left"><strong>Joined</strong></span> <time datetime="@Model.LastSeen.ToString("o")">@Model.JoinDate.ToString("MMMM dd, yyyy")</time></li>
@if (OwnProfile && User.Identity.IsAuthenticated)
{
<li class="list-group-item text-right"><span class="pull-left"><strong>Last Seen</strong></span> <time datetime="@Model.LastSeen.ToString("o")">@Model.LastSeen.ToString("MMMM dd, yyyy hh:mm:ss")</time></li>
<li class="list-group-item text-right"><span class="pull-left"><strong>Last Seen</strong></span> <time datetime="@Model.LastSeen.ToString("o")">@Model.LastSeen.ToString("MMMM dd, yyyy hh:mm tt")</time></li>
}
@if (!string.IsNullOrEmpty(pgpFingerprint))
{

Загрузка…
Отмена
Сохранить