/// <summary>
        /// Registration success page
        /// </summary>
        /// <returns></returns>
        /// /Registration/ConfirmRegistration

        /// <summary>
        /// Registration success page
        /// </summary>
        /// <returns></returns>
        /// /Registration/ConfirmRegistration/{token}
        public IActionResult ConfirmRegistration(long id, string token)
        {
            if (token != null)
            {
                int result = userService.ActivateAccount(id, token);
                ViewBag.IsActivated = true;

                if (result == 1)
                {
                    ViewBag.Error   = false;
                    ViewBag.Message = "You have successfully activated your account!";
                }
                else if (result == 0)
                {
                    //something went wrong
                    ViewBag.Error   = true;
                    ViewBag.Message = "This acount is already verified. If you are " +
                                      "having difficulty logging in please contact <a href=#>administrator</a> for assistance";
                }
                else if (result == -1)
                {
                    //something went wrong
                    ViewBag.Error   = true;
                    ViewBag.Message = "I'm sorry we failed to verify your account. " +
                                      "Please contact <a href=#>administrator</a> for assistance";
                }
            }
            else
            {
                ViewBag.IsActivated = false;
            }
            return(View());
        }
예제 #2
0
 public async Task <ServiceResponse <UserDTO> > Activate(string usernameOrEmail, string activationCode)
 {
     return(await HandleApiOperationAsync(async() => {
         var result = await _userSvc.ActivateAccount(usernameOrEmail, activationCode);
         return new ServiceResponse <UserDTO>(result);
     }));
 }
예제 #3
0
        public async Task <ActionResult> ActivateAccount(string id)
        {
            var result = await _userService.ActivateAccount(id);

            if (result.Succeeded)
            {
                _logger.LogInformation($"Account activate for user: {id}");
                return(Ok());
            }

            _logger.LogInformation($"Unable to activate account for user: {id}");
            return(BadRequest());
        }
        public async Task <IActionResult> ConfirmAccount([FromBody] ActivateUser activationData)
        {
            await _userService.ActivateAccount(activationData.Email, activationData.ActivateKey);

            return(Ok());
        }
예제 #5
0
        public async Task <IActionResult> ActivateUserAccount([FromQuery] string token)
        {
            await _userService.ActivateAccount(token);

            return(Ok());
        }
예제 #6
0
        public async Task <IActionResult> ActiveAccount(string id)
        {
            ViewBag.IsActivated = await _UserService.ActivateAccount(id);

            return(View());
        }