// // GET: /ForgotPassword/ public ActionResult fprstpswrd(String e, String sc, String cid, String fn) { if (e == string.Empty && sc == string.Empty && fn == string.Empty && cid == string.Empty) { ViewBag.Keyword = "Error!"; ViewBag.message = "Invalid link, Are you missing something?"; } else { try { e = encdata.AESDecrypt(e.Replace(' ', '+'), encStringKey); sc = encdata.AESDecrypt(sc.Replace(' ', '+'), encStringKey); cid = encdata.AESDecrypt(cid.Replace(' ', '+'), encStringKey); fn = encdata.AESDecrypt(fn.Replace(' ', '+'), encStringKey); using (MySqlConnection con = new MySqlConnection(connection)) { con.Open(); using (MySqlCommand cmd = con.CreateCommand()) { cmd.CommandText = "SELECT * FROM kpcustomersglobal.PayNearMe " + "WHERE UserID = @e AND FullName = @fn AND CustomerID = @cid AND securityCode = @sc;"; cmd.Parameters.AddWithValue("e", e); cmd.Parameters.AddWithValue("fn", fn); cmd.Parameters.AddWithValue("cid", cid); cmd.Parameters.AddWithValue("sc", sc); MySqlDataReader rdr = cmd.ExecuteReader(); if (rdr.HasRows) { if (updateAndNotifyUser(e, sc, fn, cid)) { ViewBag.Keyword = "Success!"; ViewBag.message = "Your password has been resetted. A mail has been sent to your email address with your new password, please do check. Thank You!"; } else { ViewBag.Keyword = "Failed!"; } } else { throw new Exception("Unable to find user...."); } } } } catch (Exception ex) { ViewBag.Keyword = "System Error!"; ViewBag.message = "Invalid link, this could be due to the link you have browsed is expired. Are you missing something?"; kplog.Error("ForgotPasswordController[fprstpswrd] email :" + e + ", CustomerID :" + cid + ", fullName :" + fn + ", security code :" + sc + " ─ System Error ─" + ex.Message); } } return(PartialView()); }
public ActionResult Index() { var uname = Request.QueryString["user"]; var pass = Request.QueryString["pass"]; //GMO //uname = "PERN94016508"; //pass = "******"; //HELPDESK //uname = "GATC0602975501"; //pass = "******"; //uname = "LARI11949070"; //pass = "******"; try { if (uname != string.Empty && pass != string.Empty && uname != null && pass != null) { pass = pass.Replace("%", " ").Replace(" ", "+"); try { pass = decrypt.AESDecrypt(pass, "kWuYDGElyQDpGKM9"); } catch { pass = pass.Replace("%", " ").Replace(" ", "+");; } System.Web.HttpContext.Current.Session["UserName"] = uname; System.Web.HttpContext.Current.Session["UserPass"] = pass; var flag = 1; try { flag = (int)System.Web.HttpContext.Current.Session["islogin"]; } catch { flag = 1; } if (flag == 0) { System.Web.HttpContext.Current.Session.Clear(); usermod.islogin = false; usermod.message = "Please Enter Username and Password."; return(View(usermod)); } else { return(RedirectToAction("Main", "LogIn")); } } else { System.Web.HttpContext.Current.Session.Clear(); usermod.islogin = false; usermod.message = "Please Enter Username and Password."; return(View(usermod)); } } catch (Exception ex) { acmodel.WriteToFile("Login Error : " + ex.ToString()); System.Web.HttpContext.Current.Session.Clear(); usermod.islogin = false; usermod.message = "Please Enter Username and Password."; return(View(usermod)); } }
public ActionResult Index() { System.Web.HttpContext.Current.Session.Clear(); username = Request.QueryString["user"]; userpass = Request.QueryString["pass"]; //username = "******"; //123456 //userpass = "******"; //http://192.168.12.41/CustomerService/Login?user=admin&pass=123456ML //username = "******"; //123456 //userpass = "******"; try { if (username != string.Empty && userpass != string.Empty) { userpass = userpass.Replace("%", " ").Replace(" ", "+"); try { userpass = decrypt.AESDecrypt(userpass, "kWuYDGElyQDpGKM9"); } catch { userpass = userpass.Replace("%", " ").Replace(" ", "+");; } System.Web.HttpContext.Current.Session["UserName"] = username; System.Web.HttpContext.Current.Session["UserPass"] = userpass; if (username == "admin" && userpass == "123456ML") { System.Web.HttpContext.Current.Session["userfullname"] = username; System.Web.HttpContext.Current.Session["user"] = username; return(RedirectToAction("Index", "Admin")); } else { return(RedirectToAction("Main", "Login")); } } else { cs.WriteToFile("Customer Service Login: User not found!"); return(RedirectToAction("Index", "Logout")); } } catch (Exception ex) { cs.WriteToFile("Customer Service Login: "******"Index", "Logout")); } }
public ActionResult searchTask(TaskSearch taskSearch) { user_tasks data = new user_tasks(); List <daily_task> daily = new List <daily_task>(); List <task_list> tasks = new List <task_list>(); try { using (MySqlConnection con = new MySqlConnection(connection)) { con.Open(); using (MySqlCommand cmd = con.CreateCommand()) { cmd.CommandText = "SELECT *, TIME_FORMAT(timeFrom, \"%h:%i %p\") AS timeFrom_formatted, " + " TIME_FORMAT(timeTo, \"%h:%i %p\") AS timeTo_formatted FROM kpDailyTask.Report" + taskSearch.Month + " WHERE user = @user AND YEAR(DATE) = @year ORDER BY date DESC, timeFrom DESC;"; cmd.Parameters.AddWithValue("user", encdata.AESDecrypt(taskSearch.encUser.Replace(' ', '+'), encStringKey)); cmd.Parameters.AddWithValue("year", taskSearch.Year); MySqlDataReader rdr = cmd.ExecuteReader(); if (rdr.HasRows) { String currDate = string.Empty; while (rdr.Read()) { if (currDate == string.Empty) { currDate = rdr["date"].ToString(); } if (currDate == rdr["date"].ToString()) { tasks.Add(new task_list { taskID = rdr["taskID"].ToString(), timeFrom = rdr["timeFrom_formatted"].ToString(), timeTo = rdr["timeTo_formatted"].ToString(), task = rdr["Task"].ToString(), woNo = rdr["WOno"].ToString(), confirmed = Convert.ToBoolean(rdr["confirmed"].ToString()) }); } else { daily.Add(new daily_task { task_date = Convert.ToDateTime(currDate), taskLists = tasks }); tasks = new List <task_list>(); currDate = rdr["date"].ToString(); tasks.Add(new task_list { taskID = rdr["taskID"].ToString(), timeFrom = rdr["timeFrom_formatted"].ToString(), timeTo = rdr["timeTo_formatted"].ToString(), task = rdr["Task"].ToString(), woNo = rdr["WOno"].ToString(), confirmed = Convert.ToBoolean(rdr["confirmed"].ToString()) }); } } //final daily add from last date result- daily.Add(new daily_task { task_date = Convert.ToDateTime(currDate), taskLists = tasks }); data = new user_tasks { user = taskSearch.encUser, tasks = daily }; } else { ViewBag.message = "No tasks retrieved..."; } } } } catch (Exception ex) { Console.WriteLine("error: " + ex.ToString()); } return(PartialView("_getTask", data)); }