public async Task Login() { CanLogin = false; //Get db hash and salt corresponding to email var result = await Data.SqlDB.GetDBHashAndSalt(Email); if (result.Item1 == string.Empty || result.Item2 == string.Empty) { ShowError = true; CanLogin = true; return; } bool success = Data.PasswordHasher.VerifyPassword(Password, result.Item2, result.Item1); if (success) { //Close login form ShowError = false; WindowCloseEvent?.Invoke(); } else { //Show invalid credential notice ShowError = true; CanLogin = true; } }
private async Task CreateUser() { Guid id; //ensure that user GUID is not already taken do { id = Guid.NewGuid(); } while (await Data.SqlDB.IsGUIDConflict(id)); var hash = Data.PasswordHasher.HashPassword(Password); //insert user into database await Data.SqlDB.InsertUser(id, hash.Item1, hash.Item2, Email, FirstName, LastName); //Close window WindowCloseEvent?.Invoke(); }