Exemplo n.º 1
0
        public IActionResult ForgotPassword(string email)
        {
            if (ModelState.IsValid)
            {
                User user = new User();
                user.Email = email;
                var userId   = _userDataAccess.GetUserId(user);
                var userInfo = _userDataAccess.GetUserById(userId);

                var    path    = Url.Action("ResetPassword", "Account", null, protocol: HttpContext.Request.Scheme);
                string message = "Please confirm your email by clicking <a href=\"" + path + "\">here</a>";

                userInfo.ConfirmAccount = false;
                _userDataAccess.UpdateUser(userInfo);
                _email.SendGrid(user.Email, message);

                return(View("Views/Account/ConfirmEmail.cshtml"));
            }
            else
            {
                return(RedirectToAction("ForgotPassword", "Account"));
            }
        }
Exemplo n.º 2
0
 public IActionResult AuthenticateLogin(int userId)
 {
     ModelState.Clear();
     ViewBag.login = true;
     if (userId != 0)
     {
         User user = _userDataAccess.GetUserById(userId);
         user.ConfirmAccount = true;
         _userDataAccess.UpdateUser(user);
     }
     else
     {
         ModelState.AddModelError(string.Empty, "Please enter your email and password!");
     }
     return(View("Views/Account/RegisterLogin.cshtml"));
 }
Exemplo n.º 3
0
        public IActionResult Edit(User user)
        {
            var userId = GetCurrentUser().Id;
            var studio = new Studio();

            user.Id             = userId;
            user.ConfirmAccount = true;
            studio.Name         = user.StudioName;

            _userDataAccess.UpdateUser(user);

            var studioId = _userDataAccess.GetUserById(userId).StudioId;

            _studioDataAccess.UpdateStudio(studio, studioId);

            return(RedirectToAction("Index"));
        }