public ActionResult ActivatePassword(string code)
 {
     try {
         if ((code ?? "") == "")
         {
             ViewBag.error = "Check your email and follow activation link to set activate your new password";
             return(View(user));
         }
         UserPassw up   = new UserPassw(shared);
         string    myid = up.ActivatePassword(code);
         if (shared.error.UserError())
         {
             ViewBag.error = shared.error.text;
             return(View(user));
         }
         if (myid == "")
         {
             ViewBag.error = "User not found";
             return(View(user));
         }
         user.Select(myid);
         SetLoginUserParams();
         ViewBag.success = "1";
         return(View(user));
     }
     catch (Exception ex)
     {
         return(ShowError(ex));
     }
 }
        public ActionResult RequestPassword(User post)
        {
            try
            {
                UserPassw up = new UserPassw(shared);
                up.email = post.email;
                up.passw = post.passw;
                string code = up.RequestPassword();
                if (shared.error.UserError())
                {
                    ViewBag.error = shared.error.text;
                    return(View(user));
                }

                EMail email = new EMail(shared);

                string message = @"To use your new password follow the link:
                
                " + shared.config.hostname + "Login/ActivatePassword?code=" + code;

                email.Send(up.email, "Activate your new Password", message);

                return(RedirectToAction("ActivatePassword", "Login"));
            }
            catch (Exception ex)
            {
                return(ShowError(ex));
            }
        }
 public ActionResult Password()
 {
     try
     {
         UserPassw passw = new UserPassw(shared);
         Init("cabinet_password");
         return(View(passw));
     }
     catch (Exception ex)
     {
         return(ShowError(ex));
     }
 }
 public ActionResult Password(UserPassw post)
 {
     try
     {
         UserPassw passw = new UserPassw(shared);
         passw.Copy(post);
         passw.id = Session["user_id"].ToString();
         passw.ChangePassword();
         Init("cabinet_password");
         if (shared.error.AnyError())
         {
             return(View(passw));
         }
         return(RedirectToAction("Logout", "Login"));
     }
     catch (Exception ex)
     {
         return(ShowError(ex));
     }
 }