Esempio n. 1
0
        public async Task <IActionResult> Activate([FromQuery] int Id)
        {
            int MyId = int.Parse(this.User.Claims.First(x => x.Type == "UserID").Value);
            await _uService.Activate(Id, MyId);

            return(Ok());
        }
Esempio n. 2
0
        public IActionResult Activate(string guid)
        {
            var user = _userService.Activate(guid);

            if (user == null)
            {
                return(BadRequest(new { message = "Invalid activation link" }));
            }

            return(Ok(user));
        }
        public IActionResult Activate([FromQuery] string code)
        {
            var completed = _userService.Activate(code);

            if (!completed)
            {
                return(BadRequest(new { message = "Aktivacija nije uspesna, kontaktirajte administratora." }));
            }

            return(Ok("Aktivacija uspesna"));
        }
Esempio n. 4
0
        public ActionResult Activate(string userEmail)
        {
            var user = _userService.Activate(userEmail);

            if (user == null)
            {
                TempData["Error"] = "User wasn`t activated!";
            }
            TempData["Success"] = "Teacher successfully created!";
            Logger.Log.Info($"User with Name - {userEmail}, activated successfully.");
            return(RedirectToAction("List"));
        }
Esempio n. 5
0
        public void ActivateTest()
        {
            var user = new User("*****@*****.**", "", new List <Course>());

            _userService.AddStudent(user, "Password_22");
            _userService.Ban("*****@*****.**");
            _userService.Activate("*****@*****.**");
            var res = _userService.GetStudentByEmail("*****@*****.**");

            Assert.AreEqual(user.Name, res.Name);
            _userService.DeleteUser("*****@*****.**");
        }
Esempio n. 6
0
        public async Task <IActionResult> Activate([FromBody] User user)
        {
            if (user == null)
            {
                return(BadRequest($"User is null"));
            }

            var userResponse = await _userService.Activate(user);

            if (!string.IsNullOrEmpty(userResponse))
            {
                return(NotFound(userResponse));
            }

            return(Ok($"Successfully activated {user.LastName}"));
        }
Esempio n. 7
0
        public IActionResult Activate(string email, string code)
        {
            if (!_userService.CheckEmailExits(email))
            {
                return(BadRequest("Email nie istnieje"));
            }

            if (_activationCodeService.Validate(code, email))
            {
                _userService.Activate(email);
                return(Ok());
            }

            var newCode = _activationCodeService.CreateNew(email);

            _emailService.SendActivationCode(email, newCode);
            return(BadRequest());
        }
Esempio n. 8
0
        public IActionResult Activate([FromQuery] string token)
        {
            if (token == null)
            {
                return(BadRequest(new
                {
                    Message = "Token is required for validation"
                }));
            }

            var activatedUser = _userService.Activate(HttpUtility.UrlDecode(token));

            if (activatedUser == null)
            {
                return(BadRequest(new
                {
                    Message = "No user can be found that needs to be activated for this token"
                }));
            }

            return(Ok(activatedUser));
        }
Esempio n. 9
0
        public ActionResult Activate(Guid activationId)
        {
            _userService.Activate(activationId);

            return(View("AccountActivated"));
        }
Esempio n. 10
0
 public IActionResult Activate(long adId) => Ok(_userService.Activate(adId));