Exemplo n.º 1
0
        //jobseeker password or admin 2
        public void Chgpwdjswkey(string keyval, string pwds)
        {
            //recalc password hash
            var clpdh = new ClPwdhash();

            var hashedpwd = clpdh.GetMd5Hash(pwds);

            //
            using (var con = new MySqlConnection())
            {
                con.ConnectionString = Dlconnect.Makeconn();
                con.Open();

                using (var com = con.CreateCommand())
                {
                    com.CommandType = CommandType.Text;
                    com.CommandText = "UPDATE users set uPassword = '******' where uPasswordresetcode= '" +
                                      keyval + "' and uUserType = 2; ";

                    com.Parameters.Add("@keyval", MySqlDbType.VarChar).Value = keyval;

                    int reslt = com.ExecuteNonQuery();
                }

                con.Close();
            }
        }
Exemplo n.º 2
0
        protected void Button1_Click(object sender, EventArgs e)
        {
            //insert into the usertable random key
            //recalc password hash
            var clpdh = new ClPwdhash();
            var rnd   = new Random();

            string hashedpwd = clpdh.GetMd5Hash(rnd.Next(10, 1000).ToString(CultureInfo.InvariantCulture));

            //one goes to email as hashvalue.
            var cemp = new DlEmailprocessor();

            string ebody = string.Empty;

            //second inserts into the db.
            var clog = new DlLogins();

            if (CheckBox1.Checked)
            {
                clog.Chgkeyrec(TextBox1.Text, hashedpwd);

                ebody =
                    cemp.Emailpwdnotify("https://ahrcloud.com/PwdChange.aspx?keyid=" + hashedpwd + "&utype=" + 1,
                                        TextBox1.Text).ToString();

                cemp.Clemail.Sendmailproc(TextBox1.Text, "ahrcloud: Password Reset", ebody, 2);

                //logg it as the entry for email
                cemp.Sendappemaildbupdate(TextBox1.Text, 2);
            }

            else
            {
                clog.Chgkeyuser(TextBox1.Text, hashedpwd);

                ebody =
                    cemp.Emailpwdnotify("https://ahrcloud.com/PwdChange.aspx?keyid=" + hashedpwd + "&utype=" + 2,
                                        TextBox1.Text).ToString();

                cemp.Clemail.Sendmailproc(TextBox1.Text, "ahrcloud: Password Reset", ebody, 2);

                //logg it as the entry for email
                cemp.Sendappemaildbupdate(TextBox1.Text, 2);
            }
        }
Exemplo n.º 3
0
        //this is admin user
        //1 is admin
        public string Getuser(string userns, string pwds)
        {
            var connreader = new MySqlConnection {
                ConnectionString = Dlconnect.Makeconn()
            };

            //get hashcode
            //
            var passhash = new ClPwdhash();

            //string to hold data
            var tmphld = string.Empty;

            using (connreader)
            {
                var command =
                    new MySqlCommand(
                        "SELECT uUsername FROM users where upassword = '******' and uusername='******' and uusertype = 1; ", connreader);
                connreader.Open();

                var reader = command.ExecuteReader();

                if (reader.HasRows)
                {
                    while (reader.Read())
                    {
                        tmphld = reader.GetString(0);
                    }
                }
                else
                {
                    return(null);
                }
                reader.Close();
            }

            return(tmphld);
        }
Exemplo n.º 4
0
        //this is admin user
        //1 is admin
        public string Getuser(string userns, string pwds)
        {
            var connreader = new MySqlConnection { ConnectionString = Dlconnect.Makeconn() };

            //get hashcode
            //
            var passhash = new ClPwdhash();

            //string to hold data
            var tmphld = string.Empty;

            using (connreader)
            {
                var command =
                    new MySqlCommand(
                        "SELECT uUsername FROM users where upassword = '******' and uusername='******' and uusertype = 1; ", connreader);
                connreader.Open();

                var reader = command.ExecuteReader();

                if (reader.HasRows)
                {
                    while (reader.Read())
                    {
                        tmphld = reader.GetString(0);
                    }
                }
                else
                {
                    return null;
                }
                reader.Close();
            }

            return tmphld;
        }
Exemplo n.º 5
0
        //change passwords with keys.....
        //change passwords
        //rec password or admin 1
        public void Chgpwdrecwkey(string keyval, string pwds)
        {
            //recalc password hash
            var clpdh = new ClPwdhash();

            var hashedpwd = clpdh.GetMd5Hash(pwds);

            //
            using (var con = new MySqlConnection())
            {
                con.ConnectionString = Dlconnect.Makeconn();
                con.Open();

                using (var com = con.CreateCommand())
                {
                    com.CommandType = CommandType.Text;
                    com.CommandText = "UPDATE users set uPassword = '******' where upasswordresetcode= '" +
                                      keyval + "' and uUserType = 1;";

                    com.Parameters.Add("@keyval", MySqlDbType.VarChar).Value = keyval;

                    int reslt = com.ExecuteNonQuery();
                }

                con.Close();
            }
        }