public async Task <ExternalLoginConfirmViewModel> ExternalLoginConfirm(ExternalLoginConfirmViewModel model) { try { var page = await base.InitPage(); model.SetInitInfo(page); return(model); } catch (Exception e) { _logger.LogError(e, e.Message); throw e; } }
public async Task <IActionResult> ExternalLoginConfirm([FromForm] ExternalLoginConfirmViewModel model, string returnurl) { string redirectUrl = returnurl; if (string.IsNullOrEmpty(redirectUrl)) { redirectUrl = SystemDefine.HomePage; } if (await _customerAppService.IsAuthenticated()) { return(Redirect(redirectUrl)); } var validator = ExternalLoginConfirmModelValidator.ValidateModel(model); if (validator.IsValid) { model = await _customerAppService.ExternalLoginConfirm(model); } if (!model.IsSuccess && model.Messages.Count > 0) { foreach (var message in model.Messages) { ModelState.AddModelError(string.Empty, message); } } if (model.IsSuccess) { ViewBag.RedirectUrl = redirectUrl; } if (!validator.IsValid) { validator.AddToModelState(ModelState, null, model); } ViewData["returnurl"] = redirectUrl; return(View("ExternalLoginCallback", model)); }