override protected void Page_Load(object sender, System.EventArgs e) { if (Request.QueryString["inquireAboutRoles"] != null && Request.QueryString["userId"].Length > 0) { AddUserTable.Visible = false; valMsg.Text = "\n\nWould you like to add this user to a group? <a href=\"AdminUserToGroup.aspx?userId=" + Request.QueryString["userId"] + "&newUser=yes\">Yes</a> <a href=\"AdminAddUser.aspx\">No</a>"; } else { base.Page_Load(sender, e); RandomPasswordHolder.Value = PageUtil.GenPassword(6); } // display the ldap search button only if we can successfully connect to LDAP if (CaisisConfiguration.PingLDAP()) { SearchLdapButton.Visible = true; } bool useLDAP = CaisisConfiguration.UseLDAP(); if (useLDAP) { PasswordValidator.Enabled = false; UseLDAPRow.Visible = true; UserPassword.Attributes["class"] = "LDAPGray"; } }
protected override void OnInit(EventArgs e) { // simple case string random = Request.QueryString["random"]; if (!string.IsNullOrEmpty(random) && random.Equals(bool.TrueString, StringComparison.OrdinalIgnoreCase)) { string randomPassword = PageUtil.GenPassword(8); Response.Write(randomPassword); Response.End(); } base.OnInit(e); }
override protected void Page_Load(object sender, System.EventArgs e) { base.Page_Load(sender, e); FormTable.Visible = false; valMsg.Text = ""; SelectUserName.Attributes.Add("onchange", "this.form." + SelectSubmitted.ClientID + ".value = 'true'; this.form.submit();"); string strJScript = "<SCRIPT LANGUAGE=javascript><!-- \n"; strJScript += "function setPassword(){\n"; strJScript += "if(dataForm." + PswdType.ClientID + ".checked == true){;\n"; strJScript += " dataForm." + UserPassword.ClientID + ".value = dataForm." + RandomPasswordHolder.ClientID + ".value;\n"; strJScript += "}\n"; strJScript += "else{\n"; strJScript += "dataForm." + UserPassword.ClientID + ".value = '';\n"; strJScript += "}\n"; strJScript += "}\n"; strJScript += "//--></SCRIPT>"; Page.RegisterStartupScript("xyz", strJScript); if (Page.IsPostBack) { //check if form is submitted from select box or to update password if (Request.Form["SelectSubmitted"] != null && Request.Form["SelectSubmitted"].Equals("true")) { FormTable.Visible = true; RandomPasswordHolder.Value = PageUtil.GenPassword(6); UserPassword.Value = RandomPasswordHolder.Value; PswdType.Attributes.Add("onClick", "setPassword();"); SelectSubmitted.Value = "false"; } } else { this.SetUserDropDown(); } if (UseLDAP) { Passwordvalidator.Enabled = false; UseLDAPRow.Visible = true; UserPassword.Attributes["class"] = "LDAPGray"; } }
private string SetRandomPassword(string emailAddress) { string newPassword = PageUtil.GenPassword(6); string newHashedPswd = FormsAuthentication.HashPasswordForStoringInConfigFile(newPassword, "MD5"); UserDa da = new UserDa(); bool success = da.UpdateForgotPassword(emailAddress, newHashedPswd, "Forgot Password Page"); if (success) { return(newPassword); } else { return("false"); } }
private void RandomizePassword() { NewUserPassword.Text = PageUtil.GenPassword(8); }