예제 #1
0
        public ActionResult ResendActivationCode(ResendActivationCodeViewModel model)
        {
            if (IsModelValidAndPersistErrors())
            {
                User user = _userServices.GetUser(model.UsernameOrEmail);
                if (user != null)
                {
                    if (string.IsNullOrEmpty(user.ActivationCode))
                    {
                        SetNotice("This account is already active. Visit the Password Reminder page if you have forgotten your password.");
                    }
                    else
                    {
                        string confirm_url = Url.Action("ActivateUser", "Auth", new { uname = user.Username, code = user.ActivationCode });
                        _emailServices.ResendActivationCode(user, confirm_url);

                        string success = string.Format("An email has been sent to <b>{0}</b> with the activation link for this account", user.Email);

                        SetSuccess(success);
                    }
                    return(RedirectToAction("Login"));
                }
                else
                {
                    SetError("Email/Username was not found");
                }
            }

            return(RedirectToSelf());
        }