protected void Login1_Authenticate(object sender, AuthenticateEventArgs e) { string strPasswordmd5 = ""; DataTable dt = new DataTable(); objLogin.Username = Login1.UserName; string Password = objEncrypt.Encrypt(Login1.Password); objLogin.Password = Password; dt = objLoginDB.GetDataSet(objLogin, DA_SKORKEL.DA_Login.Login_1.UserLoginMD5); if (dt.Rows.Count > 0) { string strPassword = objEncrypt.Decrypt(Convert.ToString(dt.Rows[0]["vchrPassword"])); DataTable dtmd5 = new DataTable(); objLogin.Password = strPassword; dtmd5 = objLoginDB.GetDataSet(objLogin, DA_Login.Login_1.GetMD5); if (dtmd5.Rows.Count > 0) { strPasswordmd5 = Convert.ToString(dtmd5.Rows[0]["strPasswordMD5"]); } UserSession.UserInfo UInfo = new UserSession.UserInfo(); string LoginName = Convert.ToString(dt.Rows[0]["LoginName"]); UInfo.UserName = Convert.ToString(dt.Rows[0]["vchrUserName"]); UInfo.UserID = Convert.ToInt64(dt.Rows[0]["intRegistrationId"]); int TypeId = Convert.ToInt32(dt.Rows[0]["intUserTypeID"]); string RegistrationType = Convert.ToString(dt.Rows[0]["RegistartionType"]); Session.Add("RegType", RegistrationType); Session.Add("UserTypeId", TypeId); Session.Add("UInfo", UInfo); Session.Add("LoginName", LoginName); Session.Add("ExternalUserId", Convert.ToString(dt.Rows[0]["intRegistrationId"])); objLogin.intRegistartionID = Convert.ToInt32(dt.Rows[0]["intRegistrationId"]); objLoginDB.AddAndGetLoginDetails(objLogin, DA_SKORKEL.DA_Login.Login_1.Login); Response.Redirect("SA_JournalListing.aspx"); //Response.Redirect("SA_Testing.aspx"); } else { Login1.FailureText = "Invalid user."; divLogin.Style.Add("display", "block"); } }
protected void lnkSignOut_Click(object sender, EventArgs e) { objLogin.intRegistartionID = Convert.ToInt32(Session["ExternalUserId"]); if (objLogin.intRegistartionID != 0) { objLoginDB.AddAndGetLoginDetails(objLogin, DA_SKORKEL.DA_Login.Login_1.Logout); } Session.Abandon(); Response.Redirect("SuperAdminLanding.aspx"); }
protected void lnkResetPassword_Click(object sender, EventArgs e) { lblMessage.Text = ""; CryptoGraphy objEncrypt = new CryptoGraphy(); lnkResetPassword.Enabled = false; objLogin.intRegistartionID = Convert.ToInt32(ViewState["UserID"]); dt = objLoginDB.GetDataTable(objLogin, DA_Login.Login_1.UserDetails); if (dt.Rows.Count > 0) { string oldPass = objEncrypt.Decrypt(Convert.ToString(dt.Rows[0]["vchrPassword"])); if (txtOldPassword.Text.Trim() == Convert.ToString(objEncrypt.Decrypt(Convert.ToString(dt.Rows[0]["vchrPassword"])))) { objregistration.RegistrationId = Convert.ToInt32(ViewState["UserID"]); objregistration.Password = objEncrypt.Encrypt(txtNewPassword.Text.Trim()); objLoginDB.AddEditDel_RegistrationDetails(objregistration, DA_Login.Login_1.SelectForUser); objLoginDB.AddAndGetLoginDetails(objLogin, DA_SKORKEL.DA_Login.Login_1.ChangePassword); // lblMessage.Text = "Password updated successfully."; // lblMessage.CssClass = "GreenErrormsg"; System.Web.UI.ScriptManager.RegisterStartupScript(this, this.GetType(), "Yelert", "showSuccessPopupRstPwd('Success','Password updated successfully.')", true); lnkResetPassword.Enabled = true; //remember me cookie removed . //Response.Cookies["myScrlCookie"].Expires = DateTime.Now.AddDays(-1); //Response.Cookies["myScrlCookie"].Values.Add("Password", objregistration.Password.ToString()); if (Request.Cookies["myScrlCookie"] != null) { Response.Cookies["myScrlCookie"].Values.Add("UserID", Request.Cookies.Get("myScrlCookie").Values["UserID"].ToString()); Response.Cookies["myScrlCookie"].Values.Add("UserName", Request.Cookies.Get("myScrlCookie").Values["UserName"].ToString()); Response.Cookies["myScrlCookie"].Values.Add("Password", hdnEncpass.Value.Trim()); Session["hdnEncpass"] = hdnEncpass.Value.Trim(); Response.Cookies["myScrlCookie"].HttpOnly = false; } //myScrlCookie.Values.Add("Password", objregistration.Password.ToString()); } else { lblMessage.Text = "Old password is incorrect."; lblMessage.CssClass = "RedErrormsg"; lnkResetPassword.Enabled = true; return; } } else { lblMessage.Text = "Old password is incorrect."; lblMessage.CssClass = "RedErrormsg"; lnkResetPassword.Enabled = true; return; } }
protected void lnkResetPassword_Click(object sender, EventArgs e) { CryptoGraphy objEncrypt = new CryptoGraphy(); lnkResetPassword.Enabled = false; objLogin.intRegistartionID = Convert.ToInt32(ViewState["UserID"]); dt = objLoginDB.GetDataTable(objLogin, DA_Login.Login_1.UserDetails); if (dt.Rows.Count > 0) { string oldPass = objEncrypt.Decrypt(Convert.ToString(dt.Rows[0]["vchrPassword"])); if (txtOldPassword.Text.Trim() == Convert.ToString(objEncrypt.Decrypt(Convert.ToString(dt.Rows[0]["vchrPassword"])))) { objregistration.RegistrationId = Convert.ToInt32(ViewState["UserID"]); objregistration.Password = objEncrypt.Encrypt(txtNewPassword.Text.Trim()); objLoginDB.AddEditDel_RegistrationDetails(objregistration, DA_Login.Login_1.SelectForUser); objLoginDB.AddAndGetLoginDetails(objLogin, DA_SKORKEL.DA_Login.Login_1.ChangePassword); lblMessage.Text = "Password updated successfully."; lblMessage.CssClass = "GreenErrormsg"; lnkResetPassword.Enabled = true; } else { lblMessage.Text = "Old password is incorrect."; lblMessage.CssClass = "RedErrormsg"; lnkResetPassword.Enabled = true; return; } } else { lblMessage.Text = "Old password is incorrect."; lblMessage.CssClass = "RedErrormsg"; lnkResetPassword.Enabled = true; return; } }
protected void Login1_Authenticate(object sender, AuthenticateEventArgs e) { string strPasswordmd5 = ""; DataTable dt = new DataTable(); objLogin.Username = Login1.UserName; string Password = objEncrypt.Encrypt(Login1.Password); objLogin.Password = Password; dt = objLoginDB.GetDataSet(objLogin, DA_SKORKEL.DA_Login.Login_1.UserLoginMD5);//UserLogin); if (dt.Rows.Count > 0) { string strPassword = objEncrypt.Decrypt(Convert.ToString(dt.Rows[0]["vchrPassword"])); DataTable dtmd5 = new DataTable(); objLogin.Password = strPassword; dtmd5 = objLoginDB.GetDataSet(objLogin, DA_Login.Login_1.GetMD5); if (dtmd5.Rows.Count > 0) { strPasswordmd5 = Convert.ToString(dtmd5.Rows[0]["strPasswordMD5"]); } if (Login1.RememberMeSet == true) { HttpCookie myScrlCookie = new HttpCookie("myScrlCookie"); Response.Cookies.Remove("myScrlCookie"); //Add UserID Cookie myScrlCookie.Values.Add("UserID", Convert.ToString(dt.Rows[0]["intRegistrationId"])); myScrlCookie.Values.Add("UserName", Login1.UserName.ToString()); myScrlCookie.Values.Add("Password", Login1.Password.ToString()); DateTime dtxpiry = DateTime.Now.AddDays(15); myScrlCookie.Expires = dtxpiry; myScrlCookie.HttpOnly = false; Response.Cookies.Add(myScrlCookie); } UserSession.UserInfo UInfo = new UserSession.UserInfo(); string LoginName = Convert.ToString(dt.Rows[0]["LoginName"]); UInfo.UserName = Convert.ToString(dt.Rows[0]["vchrUserName"]); UInfo.UserID = Convert.ToInt64(dt.Rows[0]["intRegistrationId"]); int TypeId = Convert.ToInt32(dt.Rows[0]["intUserTypeID"]); Session.Add("UserTypeId", TypeId); Session.Add("UInfo", UInfo); Session.Add("LoginName", LoginName); Session.Add("ExternalUserId", Convert.ToString(dt.Rows[0]["intRegistrationId"])); objLogin.intRegistartionID = Convert.ToInt32(dt.Rows[0]["intRegistrationId"]); objLoginDB.AddAndGetLoginDetails(objLogin, DA_SKORKEL.DA_Login.Login_1.Login); if (ISAPIURLACCESSED != "0") { try { string ip = Request.ServerVariables["HTTP_X_FORWARDED_FOR"]; if (ip == null) { ip = Request.ServerVariables["REMOTE_ADDR"]; } String url = APIURL + "userLogin.action?" + "loginUid=" + dt.Rows[0]["intUserTypeID"] + dt.Rows[0]["intRegistrationId"] + "&loginId=" + dt.Rows[0]["intRegistrationId"] + "&password="******"&loginTime=" + DateTime.Now + "&sessionId=" + HttpContext.Current.Session.SessionID; HttpWebRequest myRequest1 = (HttpWebRequest)WebRequest.Create(url); myRequest1.Method = "GET"; if (ISAPIResponse != "0") { WebResponse myResponse1 = myRequest1.GetResponse(); StreamReader sr = new StreamReader(myResponse1.GetResponseStream(), System.Text.Encoding.UTF8); String result = sr.ReadToEnd(); objAPILogDO.strURL = url; objAPILogDO.strAPIType = "User Login"; objAPILogDO.strResponse = result; objAPILogDO.strIPAddress = ip; objAPILogDO.intAddedBy = Convert.ToInt32(ViewState["UserID"]); objAPILogDA.AddEditDel_Scrl_APILogDetailsTbl(objAPILogDO, DA_Scrl_APILogDetailsTbl.Scrl_APILogDetailsTbl.Insert); } } catch { } } Response.Redirect("Home.aspx?ActiveStatus=P"); //Response.Redirect("Signup3.aspx"); } else { divLogin.Style.Add("display", "block"); Login1.FailureText = "Invalid email or password."; openLoginPopup(); } }