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()); }
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")); }
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")); }
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("*****@*****.**"); }
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}")); }
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()); }
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)); }
public ActionResult Activate(Guid activationId) { _userService.Activate(activationId); return(View("AccountActivated")); }
public IActionResult Activate(long adId) => Ok(_userService.Activate(adId));