public async Task <IActionResult> SignUp(SignUpModel model) { AccountStatusPair asp = await repository.GetAccountStatus(Request, Response); if (asp.status != AccountStatus.Invalid) { return(RedirectToAction("Index")); } if ((ModelState.IsValid) && (model.IsModelValid())) { Account account = new Account(model.Username, model.Email, model.Password, model.FirstName, model.LastName, model.GetGender()); account.Verified = true; // SINCE THERE IS NO WAY OF CONFIRMING THE EMAIL ADDRESS if (await repository.AddAccount(account)) { logger.LogInformation($"User @{account.Username} (ID: {account.Id}) registered with email {account.Email} (Verification code: {account.VerificationCode})"); try { // Services.Email.SendVerification(account.Email, account.VerificationCode.ToString()); } catch (Exception ex) { logger.LogError($"AUTO-MAIL FAILED: {ex.Message}"); return(RedirectToAction("Error")); } return(View("Registered", new RegisteredModel() { FirstName = account.FirstName, Email = account.Email })); } } return(RedirectToAction("Error")); }