public virtual bool CreateAccount(string username, string password) { if (!_accountStore.AccountExists(username)) { return(_accountStore.CreateAccount(username, password)); } else { return(false); } }
public async Task <ActionResult <string[]> > CreateAccount(NewAccount newAccount) { _logger.LogInformation("Creating account {AccountName}", newAccount.AccountName); var verifyResult = await VerifyNewAccount(newAccount); if (!verifyResult.Success) { return(verifyResult); } var salt = Guid.NewGuid().ToString(); await _accountStore.CreateAccount(new UserAccount { Name = newAccount.AccountName, Password = PasswordHasher.Hash(newAccount.Password, salt), PasswordSalt = salt }); _logger.LogInformation("Account created: {AccountName}", newAccount.AccountName); return(ActionResult <string[]> .CreateSuccess()); }