public async Task <IActionResult> Subscribe(string email) { try { await _service.SubscribeAsync(email); } catch { return(Controllers.FormSubmitResult(Controllers.SubmitResult.Warning, "Either you are already subscribed or something went wrong while performing your subscription, if so consider trying again soon")); } return(Controllers.FormSubmitResult(Controllers.SubmitResult.Success, "Thank you! You are successfully subscribed to the Kicksware newsletter. We won't spam")); }
public async Task <IActionResult> Account(UserViewModel user) { var result = await _userManager.UpdateAsync(user); var updateResult = result.Succeeded ? Controllers.FormSubmitResult(Controllers.SubmitResult.Success, "Great! Account information was successfully updated") : Controllers.FormSubmitResult(Controllers.SubmitResult.Error, result.Errors.Select(err => err.Description).FirstOrDefault()); await SetTheme(user.Settings.Theme); await SetLayoutView(user.Settings.LayoutView); SetExperimentalScroll(user.Settings.MobileExperimentalScrollEnabled); if (!result.Succeeded) { return(updateResult); } if (!string.IsNullOrWhiteSpace(user.NewPassword)) { if (!user.NewPassword.Equals(user.ConfirmPassword)) { return(Controllers.FormSubmitResult(Controllers.SubmitResult.Error, "Password confirmation and Password must match")); } result = await _userManager.ChangePasswordAsync(user, user.CurrentPassword, user.NewPassword); return(result.Succeeded ? Controllers.FormSubmitResult(Controllers.SubmitResult.Success, "Nice! Got yourself a new secret password") : Controllers.FormSubmitResult(Controllers.SubmitResult.Error, result.Errors.FirstOrDefault()?.Description)); } return(updateResult); }
public IActionResult Unsubscribe(string email) { _service.UnsubscribeAsync(email); return(Controllers.FormSubmitResult(Controllers.SubmitResult.Success, "Good buy, you are now unsubscribed from Kicksware newsletter")); }