소스 검색

Fixed 'GetLastAccountActivity' throwing an exception if an account portion doesn't exist.

tags/3.0.0
Teknikode 3 년 전
부모
커밋
c6d836dac2
3개의 변경된 파일30개의 추가작업 그리고 12개의 파일을 삭제
  1. 10
    2
      ServerMaint/Program.cs
  2. 2
    1
      Teknik/App_Data/reservedUsernames.txt
  3. 18
    9
      Teknik/Areas/User/Utility/UserHelper.cs

+ 10
- 2
ServerMaint/Program.cs 파일 보기

@@ -1,4 +1,4 @@
using nClam;
using nClam;
using System;
using System.Collections.Generic;
using System.Data.Entity;
@@ -538,7 +538,15 @@ Thank you for your continued use of Teknik!
}

#region Inactivity Finding
DateTime lastActivity = UserHelper.GetLastAccountActivity(db, config, user);
DateTime lastActivity = DateTime.Now;
try
{
lastActivity = UserHelper.GetLastAccountActivity(db, config, user);
}
catch
{
continue;
}

TimeSpan inactiveTime = DateTime.Now.Subtract(lastActivity);


+ 2
- 1
Teknik/App_Data/reservedUsernames.txt 파일 보기

@@ -108,6 +108,7 @@ sales
save
search
security
server admin
sessions
settings
sftp
@@ -141,4 +142,4 @@ widgets
wiki
www
xfn
xmpp
xmpp

+ 18
- 9
Teknik/Areas/User/Utility/UserHelper.cs 파일 보기

@@ -89,17 +89,26 @@ namespace Teknik.Areas.Users.Utility
{
DateTime lastActive = new DateTime(1900, 1, 1);

DateTime emailLastActive = UserEmailLastActive(config, GetUserEmailAddress(config, user.Username));
if (lastActive < emailLastActive)
lastActive = emailLastActive;
if (UserEmailExists(config, GetUserEmailAddress(config, user.Username)))
{
DateTime emailLastActive = UserEmailLastActive(config, GetUserEmailAddress(config, user.Username));
if (lastActive < emailLastActive)
lastActive = emailLastActive;
}

DateTime gitLastActive = UserGitLastActive(config, user.Username);
if (lastActive < gitLastActive)
lastActive = gitLastActive;
if (UserGitExists(config, user.Username))
{
DateTime gitLastActive = UserGitLastActive(config, user.Username);
if (lastActive < gitLastActive)
lastActive = gitLastActive;
}

DateTime userLastActive = UserLastActive(db, config, user);
if (lastActive < userLastActive)
lastActive = userLastActive;
if (UserExists(db, user.Username))
{
DateTime userLastActive = UserLastActive(db, config, user);
if (lastActive < userLastActive)
lastActive = userLastActive;
}

return lastActive;
}

Loading…
취소
저장