CryptoUtils.GetHashedPassword

This commit is contained in:
2015-06-04 07:19:22 +02:00
parent 8d906ab609
commit a563abd0b6
2 changed files with 10 additions and 3 deletions

View File

@@ -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;

View File

@@ -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));
}
}
}