예제 #1
0
 protected void btnsub_Click(object sender, EventArgs e)
 {
     if (txtoldpass.Text != "" && txtnewpass.Text != "" && txtreppass.Text != "")
     {
         if (txtnewpass.Text == txtreppass.Text)
         {
             if (txtreppass.Text.Length >= 8)
             {
                 GenerateHash HashAndSalt    = new GenerateHash();
                 string       GetSalt        = HashAndSalt.CreateSalt(10);
                 string       hashString     = HashAndSalt.GenarateHash(txtnewpass.Text, GetSalt);
                 string       UpdatePassword = Lo.UpdateLoginPassword(hashString, txtoldpass.Text, ObjEnc.DecryptData(Session["User"].ToString()), "LoginOld", txtnewpass.Text, GetSalt);
                 if (UpdatePassword == "true")
                 {
                     divmsg.Visible = false;
                     ScriptManager.RegisterStartupScript(this, this.GetType(), "alert", "SuccessfullPop('Password change successfully.You just changed your password.Please login with your new password we will redirect you to login page');window.location ='Login';", true);
                 }
                 else
                 {
                     divmsg.InnerHtml = "Password not change";
                     divmsg.Attributes.Add("Class", "alert alert-danger");
                     divmsg.Visible = true;
                 }
             }
             else
             {
                 divmsg.InnerHtml = "Minimum Length is (8) charactor";
                 divmsg.Attributes.Add("Class", "alert alert-warning");
                 divmsg.Visible = true;
             }
         }
         else
         {
             divmsg.InnerHtml = "Password not match.";
             divmsg.Attributes.Add("Class", "alert alert-warning");
             divmsg.Visible = true;
         }
     }
     else
     {
         divmsg.InnerHtml = "All field fill mandatory.";
         divmsg.Attributes.Add("Class", "alert alert-warning");
         divmsg.Visible = true;
     }
 }
예제 #2
0
 protected void btncreatepassword_Click(object sender, EventArgs e)
 {
     if (txtpassword.Text != "" && txttnewpass.Text != "")
     {
         if (txtpassword.Text == txttnewpass.Text)
         {
             if (txtpassword.Text.Length >= 8)
             {
                 GenerateHash HashAndSalt = new GenerateHash();
                 string       GetSalt     = HashAndSalt.CreateSalt(10);
                 string       hashString  = HashAndSalt.GenarateHash(txtpassword.Text, GetSalt);
                 string       Updatepass  = Lo.UpdateLoginPassword(hashString, "", ViewState["Refno"].ToString(), "LoginNewVenPass", txtpassword.Text, GetSalt);
                 if (Updatepass == "true")
                 {
                     ViewState["Refno"] = null;
                     txtpassword.Text   = "";
                     txttnewpass.Text   = "";
                     lblogin.Visible    = true;
                     lblmsg.Text        = "Password created successfully.Please click on back to login for login into your account.";
                     ScriptManager.RegisterStartupScript(this, this.GetType(), "modelmsg", "showPopup();", true);
                 }
                 else
                 {
                     lblmsg.Text = "Password not created. Some error occured.";
                     ScriptManager.RegisterStartupScript(this, this.GetType(), "modelmsg", "showPopup();", true);
                 }
             }
             else
             {
                 lblmsg.Text = "Minimum Length is (8) character.";
                 ScriptManager.RegisterStartupScript(this, this.GetType(), "modelmsg", "showPopup();", true);
             }
         }
         else
         {
             lblmsg.Text = "Password mismatch.";
             ScriptManager.RegisterStartupScript(this, this.GetType(), "modelmsg", "showPopup();", true);
         }
     }
     else
     {
         lblmsg.Text = "Enter password.";
         ScriptManager.RegisterStartupScript(this, this.GetType(), "modelmsg", "showPopup();", true);
     }
 }
 protected void btnchangepass_Click(object sender, EventArgs e)
 {
     if (txtpassword.Text != "" && txttnewpass.Text != "")
     {
         if (txtpassword.Text == txttnewpass.Text)
         {
             if (txtpassword.Text.Length >= 8)
             {
                 string       sType       = "LoginNew";
                 GenerateHash HashAndSalt = new GenerateHash();
                 string       GetSalt     = HashAndSalt.CreateSalt(10);
                 string       hashString  = HashAndSalt.GenarateHash(txtpassword.Text, GetSalt);
                 string       Updatepass  = Lo.UpdateLoginPassword(hashString, "", ViewState["Refno"].ToString(), sType, txtpassword.Text, GetSalt);
                 if (Updatepass == "true")
                 {
                     ViewState["Refno"] = null;
                     txtpassword.Text   = "";
                     txttnewpass.Text   = "";
                     ScriptManager.RegisterStartupScript(this, this.GetType(), "alert", "SuccessfullPop('Password created successfully.Please login with new password.We will redirected to you login page');window.location ='Login';", true);
                 }
                 else
                 {
                     ScriptManager.RegisterStartupScript(Page, Page.GetType(), "alert", "ErrorMssgPopup('Password not created. Some error occured.')", true);
                 }
             }
             else
             {
                 ScriptManager.RegisterStartupScript(Page, Page.GetType(), "alert", "ErrorMssgPopup('Minimum Length is (8) character')", true);
             }
         }
         else
         {
             ScriptManager.RegisterStartupScript(Page, Page.GetType(), "alert", "ErrorMssgPopup('Password mismatch')", true);
         }
     }
     else
     {
         ScriptManager.RegisterStartupScript(Page, Page.GetType(), "alert", "ErrorMssgPopup('Enter password')", true);
     }
 }
예제 #4
0
 protected void btnupdate_Click(object sender, EventArgs e)
 {
     if (txtnewpass.Text != "" && pwd.Text != "")
     {
         if (txtnewpass.Text == pwd.Text)
         {
             if (txtnewpass.Text.Length >= 8)
             {
                 GenerateHash HashAndSalt    = new GenerateHash();
                 string       GetSalt        = HashAndSalt.CreateSalt(10);
                 string       hashString     = HashAndSalt.GenarateHash(txtnewpass.Text, GetSalt);
                 string       UpdatePassword = Lo.UpdateLoginPassword(hashString, "", lblPageName.Text, "LoginPasspolicy", txtnewpass.Text, GetSalt);
                 if (UpdatePassword == "true")
                 {
                     lblPageName.Text = "";
                     txtnewpass.Text  = "";
                     pwd.Text         = "";
                     ScriptManager.RegisterStartupScript(this, this.GetType(), "alert", "alert('Password created successfully.Please login with new password.We will redirected to you Login page');window.location ='Login';", true);
                 }
                 else
                 {
                     ScriptManager.RegisterStartupScript(Page, Page.GetType(), "alert", "ErrorMssgPopup('Password is not created. Some error occured.')", true);
                 }
             }
             else
             {
                 ScriptManager.RegisterStartupScript(Page, Page.GetType(), "alert", "ErrorMssgPopup('Minimum Length is (8) character')", true);
             }
         }
         else
         {
             ScriptManager.RegisterStartupScript(Page, Page.GetType(), "alert", "ErrorMssgPopup('Password mismatch')", true);
         }
     }
     else
     {
         ScriptManager.RegisterStartupScript(Page, Page.GetType(), "alert", "ErrorMssgPopup('Enter password')", true);
     }
 }