Ejemplo n.º 1
0
        public async Task <IActionResult> OnGetAsync(string userUuid, string code, string success)
        {
            ModelState.Clear();

            try
            {
                if (string.IsNullOrEmpty(success))
                {
                    UserModel user = await _identityServices.ConfirmUserEmailAddressAsync(userUuid, new UserConfirmEmailSpec()
                    {
                        Code = code
                    }).ConfigureAwait(false);

                    // make sure we continue on THIS tenant when completing the login
                    // this avoids breaking wizards etc. by redirecting to another tenant
                    // that was selected before

                    Response.Cookies.Delete(TenantModel.CookieName);

                    await _events.RaiseAsync(new UserLoginSuccessEvent(user.UserName, user.Id, user.GetEmail())).ConfigureAwait(false);

                    return(LocalRedirect("/Account/ConfirmEmail?success=true"));
                }
                else
                {
                    return(Page());
                }
            }
            catch (ApiException e)
            {
                ModelState.AddModelError(string.Empty, _translationsProvider.TranslateError(e.GetErrorCode(), e.Message, e.Uuid, e.Name));

                return(LocalRedirect("~/"));
            }
        }
Ejemplo n.º 2
0
        public async Task <IActionResult> OnGetAsync(string userUuid, string code)
        {
            ModelState.Clear();

            try
            {
                await _identityServices.ConfirmUserEmailAddressAsync(userUuid, new UserConfirmEmailSpec()
                {
                    Code = code
                }).ConfigureAwait(false);

                return(Page());
            }
            catch (ApiException e)
            {
                ModelState.AddModelError(string.Empty, _translationsProvider.TranslateError(e.GetErrorCode(), e.Message, e.Uuid, e.Name));

                return(LocalRedirect("~/"));
            }
        }