public ActionResult AnswerQuestions(string ans1, string ans2)
 {
     if (Session["LoggedInCustomerId"] != null || Session["bankerid"] != null)
     {
         return(Redirect("/HomePage/Logout"));
     }
     else
     {
         var c = new ChangePasswordModel();
         c.cid = HttpContext.Session["ForgotPassword"].ToString();
         var s = new UpdateSecurityQstns();
         s.answer1 = ans1;
         s.answer2 = ans2;
         var ch = new CustomerHelper();
         if (ch.AnswerQuestions(s, c))
         {
             return(View("ResetPassword"));
         }
         else
         {
             TempData["ForgotPasswordPre"] = "Wrong Answers";
             return(Redirect("/ForgotPassword/Index"));
         }
     }
 }
 public ActionResult FetchQuestions(string cid)
 {
     if (Session["LoggedInCustomerId"] != null || Session["bankerid"] != null)
     {
         return(Redirect("/HomePage/Logout"));
     }
     else
     {
         HttpContext.Session["ForgotPassword"] = cid;
         var c = new ChangePasswordModel();
         c.cid = cid;
         var s  = new UpdateSecurityQstns();
         var ch = new CustomerHelper();
         s = ch.FetchSecurityQuestions(c);
         if (s.qid1 == null)
         {
             ViewData["ForgotPasswordPre"] = "Invalid CUstomerId";
             return(View("ForgotPasswordPre"));
         }
         else
         {
             return(View("ForgotPassword", s));
         }
     }
 }
예제 #3
0
        internal UpdateSecurityQstns FetchSecurityQuestions(ChangePasswordModel c)
        {
            sql = "SELECT qname,question2 from security s,securityquestion sq where sq.qid=s.question1 and customerid=" + c.cid;
            var s = new UpdateSecurityQstns();

            using (conn = new SqlConnection(connectionString))
            {
                cmd = new SqlCommand(sql, conn);
                conn.Open();
                rdr = cmd.ExecuteReader();
                while (rdr.Read())
                {
                    s.qid1      = rdr["qname"].ToString();
                    s.question2 = rdr["question2"].ToString();
                }
                conn.Close();
                return(s);
            }
        }
예제 #4
0
        internal bool AnswerQuestions(UpdateSecurityQstns s, ChangePasswordModel c)
        {
            sql = "SELECT customerid from security where customerid=" + c.cid + "and answer1='" + s.answer1 + "'and answer2='" + s.answer2 + "'";

            using (conn = new SqlConnection(connectionString))
            {
                using (cmd = new SqlCommand(sql, conn))
                {
                    conn.Open();
                    rdr = cmd.ExecuteReader();
                    if (rdr.Read())
                    {
                        conn.Close();
                        return(true);
                    }
                    conn.Close();
                    return(false);
                }
            }
        }
예제 #5
0
 internal void UpdateSecurityQuestions(UpdateSecurityQstns s, ChangePasswordModel p)
 {
     using (conn = new SqlConnection(connectionString))
     {
         using (cmd = new SqlCommand())
         {
             cmd.Connection  = conn;           // <== lacking
             cmd.CommandType = CommandType.Text;
             cmd.CommandText = "INSERT into security(customerid,question1,answer1,question2,answer2) VALUES (@cid, @qid,@ans1,@question2,@ans2)";
             cmd.Parameters.AddWithValue("@cid", p.cid);
             cmd.Parameters.AddWithValue("@qid", s.qid1);
             cmd.Parameters.AddWithValue("@ans1", s.answer1);
             cmd.Parameters.AddWithValue("@question2", s.question2);
             cmd.Parameters.AddWithValue("@ans2", s.answer2);
             conn.Open();
             int recordsAffected = cmd.ExecuteNonQuery();
             conn.Close();
         }
     }
 }
예제 #6
0
 public ActionResult UpdateSecurity(string qid1, string answer1, string question2, string answer2, string pass1)
 {
     if (Session["FirstTimeLogin"] == null)
     {
         return(Redirect("/HomePage/Index"));
     }
     else
     {
         var ch = new CustomerHelper();
         var s  = new UpdateSecurityQstns();
         var p  = new ChangePasswordModel();
         s.qid1      = qid1;
         s.answer1   = answer1;
         s.question2 = question2;
         s.answer2   = answer2;
         p.cid       = HttpContext.Session["FirstTimeLogin"].ToString();
         p.newpass   = pass1;
         ch.UpdateSecurityQuestions(s, p);
         ch.ChangePasswordForgot(p);
         TempData["CustomerMessage"] = "Succesfully updated details";
         return(Redirect("/HomePage/Index"));
     }
 }