protected bool CustomerLogin(string login, string pass) { DA_Login Log = new DA_Login(); DataTable dt = new DataTable(); objLogin.Username = login; objLogin.Password = pass; dt = objLoginDB.GetDataSet(objLogin, DA_SKORKEL.DA_Login.Login_1.GmailFBLogin); if (dt.Rows.Count > 0) { 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"])); return(true); } else { return(false); } }
protected bool CustomerLogin(string login, string pass) { DA_Login Log = new DA_Login(); DataTable dt = new DataTable(); objLogin.Username = login; objLogin.Password = pass; dt = objLoginDB.GetDataSet(objLogin, DA_SKORKEL.DA_Login.Login_1.GmailFBLogin); if (dt.Rows.Count > 0) { //if (login == "") //{ 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"])); //Response.Redirect("~/Profile/SkorkelSearch.aspx?Content=" + txtSearchScorkel.Text.Trim()); //} return(true); } else { return(false); } }
protected void Page_Load(object sender, EventArgs e) { string oauth_token = Request.QueryString["oauth_token"]; string oauth_verifier = Request.QueryString["oauth_verifier"]; if (oauth_token != null && oauth_verifier != null) { Application["oauth_token"] = oauth_token; Application["oauth_verifier"] = oauth_verifier; Response.Redirect("LinkedInAccountDetails.aspx?oauth_verifier=" + oauth_verifier + ""); } if (!IsPostBack) { //////svn string login = ""; try { login = Request.QueryString["Login"].ToString(); } catch { login = ""; } if (Request.Cookies["myScrlCookie"] != null) { HttpCookie myScrlCookie = new HttpCookie("myScrlCookie"); myScrlCookie = Request.Cookies.Get("myScrlCookie"); Login1.UserName = myScrlCookie.Values["UserName"].ToString(); TextBox txtbox = (TextBox)Login1.FindControl("Password"); txtbox.Attributes["Value"] = myScrlCookie.Values["Password"].ToString(); DataTable dt = new DataTable(); objLogin.Username = Login1.UserName; objLogin.Password = txtbox.Attributes["Value"]; dt = objLoginDB.GetDataSet(objLogin, DA_SKORKEL.DA_Login.Login_1.UserLogin); if (dt.Rows.Count > 0) { if (login == "") { 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"])); //Response.Redirect("Home.aspx"); } } } } }
protected void GetUserEmailId() { string ip = Request.ServerVariables["HTTP_X_FORWARDED_FOR"]; dt = new DataTable(); objLogin.intRegistartionID = Convert.ToInt32(ViewState["RegOutId"]); dt = objLoginDB.GetDataTable(objLogin, DA_SKORKEL.DA_Login.Login_1.UserDetails); if (dt.Rows.Count > 0) { 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"]); if (ISAPIURLACCESSED == "1") { String UserURL = APIURL + "registerUser.action?" + "uid=" + Convert.ToString(dt.Rows[0]["intRegistrationId"]) + "&userId=" + Convert.ToString(dt.Rows[0]["vchrUserName"]) + "&password="******"vchrPassword"]) + "&firstName=" + Convert.ToString(dt.Rows[0]["vchrFirstName"]) + "&lastName=" + Convert.ToString(dt.Rows[0]["vchrLastName"]) + "&userType=STUDENT" + "&userContextIds=" + null + "&friendUserIds=" + null + "&lawRelated=" + null; try { HttpWebRequest myRequest1 = (HttpWebRequest)WebRequest.Create(UserURL); myRequest1.Method = "GET"; WebResponse myResponse1 = myRequest1.GetResponse(); StreamReader sr = new StreamReader(myResponse1.GetResponseStream(), System.Text.Encoding.UTF8); String result = sr.ReadToEnd(); objAPILogDO.strURL = UserURL; objAPILogDO.strAPIType = "Student"; objAPILogDO.strResponse = result; if (ip == null) { objAPILogDO.strIPAddress = Request.ServerVariables["REMOTE_ADDR"]; } objAPILogDA.AddEditDel_Scrl_APILogDetailsTbl(objAPILogDO, DA_Scrl_APILogDetailsTbl.Scrl_APILogDetailsTbl.Insert); } catch (Exception ex) { ex.Message.ToString(); } } Session.Add("UserTypeId", TypeId); Session.Add("UInfo", UInfo); Session.Add("LoginName", LoginName); Session.Add("ExternalUserId", Convert.ToString(dt.Rows[0]["intRegistrationId"])); Response.Redirect("Home.aspx"); } }
protected void LoginButton_Click(object sender, EventArgs e) { string strPasswordmd5 = ""; DataTable dt = new DataTable(); objLogin.Username = Login1.UserName; string pass = hdnEncpass.Value; 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 (strPasswordmd5 == pass) { 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_Testing.aspx"); Response.Redirect("SA_JournalListing.aspx"); } else { Login1.FailureText = "Invalid user."; divLogin.Style.Add("display", "block"); } } else { Login1.FailureText = "Invalid user."; divLogin.Style.Add("display", "block"); } }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { string login = ""; try { login = Convert.ToString(Request.QueryString["Login"]); } catch { login = ""; } if (Request.Cookies["myScrlCookieSA"] != null) { HttpCookie myScrlCookieSA = new HttpCookie("myScrlCookieSA"); myScrlCookieSA = Request.Cookies.Get("myScrlCookieSA"); Login1.UserName = myScrlCookieSA.Values["UserName"].ToString(); TextBox txtbox = (TextBox)Login1.FindControl("Password"); txtbox.Attributes["Value"] = myScrlCookieSA.Values["Password"].ToString(); DataTable dt = new DataTable(); objLogin.Username = Login1.UserName; objLogin.Password = txtbox.Attributes["Value"]; dt = objLoginDB.GetDataSet(objLogin, DA_SKORKEL.DA_Login.Login_1.UserLogin); if (dt.Rows.Count > 0) { if (login == "") { 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"])); } } } } }
protected void GetGmailLogInDetails() { string ip = Request.ServerVariables["HTTP_X_FORWARDED_FOR"]; string code = Request.QueryString["code"]; var token = "https://www.googleapis.com/oauth2/v3/token?code=" + code + "&redirect_uri=" + GoogleRedirectUrl + "&client_id=" + GoogleClientId + "&scope=&client_secret=" + GoogleClientSecret + "&grant_type=authorization_code"; HttpClient client = new HttpClient(); var request = WebRequest.Create(token); request.Headers.Add("Authorization", ""); request.Method = "POST"; try { var requestStream = request.GetRequestStream(); var responses = request.GetResponse(); using (var responseStream = responses.GetResponseStream()) { var reader = new StreamReader(responseStream); var responseText = reader.ReadToEnd(); AccessTok m = JsonConvert.DeserializeObject <AccessTok>(responseText); Acesss_token = m.Access_Token; } Response.Close(); } catch (WebException ex) { if (Session["ExternalUserId"] != null) { Response.Redirect("Home.aspx"); } ex.Message.ToString(); } var GplusUserInfo = "https://www.googleapis.com/plus/v1/people/me?access_token=" + Acesss_token; try { if (GplusUserInfo != string.Empty) { HttpWebRequest requests = (HttpWebRequest)WebRequest.Create(GplusUserInfo); requests.Method = "GET"; requests.ContentLength = 0; HttpWebResponse response = (HttpWebResponse)requests.GetResponse(); if (response.StatusCode.ToString().ToLower() == "ok") { string contentType = response.ContentType; Stream content = response.GetResponseStream(); if (content != null) { StreamReader contentReader = new StreamReader(content); Response.ContentType = contentType; var responseText = contentReader.ReadToEnd(); GoogleProfile Gplus = JsonConvert.DeserializeObject <GoogleProfile>(responseText); string gender = Gplus.gender; string Email = Gplus.Emails.Find(email => email.Type == "account").Value; string name = Gplus.displayName; string[] words = name.Split(' '); string FirstName = words[0]; string Lastname = words[1]; DA_Registrationdetails objRegistrationDB = new DA_Registrationdetails(); DO_Registrationdetails objRegistration = new DO_Registrationdetails(); DataTable dt = new DataTable(); objLogin.Username = Email; dt = objLoginDB.GetDataSet(objLogin, DA_SKORKEL.DA_Login.Login_1.GmailFBLogin); if (dt.Rows.Count == 0) { string password = GeneratePassword(); objRegistration.FirstName = FirstName; objRegistration.LastName = Lastname; objRegistration.UserName = Email; objRegistration.Password = password; objRegistration.UserTypeId = 1; if (gender == "male") { objRegistration.Sex = "M"; } else { objRegistration.Sex = "F"; } objRegistrationDB.AddEditDel_RegistrationDetails(objRegistration, DA_Registrationdetails.RegistrationDetails.Add); UserSession.UserInfo UInfo = new UserSession.UserInfo(); UInfo.UserName = Convert.ToString(objRegistration.UserName); UInfo.UserID = Convert.ToInt64(objRegistration.RegOutId); int TypeId = Convert.ToInt32(objRegistration.UserTypeId); Session.Add("UserTypeId", TypeId); Session.Add("UInfo", UInfo); Session.Add("LoginName", name); Session.Add("ExternalUserId", Convert.ToString(objRegistration.RegOutId)); if (ISAPIURLACCESSED == "1") { String UserURL = APIURL + "registerUser.action?" + "uid=" + objRegistration.RegOutId + "&userId=" + objRegistration.UserName + "&password="******"&firstName=" + objRegistration.FirstName + "&lastName=" + objRegistration.LastName + "&userType=STUDENT" + "&userContextIds=" + null + "&friendUserIds=" + null + "&lawRelated=" + null; try { HttpWebRequest myRequest1 = (HttpWebRequest)WebRequest.Create(UserURL); myRequest1.Method = "GET"; WebResponse myResponse1 = myRequest1.GetResponse(); StreamReader sr = new StreamReader(myResponse1.GetResponseStream(), System.Text.Encoding.UTF8); String result = sr.ReadToEnd(); objAPILogDO.strURL = UserURL; objAPILogDO.strAPIType = "Student"; objAPILogDO.strResponse = result; if (ip == null) { objAPILogDO.strIPAddress = Request.ServerVariables["REMOTE_ADDR"]; } objAPILogDA.AddEditDel_Scrl_APILogDetailsTbl(objAPILogDO, DA_Scrl_APILogDetailsTbl.Scrl_APILogDetailsTbl.Insert); } catch (Exception ex) { ex.Message.ToString(); } } activate(); } else { 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"]); //vchrPassword Session.Add("UserTypeId", TypeId); Session.Add("UInfo", UInfo); Session.Add("LoginName", LoginName); Session.Add("ExternalUserId", Convert.ToString(dt.Rows[0]["intRegistrationId"])); } } } } } catch (Exception ex) { ex.Message.ToString(); } finally { if (Session["ExternalUserId"] != null) { Response.Redirect("Home.aspx"); } } }
public void SaveUserDetails() { dtUser = (DataTable)Session["UserDetails"]; if (dtUser.Rows.Count > 0) { string ip = Request.ServerVariables["HTTP_X_FORWARDED_FOR"]; if (ip == null) { ip = Request.ServerVariables["REMOTE_ADDR"]; } objRegistration.IpAddress = ip; objRegistration.FirstName = Convert.ToString(dtUser.Rows[0]["FirstName"]); objRegistration.LastName = Convert.ToString(dtUser.Rows[0]["LastName"]); objRegistration.UserName = Convert.ToString(dtUser.Rows[0]["UserName"]); objRegistration.UserTypeId = Convert.ToInt32(dtUser.Rows[0]["UserTypeId"]); objRegistration.Password = Convert.ToString(dtUser.Rows[0]["Password"]); lblEmail.Text = Convert.ToString(dtUser.Rows[0]["UserName"]); objRegistrationDB.AddEditDel_RegistrationDetails(objRegistration, DA_Registrationdetails.RegistrationDetails.Add); Session["ExternalUserId"] = objRegistration.RegOutId; if (Convert.ToString(ViewState["FromLinkedIn"]) == "1") { UserSession.UserInfo UInfo = new UserSession.UserInfo(); string LoginName = Convert.ToString(dtUser.Rows[0]["FirstName"] + " " + dtUser.Rows[0]["LastName"]); UInfo.UserName = Convert.ToString(dtUser.Rows[0]["UserName"]); UInfo.UserID = Convert.ToInt64(Session["ExternalUserId"]); int TypeId = Convert.ToInt32(dtUser.Rows[0]["UserTypeId"]); Session.Add("UserTypeId", TypeId); Session.Add("UInfo", UInfo); Session.Add("LoginName", LoginName); Session.Add("ExternalUserId", Convert.ToString(Session["ExternalUserId"])); if (ISAPIURLACCESSED == "1") { String UserURL = APIURL + "registerUser.action?" + "uid=" + Convert.ToString(Session["ExternalUserId"]) + "&userId=" + dtUser.Rows[0]["UserName"] + "&password="******"Password"] + "&firstName=" + dtUser.Rows[0]["FirstName"] + "&lastName=" + dtUser.Rows[0]["LastName"] + "&userType=STUDENT" + "&userContextIds=" + null + "&friendUserIds=" + null + "&lawRelated=" + null; try { HttpWebRequest myRequest1 = (HttpWebRequest)WebRequest.Create(UserURL); myRequest1.Method = "GET"; WebResponse myResponse1 = myRequest1.GetResponse(); if (ISAPIResponse != "0") { StreamReader sr = new StreamReader(myResponse1.GetResponseStream(), System.Text.Encoding.UTF8); String result = sr.ReadToEnd(); objAPILogDO.strURL = UserURL; objAPILogDO.strAPIType = "Student"; objAPILogDO.strResponse = result; if (ip == null) { objAPILogDO.strIPAddress = Request.ServerVariables["REMOTE_ADDR"]; } objAPILogDA.AddEditDel_Scrl_APILogDetailsTbl(objAPILogDO, DA_Scrl_APILogDetailsTbl.Scrl_APILogDetailsTbl.Insert); } } catch (Exception ex) { ex.Message.ToString(); } } activate(); if (txtInstituteName.Text == "") { Response.Redirect("Home.aspx"); } } else { SendMail(objRegistration); } } }
protected void LoginUser() { string strPasswordmd5 = ""; DataTable dt = new DataTable(); objLogin.Username = Login1.UserName; string pass = hdnEncpass.Value; TextBox txtboxPass = (TextBox)Login1.FindControl("Password"); TextBox txtboxUser = (TextBox)Login1.FindControl("UserName"); if (Request.Cookies["myScrlCookie"] != null && objLogin.Username == Request.Cookies.Get("myScrlCookie").Values["UserName"].ToString()) { CryptoGraphy objdcryptt = new CryptoGraphy(); HttpCookie myScrlCookie = new HttpCookie("myScrlCookie"); myScrlCookie = Request.Cookies.Get("myScrlCookie"); Login1.UserName = myScrlCookie.Values["UserName"].ToString(); TextBox txtbox = (TextBox)Login1.FindControl("Password"); pass = myScrlCookie.Values["Password"].ToString(); } 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 (strPasswordmd5 == pass) { if (Login1.RememberMeSet == true) { HttpCookie myScrlCookie = new HttpCookie("myScrlCookie"); //Response.Cookies.Remove("myScrlCookie"); 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"])); //Added On 16 March 2020 Session.Add("isScorePrivate", dt.Rows[0]["bitIsScorePrivate"]); 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 { } } if (Convert.ToString(dt.Rows[0]["logintimestamp"]) != null && Convert.ToString(dt.Rows[0]["logintimestamp"]) != "") { Response.Redirect("Home.aspx?ActiveStatus=P"); } else { Response.Redirect("SignUp3.aspx"); } //Response.Redirect("SignUp3.aspx"); } else { // Remeber me cookie Removed TextBox txtbox = (TextBox)Login1.FindControl("Password"); txtbox.Text = string.Empty; Response.Cookies["myScrlCookie"].Expires = DateTime.Now.AddDays(-1); HttpCookie myScrlAppCookie = new HttpCookie("myScrlAppCookie"); myScrlAppCookie.Value = "logout"; myScrlAppCookie.HttpOnly = false; Response.Cookies.Add(myScrlAppCookie); divLogin.Style.Add("display", "block"); //Login1.FailureText = "Invalid user."; Label FailureText = (Label)Login1.FindControl("FailureText"); FailureText.Visible = true; FailureText.Text = "Invalid email or password."; openLoginPopup(); //divSuccess.Style.Add("display", "block"); } } else { divLogin.Style.Add("display", "block"); //Login1.FailureText = "Invalid user."; //divSuccess.Style.Add("display", "block"); Label FailureText = (Label)Login1.FindControl("FailureText"); FailureText.Visible = true; FailureText.Text = "Invalid email or password."; openLoginPopup(); } }
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(); } }