Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public async Task<ActionResult> Confirm(ConfirmAccountModel cam)
- {
- ViewBag.autoLogin = cam.autoLogin;
- var api = new IrisIdentityApi();
- var uo = new UserOperations(api);
- var request = new ConfirmPasswordResetRequest();
- var confirmPassed = true;
- var customizedConfig = ConfigurationHelper.CustomizedConfigs(Request.Url, cam.CustomCssFolder);
- if (customizedConfig != null)
- {
- ViewBag.CustomCssFolder = customizedConfig.AccountName;
- ViewBag.CompanyName = customizedConfig.CompanyName;
- ViewBag.DesktopCssFile = customizedConfig.DesktopCssFile;
- ViewBag.MobileCssFile = customizedConfig.MobileCssFile;
- ViewBag.PartnerName = customizedConfig.Container;
- ViewBag.ImageUrl = customizedConfig.LogoUrl;
- ViewBag.GeneratedDesktopCssUrl = customizedConfig.GeneratedDesktopCssUrl;
- ViewBag.GeneratedMobileCssUrl = customizedConfig.GeneratedMobileCssUrl;
- ViewBag.CompanyWebAddress = customizedConfig.WebAddress;
- }
- DFPerson dfp = null;
- if (!ModelState.IsValid) //If validation fails, we display the confirmation page again
- {
- dfp = DeepfieldDataPerson.ConfirmationCode(cam.Code);
- ViewBag.Confirmed = false;
- if (dfp.Id != 0)
- {
- ViewBag.Confirmed = true;
- cam.Username = dfp.Username;
- cam.Firstname = dfp.Firstname;
- cam.Surname = dfp.Lastname;
- cam.Type = dfp.Data2;
- }
- return View(cam);
- }
- //If validation passed we carry on to try and confirm
- ViewBag.Confirmed = false;
- dfp = DeepfieldDataPerson.ConfirmationCode(cam.Code);
- // Set confirm password reset request properties
- request.ConfirmationCode = cam.Code;
- request.Email = dfp.Email;
- request.NewPassword = cam.NewPassword;
- if (dfp.Id != 0)
- {
- // Check if the Identity system is switched on
- if (DeepfieldUtility.IsFeatureAvailable("Identity"))
- {
- // Confirm reset password on Identity system
- try
- {
- await uo.ConfirmPasswordResetAsyncAsync(request);
- }
- catch (HttpOperationException ex)
- {
- LOGGER.Error("Confirm account registration on Identity system: " + ex.Response.ReasonPhrase);
- TempData["ErrorState"] = "Confirm account registration on Identity system: " + ex.Response.ReasonPhrase;
- confirmPassed = false;
- }
- }
- // If confirm password reset on Identity system succeeded
- if (confirmPassed)
- {
- // Confirm account registration on OpenSpace
- ViewBag.Confirmed = DeepfieldDataPerson.ConfirmAccountRegistration(cam);
- }
- }
- return View(ViewBag.Confirmed ? "ConfirmSuccess" : "ConfirmFail", cam);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement