+ Post New Thread
Results 1 to 3 of 3
Coding Thread, Permissions issue preventing inception of greatest time saving webpage ever in Coding and Web Development; To save teachers, pupils and our time changing kids domain passwords. Code: <% 'on error resume next strUser = "{domain ...
  1. #1
    browolf's Avatar
    Join Date
    Jun 2005
    Location
    Mars
    Posts
    1,497
    Thank Post
    101
    Thanked 84 Times in 71 Posts
    Blog Entries
    46
    Rep Power
    37

    Permissions issue preventing inception of greatest time saving webpage ever

    To save teachers, pupils and our time changing kids domain passwords.

    Code:
    <%
    
    
    'on error resume next
    
    strUser                 = "{domain admin account}"
    strPword                = "{password}"
    Const ADS_SECURE_AUTHENTICATION = &H1
    const ADS_SERVER_BIND= &H200
    Const ForReading = 1, ForWriting = 2
    
    username=request.querystring("username")
    email=request.querystring("email")
    
    
    set oDSP = GetObject("LDAP:")
    set ouser = oDSP.OpenDSObject("LDAP://cn=" & username & ",ou=pupils,dc=domain,dc=lancs,dc=sch,dc=uk",strUser,strPword,ADS_SECURE_AUTHENTICATION and ADS_SERVER_BIND)
    
    fullname=ouser.displayname
    descriptionx=ouser.description
    
    if fullname>"" then 
    
    
    %>
    
    
    <h1>Processing password change for <%=fullname%></h1>
    <h4><i>(<%=descriptionx%>)</i></h3>
    
    
    <%
    	'formulate password
    	Randomize
    	dim myvalue,passcol
    	MyValue = Int((10 * Rnd) + 1)
    	select case myvalue
    		case "1"  passcol = "orange"
    		case "2"  passcol = "red"
    		case "3"  passcol = "green"
    		case "4"  passcol = "monkey"
    		case "5"  passcol = "blue"
    		case "6"  passcol = "cabbage"
    		case "7"  passcol = "donkey"
    		case "8"  passcol = "purple"
    		case "9"  passcol = "orange"
    		case "10"  passcol = "pink"
    	end select
    	Randomize
    	dim mynum
    	Mynum = Int((999 * Rnd) + 1)
    	password = passcol & mynum
    
    	response.write password & "<br>"
    	'response.write Request.ServerVariables("REMOTE_USER")
    	
    	ouser.setpassword(password)
    	'ouser.put "userPassword", password
    	'ouser.setinfo
    	
    	
    %>
    
    
    
    
    
    
    
    
    
    
    <% else %>
    
    
    <h1>Error Occurred: Send pupil to T13</h1>
    
    <%end if%>

  2. #2

    Steve21's Avatar
    Join Date
    Feb 2011
    Location
    Swindon
    Posts
    2,654
    Thank Post
    324
    Thanked 506 Times in 474 Posts
    Rep Power
    177
    Out of curiosity, Wouldn't this give the "teachers?" (assuming this is who the webpage goes to) full control to change any users password? Just by changing the "ou=pupils" ? Or does all that part stay hidden? (Newbie at websites)

    Steve

  3. #3
    browolf's Avatar
    Join Date
    Jun 2005
    Location
    Mars
    Posts
    1,497
    Thank Post
    101
    Thanked 84 Times in 71 Posts
    Blog Entries
    46
    Rep Power
    37
    whoops pressed post before I'd explained the problem, and then a bunch of people turned up and I couldn't get back it.

    if I don't use ads_server_bind, I get permission denied on the password line.
    if I do use ads_server_bind I have the error "One or more input parameters are invalid " on the password change line.

    these both occur despite successfully opening and querying the user object with the embedded domain admin account. displayname and description are successfully retrieved and displayed.

    I need it to change the password using the credentials given and for it not to try and use any others that might give permission errors. Teachers don't have change password permissions but the whole purpose of the design is that they don't need it. The bit I haven't written yet is when the new password is emailed to them not shown on the screen. I read tonnes of web pages on the matter but haven't found anything particularly helpful. any ideas?


    @Steve21. the asp code part is processed on the server and not included in the webpage delivered to the user.

SHARE:
+ Post New Thread

Similar Threads

  1. Replies: 3
    Last Post: 3rd April 2011, 06:20 PM
  2. Preventing saving to desktop on roaming profiles
    By Gibbo in forum How do you do....it?
    Replies: 4
    Last Post: 12th January 2011, 11:09 AM
  3. Preventing users saving to temp files?
    By Tegwin in forum Windows
    Replies: 2
    Last Post: 8th March 2010, 11:59 AM
  4. Ntfs permissions on webpage
    By Jobos in forum Web Development
    Replies: 0
    Last Post: 28th November 2009, 06:21 PM
  5. Issue saving under Win XP SP3 RC?
    By TheCrust in forum Windows
    Replies: 7
    Last Post: 29th January 2008, 05:47 PM

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •