Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Am not sure how to pass OU name to a variable in HTML.
- Below is my HTML code:
- <!-- DetailsForm -->
- <body>
- <div class =Welcome to Active Directory user portal</div>
- <form action="/user_creation" method="POST">
- <fieldset>
- <legend>Kindly Enter Details to Create User</legend><br>
- <input name="Organizationalunit" type="text" value="" placeholder="OrganizationalUnit" required/><br><br>
- <input name="First-Name" type="text" value="" placeholder="First-Name" required/><br><br>
- <input name="Initials" type="text" value="" placeholder="Initials" required/><br><br>
- <input name= "Password" type="text" value="" placeholder="Password" required /><br><br>
- <input name="Display-Name" type="text" value="" placeholder="Display-Name" required /><br><br>
- <input name= "Email" type="mail" value="" placeholder="Email" /><br><br>
- <input type="submit" value="Proceed" />
- </fieldset>
- </form>
- </div>
- </body>
- @app.route('/user_creation',methods=['GET','POST'])
- def user_create():
- if(request.method=='POST'):
- OrgU=str(request.form['Organizationalunit'])
- FirstName=str(request.form['First-Name'])
- Initial=str(request.form['Initials'])
- Password=str(request.form['Password'])
- DisplayName=str(request.form['Display-Name'])
- Email=str(request.form['Email'])
- pyad.set_defaults(ldap_server="XXX.com", username="DomainXXXX", password="123")
- ou = pyad.adcontainer.ADContainer.from_dn("OrgU")
- new_user = pyad.aduser.ADUser.create("FirstName", ou, password="Password")
- if(new_user):
- #flash("user created successfully")
- user=pyad.from_cn("new_user")
- user.force_pwd_change_on_login()
- user.update_attribute("displayName","DisplayName")
- user.update_attribute("initials","Initial")
- if(Email !='Null'):
- user.update_attribute("mail","Email")
- #flash("Attributes updated",'success')
- return "user created successfully" + "<b><a href = '/user_creation'>click here to return to Input page</a></b>"
- else:
- return "Some error " + "<b><a href = '/user_creation'>click here to return to Input page</a></b>"
- When i enter OU name in field, am getting below error:
- Appreciate help on th
- Error:_ds = self.adsi_provider.getObject('', "LDAP:
- File "<COMObject ADsNameSpaces>", line 2, in getObject
- pywintypes.com_error: (-2147352567, 'Exception occurred.', (0, None, None, None, 0, -2147221020), None)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement