public async Task <IActionResult> OnPostAsync() { if (Smtp.Address is null) { Smtp.Address = Smtp.Login; } if (Smtp.Name is null) { Smtp.Name = "CRM Server"; } password = Smtp.Password; Smtp.Password = string.Empty; using var passwordHasher = new PasswordHasher(); Smtp.Password = passwordHasher.Encrypt(password, Smtp); try { await smtpService.ConfigureAsync(Smtp); await writableSmtp.UpdateAsync(Smtp); // Disables setup application.FirstRun = false; await writableApplication.UpdateAsync(application); return(LocalRedirect("~/")); } catch (AuthenticationException) { return(Page()); } catch (NotSupportedException) { return(Page()); } }