public async Task <ActionResult> ResendConfirmationEmail(string username, int withdrawId) { var user = await UserManager.FindByNameAsync(username); if (user == null) { return(Unauthorized()); } var confirmToken = await WithdrawReader.GetWithdrawalToken(user.Id, withdrawId); if (string.IsNullOrEmpty(confirmToken)) { return(JsonError($"Withdrawal #{withdrawId} not found", "Error")); } var cancelWithdrawToken = await UserManager.GenerateUserTwoFactorTokenAsync(TwoFactorTokenType.WithdrawCancel, user.Id); var confirmlink = Url.Action("ConfirmWithdraw", "Withdraw", new { username = user.UserName, secureToken = confirmToken, withdrawid = withdrawId }, protocol: Request.Url.Scheme); var cancellink = Url.Action("CancelWithdraw", "Withdraw", new { username = user.UserName, secureToken = cancelWithdrawToken, withdrawid = withdrawId }, protocol: Request.Url.Scheme); var result = await EmailService.Send(EmailType.WithdrawConfirmation, user, "Support", new EmailParam("[CONFIRMLINK]", confirmlink), new EmailParam("[CANCELLINK]", cancellink)); if (!result) { return(JsonError($"Failed to send confirmation email", "Error")); } return(JsonSuccess($"Successfully sent confirmation email to {user.Email}", "Success")); }
public async Task <ActionResult> Summary(int withdrawId, string returnUrl) { var withdraw = await WithdrawReader.GetWithdrawal(User.Identity.GetUserId(), withdrawId); if (withdraw == null) { ViewBag.Message = $"Withdrawal #{withdrawId} not found."; return(View("Error")); } withdraw.ReturnUrl = GetLocalReturnUrl(returnUrl); return(View(withdraw)); }
public async Task <ActionResult> Create(int currencyId) { var user = await UserManager.FindByIdAsync(User.Id()); if (user == null) { return(Unauthorized()); } var model = await WithdrawReader.GetCreateWithdraw(User.Id(), currencyId); if (model == null) { return(ViewMessageModal(new ViewMessageModel(ViewMessageType.Danger, "Invalid Request", "An unknown error occured."))); } model.TwoFactorComponentType = TwoFactorComponentType.Withdraw; model.TwoFactorType = await UserManager.GetUserTwoFactorTypeAsync(user.Id, TwoFactorComponentType.Withdraw); return(View("CreateWithdrawModal", model)); }
public async Task <ActionResult> GetWithdrawals(DataTablesModel param) { return(DataTable(await WithdrawReader.GetWithdrawDataTable(param))); }