public static Account Login(string identity, string password) { if (string.IsNullOrEmpty(identity)) { throw new ArgumentNullException("identity"); } if (string.IsNullOrEmpty(password)) { throw new ArgumentNullException("password"); } try { identity = identity.Trim(); //@PIPE: ENCRYPTE PASSWORD //Không quan tâm active chưa, chỉ cần đúng pass //Phải dùng kèm với CheckAccount ở AccountController var acc = IoCConfig.Service <IAccountService>().GetAccountByIdentity(identity); if (acc != null) { IPasswordEncrypter _passwordEncrypter = new Pbkdf2Encrypter(); if (_passwordEncrypter.ValidatePassword(password, acc.Account_Password)) { return(acc); } } //login failed. return(null); } catch { return(null); } }
public static string EncryptPassword(string password) { IPasswordEncrypter _passwordEncrypter = new Pbkdf2Encrypter(); return(_passwordEncrypter.HashPassword(password)); }