DZone Snippets is a public source code repository. Easily build up your personal collection of code snippets, categorize them with tags / keywords, and share them with the world

Snippets has posted 5883 posts at DZone. View Full User Profile

Simple ASP Page To Reset Passwords

09.20.2007
| 8183 views |
  • submit to reddit
        // This page allows to reset an AD account password.
<HTML><HEAD><TITLE>Reinitialisation de mot de passe</TITLE>
<META http-equiv=Content-Type content="text/html; charset=iso-8859-1"><LINK 
href="files/v2006.css" type=text/css rel=stylesheet>
<BODY leftMargin=0 topMargin=30 marginwidth="0" marginheight="0">
<FORM method=post>
<CENTER>
<TABLE cellSpacing=0 cellPadding=1 width=500 align=center bgColor=#26333e 
border=0>
  <TBODY>
  <TR>
    <TD>
      <TABLE cellSpacing=0 cellPadding=1 width=500 align=center border=0>
        <TBODY>
        <TR bgColor=#f0f3f5>
          <TD width=160><IMG height=116 src="files/man_portable.jpg" 
            width=160> </TD>
          <TD width=302 bgColor=#e5ebef>
            <TABLE cellSpacing=4 cellPadding=4 width="100%" align=center 
            border=0>
              <TBODY>
              <TR>
                <TD class=medium colSpan=3 height=22>
                <%
                If Request.Form("login") = "" Then
                	Response.Write("<B>Saisir le compte à reinitialiser</B>")
                Else
                    Dim Group, Member, Domain, UserFound
                    ' 
                    Domain ="FR-ERM"
                    '
                    UserFound=0
                    
	                Set Group = GetObject("WinNT://" & Domain & "/Domain Users")
    	            For Each Member In Group.Members
    	            	' Response.Write(Member.Name & "<BR>")
        	        	If UCase(Member.Name) = UCase(Request.Form("login")) Then
        	        		UserFound=1
        	        		If Member.AccountDisabled Then 
        	        			Response.Write(" " & Request.Form("login") &" est un compte desactive</B>")
        	        			Exit For
        	        		Else
        	        			' Essai de reinit de mot de passe
        	        			Dim res
        	        			res=Member.SetPassword(Request.Form("pass"))
        	        			'Member.Put "pwdLastSet", CLng(0)
        	        			Member.Put "PasswordExpired", 1
								Member.SetInfo
        	        			Response.Write("<B>L'utilisateur "& Request.Form("login") & " a changé de mot de passe !<BR><BR></B>Il devra changer de mot de passe au prochain login.")
        	        			Exit For
        	        		End If
        	        	End If 
            	    Next      
       	        	If UserFound = 0 Then
       	        		Response.Write(Request.Form("login") &" non trouvé dans le domaine "& Domain)
       	        	End If           	            	
                	
                End If
                %>
              
                </TD></TR>
              <TR>
                <TD class=td11 width="1%" height=22>Identifiant
               
                </TD>
                <TD class=td11 colSpan=2>Nouveau mot de passe</TD></TR>
              <TR>
                <TD width="25%"><INPUT maxLength=20 name=login>
 
                </TD>
                <TD width="20%"><INPUT type=password maxLength=10 size=10 
                  name=pass> </TD>
                <TD><INPUT type=image height=18 alt="Reset !" width=15 
                  src="files/submit.gif" value=login border=0 name=ok> 
                </TD></TR></TBODY></TABLE></TD></TR></TBODY></TABLE></TD></TR></TBODY></TABLE></CENTER></FORM></BODY></HTML>