Fixed possible issue in TryCookieLogin (null username and/or loginKey).

This commit is contained in:
Dario Solera 2010-03-16 06:09:24 +00:00
parent 59a6592b76
commit 1f3023f33d
2 changed files with 4 additions and 2 deletions

View file

@ -16,5 +16,5 @@ using System.Reflection;
// //
// You can specify all the values or you can default the Revision and Build Numbers // You can specify all the values or you can default the Revision and Build Numbers
// by using the '*' as shown below: // by using the '*' as shown below:
[assembly: AssemblyVersion("3.0.2.510")] [assembly: AssemblyVersion("3.0.2.511")]
[assembly: AssemblyFileVersion("3.0.2.510")] [assembly: AssemblyFileVersion("3.0.2.511")]

View file

@ -635,6 +635,8 @@ namespace ScrewTurn.Wiki {
/// <param name="loginKey">The login key.</param> /// <param name="loginKey">The login key.</param>
/// <returns>The correct UserInfo object, or <c>null</c>.</returns> /// <returns>The correct UserInfo object, or <c>null</c>.</returns>
public static UserInfo TryCookieLogin(string username, string loginKey) { public static UserInfo TryCookieLogin(string username, string loginKey) {
if(string.IsNullOrEmpty(username) || string.IsNullOrEmpty(loginKey)) return null;
if(username == "admin" && loginKey == ComputeLoginKey(username, Settings.ContactEmail, DateTime.MinValue)) { if(username == "admin" && loginKey == ComputeLoginKey(username, Settings.ContactEmail, DateTime.MinValue)) {
// Just return, no notification to providers because the "admin" account is fictitious // Just return, no notification to providers because the "admin" account is fictitious
return GetAdministratorAccount(); return GetAdministratorAccount();