Exemple #1
0
        public ActionResult Verify(vmAccountVerify model)
        {
            if (ModelState.IsValid)
            {
                try
                {
                    //decrypt oauth string
                    string oauthDecode = HttpUtility.UrlDecode(model.OAuth);
                    oauthDecode = oauthDecode.Replace(" ", "+");   //fix situations where spaces and plus get mixed up
                    string decryptStr = new SimpleAES().Decrypt(oauthDecode);

                    //split into password and username
                    string[] s = Regex.Split(decryptStr, "\\|\\|");

                    if (Membership.ValidateUser(s[1], s[0]) == true)
                    {
                        if (Membership.Provider.ChangePassword(s[1], s[0], model.Password))
                        {
                            FormsAuthentication.SetAuthCookie(s[1], true);
                            return(RedirectToAction("Index", "Dashboard"));
                        }
                    }
                }
                catch { }

                TempData["Error"] = "Change password failed.";
            }
            else
            {
                TempData["Error"] = "Change password failed.";
            }

            return(View(model));
        }
Exemple #2
0
        // GET: /Account/Verify     USED TO SET PERMANENT PASSWORD
        public ActionResult Verify(string oauthcrd)
        {
            if (ModelState.IsValid)
            {
                try
                {
                    //decrypt oauth string
                    string oauthDecode = HttpUtility.UrlDecode(oauthcrd);
                    oauthDecode = oauthDecode.Replace(" ", "+");   //fix situations where spaces and plus get mixed up
                    string decryptStr = new SimpleAES().Decrypt(oauthDecode);

                    //split into password and username
                    string[] s = Regex.Split(decryptStr, "\\|\\|");

                    if (Membership.ValidateUser(s[1], s[0]) == false)
                    {
                        TempData["Error"] = "Verification failed.";
                    }
                }
                catch
                {
                    TempData["Error"] = "Verification failed.";
                }
            }

            var model = new vmAccountVerify
            {
                OAuth = oauthcrd
            };

            return(View(model));
        }