public async Task <ActionResult> ConfirmEmail(int?userId, string code)
        {
            if (userId == null || code == null)
            {
                return(View("Error"));
            }
            var result = await _userManager.ConfirmEmailAsync(userId.Value, code);

            return(View(result.Succeeded ? "ConfirmEmail" : "Error"));
        }
예제 #2
0
        public virtual async Task <Tuple <bool, string> > ConfirmEmail(long userId, string code)
        {
            if (string.IsNullOrWhiteSpace(code))
            {
                return(new Tuple <bool, string>(false, "خطا در تایید کاربری"));
            }
            var result = await _userManager.ConfirmEmailAsync(userId, code);

            return(new Tuple <bool, string>(result.Succeeded, ""));
        }
예제 #3
0
        public async Task <IActionResult> ConfirmEmail(string userId, string code)
        {
            if (userId == null || code == null)
            {
                return(View("Error"));
            }

            var user = await _userManager.FindByIdAsync(userId);

            if (user == null)
            {
                return(View("NotFound"));
            }

            var result = await _userManager.ConfirmEmailAsync(user, code);

            return(View(result.Succeeded ? nameof(ConfirmEmail) : "Error"));
        }
예제 #4
0
        public virtual async Task <ActionResult> ConfirmEmail(int?userId, string code)
        {
            //if(enable confirm email feature then show confirm page)
            //return view("info")
            if (userId == null || code == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }

            var result = await _userManager.ConfirmEmailAsync(userId.Value, code);

            if (result.Succeeded)
            {
                return(View());
            }

            return(RedirectToAction("ReceiveActivatorEmail", "Account"));
        }
예제 #5
0
        public virtual async Task <ActionResult> ConfirmEmail(int?userId, string code)
        {
            //if(enable confirm email feature then show confirm page)
            //return view("info")
            if (userId == null || code == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }

            var result = await _userManager.ConfirmEmailAsync(userId.Value, code);

            if (result.Succeeded)
            {
                return(View());
            }
            this.NotyWarning("مشکلی در فعال سازی اکانت شما به وجود آمد");
            return(RedirectToAction(MVC.Account.ActionNames.ReceiveActivatorEmail, MVC.Account.Name));
        }
예제 #6
0
        public async Task <IActionResult> ConfirmEmail(string userId, string code)
        {
            if (userId == null || code == null)
            {
                return(RedirectToAction("Index", "Home"));
            }

            var user = await userManager.FindByIdAsync(userId);

            if (user == null)
            {
                return(NotFound($"Unable to find any User with ID '{userId}' "));
            }
            var result = await userManager.ConfirmEmailAsync(user, code);

            if (!result.Succeeded)
            {
                throw new InvalidOperationException($"در تایید ایمیل کاربری با آی دی '{userId}' مشکلی به وجود آمد ");
            }
            return(View());
        }
        public async Task <IActionResult> ConfirmEmail([FromQuery] string userId, [FromQuery] string code)
        {
            if (userId == null || code == null)
            {
                return(BadRequest());
            }

            var user = await _userManager.FindByIdAsync(userId);

            if (user == null)
            {
                return(NotFound("User not found."));
            }

            await _userManager.ConfirmEmailAsync(user, code);

            var registeredEvent = new RegisteredIntegrationEvent(user.UserName, user.Id, customerId: null, firstName: user.FirstName, lastName: user.LastName, phone: user.UserName);

            _eventBus.Publish(registeredEvent);

            return(Ok());
        }
        public async Task <IActionResult> ConfirmEmail(string userId, string code)
        {
            if (userId == null || code == null)
            {
                return(RedirectToAction("Index", "Home"));
            }

            var user = await _userManager.FindByIdAsync(userId);

            if (user == null)
            {
                return(NotFound($"Unable to load user with ID '{userId}'"));
            }

            var result = await _userManager.ConfirmEmailAsync(user, code);

            if (!result.Succeeded)
            {
                throw new InvalidOperationException($"Error Confirming email for user with ID '{userId}'");
            }

            return(View());
        }