Beispiel #1
0
        public ActionResult EditPw(EditPasswordForm user)
        {
            try
            {
                if (ModelState.IsValid)
                {
                    byte[]       pwEncrypt;
                    UserPassword up = new UserPassword();
                    _encrypt       = new RSAEncryption(ConsumeInstance.Get <byte[]>("Auth"));
                    pwEncrypt      = _encrypt.Encrypt(user.Password);
                    up.Password    = Convert.ToBase64String(pwEncrypt);
                    pwEncrypt      = _encrypt.Encrypt(user.OldPassword);
                    up.OldPassword = Convert.ToBase64String(pwEncrypt);

                    UserResponse ur = ConsumeInstance.PutWithReturn <UserPassword, UserResponse>("User/ChangePw/" + SessionManager.Id, up);
                    if (ur.ErrorCode == 3)
                    {
                        FlashMessage.Warning("The old password doesn't match");
                        return(View(user));
                    }
                    else
                    {
                        FlashMessage.Confirmation("Password Changed, Please reconnect");
                    }
                    SessionManager.Abandon();
                    return(RedirectToAction("Index", "Home"));
                }
                else
                {
                    return(View(user));
                }
            }
            catch
            {
                return(View());
            }
        }
 public ActionResult Logout()
 {
     SessionManager.Abandon();
     return(RedirectToAction("Index", "Home"));
 }
Beispiel #3
0
 public IActionResult Logout()
 {
     SessionManager.Abandon();
     return(RedirectToAction("Login"));
 }
Beispiel #4
0
 public ActionResult SignOut()
 {
     SessionManager.Abandon();
     CookieManager.RemoveAuthenticationCookie();
     return(RedirectToAction("Index", "Home", new { area = "" }));
 }
 public static void Logout()
 {
     SetCurrentUser(new AppUserVm());
     FormsAuthentication.SignOut();
     SessionManager.Abandon();
 }