protected void btnLogin_Click(object sender, EventArgs e) { try { string strAdminId = string.Empty; lblMsg.Text = ""; PasswordRestrictions pwdRestrict = new PasswordRestrictions(); string strPass = pwdRestrict.encryptPassword(txtAdminPassword.Text); //Code to encrypt the password. //string depas = pwdRestrict.decryptPassword(txtAdminPassword.Text); DataSet dsAdminLogin = dbloginInfo.GetLoginInfo(txtAdminEmail.Text, strPass); //To fetch admin id from database with the username and password provided by user. if (dsAdminLogin.Tables[0].Rows.Count > 0) { if (dsAdminLogin != null && dsAdminLogin.Tables.Count > 0 && dsAdminLogin.Tables[0].Rows.Count > 0) { foreach (DataRow drLogin in dsAdminLogin.Tables[0].Rows) { strAdminId = Convert.ToString(drLogin["admin_id"]); createCookie(strAdminId); Response.Redirect("index3.aspx", false); } } } else { lblMsg.Text = AppConstants.loginFailed; lblMsg.ForeColor = System.Drawing.Color.Red; txtAdminEmail.Text = ""; txtAdminPassword.Text = ""; } } catch (Exception ex) { Response.Write(ex.Message); } }
protected void btnLogin_Click(object sender, EventArgs e) { try { string strUserId = string.Empty; string strUserName = string.Empty; lblMsg.Text = ""; //string strPass = string.Empty; PasswordRestrictions pwdRestrict = new PasswordRestrictions(); string strPass = pwdRestrict.encryptPassword(txtPassword.Text); //Code to encrypt the password. // string strPass = pwdRestrict.decryptPassword(txtPassword.Text);//Code to encrypt the password. DataSet dsLogin = dbInfo.GetUserLoginInfo(txtEmail.Text, strPass); //To fetch admin id from database with the username and password provided by user. if (dsLogin.Tables[0].Rows.Count > 0) { if (dsLogin != null && dsLogin.Tables.Count > 0 && dsLogin.Tables[0].Rows.Count > 0) { foreach (DataRow drLogin in dsLogin.Tables[0].Rows) { strUserId = Convert.ToString(drLogin["users_id"]); strUserName = Convert.ToString(drLogin["users_fname"]) + " " + Convert.ToString(drLogin["users_lname"]); Session["LoginUserName"] = strUserName; createCookie(strUserId); Response.Redirect("product_order.aspx", false); //Response.Redirect(ConfigurationSettings.AppSettings["strHTTPSLinkProductOrder"], false); } } } else { lblMsg.Text = ""; lblMsg.Text = AppConstants.userLoginFailed; lblMsg.ForeColor = System.Drawing.Color.Red; txtEmail.Text = ""; txtPassword.Text = ""; } dbInfo.dispose(); } catch (Exception ex) { Response.Write(ex.Message); } }
private bool IsEnabledCan(PasswordRestrictions restrictions) { return((CanContains & restrictions) == restrictions); }
private bool IsEnabledShould(PasswordRestrictions restrictions) { return((ShouldContains & restrictions) == restrictions); }