CryptoUtils.GetHashedPassword
This commit is contained in:
@@ -89,7 +89,7 @@ namespace Scrummer.Code.BusinessLogic
|
||||
if (string.IsNullOrEmpty(password) == false)
|
||||
{
|
||||
user.PasswordSalt = CryptoUtils.GetCryptoToken();
|
||||
user.PasswordHash = CryptoUtils.GetSHA1(String.Format("{1}{0}{1}", password, user.PasswordSalt));
|
||||
user.PasswordHash = CryptoUtils.GetHashedPassword(password, user.PasswordSalt);
|
||||
}
|
||||
|
||||
if (isNew) { _users.Add(user); }
|
||||
@@ -102,7 +102,7 @@ namespace Scrummer.Code.BusinessLogic
|
||||
User user = User_GetByNameOrEmail(nameOrMail, nameOrMail);
|
||||
if (user == null) { return false; }
|
||||
|
||||
string passwordHash = CryptoUtils.GetSHA1(String.Format("{1}{0}{1}", password, user.PasswordSalt));
|
||||
string passwordHash = CryptoUtils.GetHashedPassword(password, user.PasswordSalt);
|
||||
if (passwordHash != user.PasswordHash) { return false; }
|
||||
|
||||
return true;
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using System.Security.Cryptography;
|
||||
using System;
|
||||
using System.Security.Cryptography;
|
||||
using System.Text;
|
||||
|
||||
namespace Scrummer.Code
|
||||
@@ -30,5 +31,11 @@ namespace Scrummer.Code
|
||||
{
|
||||
return CryptoUtils.GetSHA1(CryptoUtils.GetRandString(10));
|
||||
}
|
||||
|
||||
public static string GetHashedPassword(string password, string passwordSalt)
|
||||
{
|
||||
return CryptoUtils.GetSHA1(String.Format("{1}{0}{1}", password, passwordSalt));
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user