public async Task <IActionResult> VerifyAccount([FromForm] VerifyAccountViewModel model) { if (!ModelState.IsValid) { return(BadRequest()); } var user = await _userManager.FindByNameAsync(model.UserName); if (user == null) { return(BadRequest()); } var result = await _userManager.VerifyChangePhoneNumberTokenAsync(user, model.Code, user.PhoneNumber); if (result) { user.PhoneNumberConfirmed = true; var updated = await _userManager.UpdateAsync(user); if (updated.Succeeded) { return(Ok()); } } return(BadRequest()); } // end
// verify account public string VerifyAccount(VerifyAccountViewModel model) { User user = GetUserByEmail(model.Email); if (user != null) { if (user.VerificationCode.Equals(model.VerificationCode)) { user.Verify = 1; unitOfWork.User.Update(user); int rowsAffected = unitOfWork.Completed(); if (rowsAffected > 0) { // verified return("1"); } else { // failed return("0"); } } else { // invalid verfication code return("2"); } } else { // invalid user return("3"); } }
public object VerifyAccount() { VerifyAccountViewModel model = new VerifyAccountViewModel(); model.Email = Request.Form["email"]; model.VerificationCode = Request.Form["verificationCode"]; string message = userManager.VerifyAccount(model); return(message); }
public async Task <IActionResult> VerifyAccount(VerifyAccountViewModel model, string returnUrl = null) { if (ModelState.IsValid) { await Task.Run(async() => { await SendCode(model.VerifyType); }); return(RedirectToAction("ActiveAccount", new { returnUrl, verifyType = model.VerifyType })); } return(View(model)); }
public IActionResult VerifyAccount(VerifyAccountViewModel verifyAccountViewModel) { //if (aUser.ValidateNewPassword()) //{ // string lstrSaltValue = Security.GetSaltValue(); // string lstrSaltedPassword = lstrSaltValue + aUser.idoUser.password; // MD5 md5Hash = MD5.Create(); // aUser.idoUser.password = Security.GetMd5Hash(md5Hash, lstrSaltedPassword); // aUser.idoUser.saltValue = Security.Encrypt(lstrSaltValue); // aUser.idoUser.isUserVerified = Constant.FlagY; // aUser = new UserService().SetNewPassword(aUser); // return RedirectToAction("VerifyAccountConfirmation", "Account"); //} //else return(View(verifyAccountViewModel)); }
public async Task DialogsAsync(Form parent, ISignIn signingInState) { SignupSignInViewModel viewModel = new SignupSignInViewModel(signingInState, new NameOf(nameof(Texts.WelcomeToAxCrypt)), new NameOf(nameof(Texts.MessageAskAboutStartTrialForWindows))) { UserEmail = UserEmail, Version = Version, }; viewModel.BindPropertyChanged(nameof(viewModel.UserEmail), (string email) => UserEmail = email); viewModel.BindPropertyChanged(nameof(viewModel.StopAndExit), (bool stop) => StopAndExit = stop); viewModel.BindPropertyChanged(nameof(viewModel.TopControlsEnabled), (bool enabled) => SetTopControlsEnabled(parent, enabled)); viewModel.CreateAccount = (e) => { using (CreateNewAccountDialog dialog = new CreateNewAccountDialog(parent, String.Empty, EmailAddress.Parse(UserEmail))) { DialogResult result = dialog.ShowDialog(); if (result != DialogResult.OK) { e.Cancel = true;; } } return(Task.FromResult <object>(null)); }; viewModel.RequestEmail = (e) => { using (EmailDialog dialog = new EmailDialog(parent)) { dialog.EmailTextBox.Text = viewModel.UserEmail; DialogResult result = dialog.ShowDialog(parent); if (result != DialogResult.OK) { e.Cancel = true; return(Task.FromResult <object>(null)); } viewModel.UserEmail = dialog.EmailTextBox.Text; } return(Task.FromResult <object>(null)); }; viewModel.VerifyAccount = (e) => { VerifyAccountViewModel vav = new VerifyAccountViewModel(EmailAddress.Parse(viewModel.UserEmail)); vav.BindPropertyChanged <bool>(nameof(vav.AlreadyVerified), (verified) => viewModel.AlreadyVerified = verified); using (VerifyAccountDialog dialog = new VerifyAccountDialog(parent, vav)) { DialogResult result = dialog.ShowDialog(parent); if (result != DialogResult.OK) { e.Cancel = true; } } return(Task.FromResult <object>(null)); }; viewModel.SignInCommandAsync = signingInState.SignIn; viewModel.RestoreWindow = () => { if (New <UserSettings>().RestoreFullWindow) { Styling.RestoreWindowWithFocus(parent); } return(Task.FromResult <object>(null)); }; await viewModel.DoAll.ExecuteAsync(null); }
public VerifyAccountDialog(Form owner, VerifyAccountViewModel viewModel) : this() { InitializeStyle(owner); _viewModel = viewModel; }