def main(): try: form = CGIgetForm() user = CGIlogin(form) if user == "admin" or user in GetSupervisors(): if form.has_key("username"): username = form["username"].lower() if username in GetEditors(): raise CalendarError, "Username already used." e = Editor(username) else: raise CalendarError, "No username specified" e.user = username if form.has_key("firstname") and form.has_key("lastname"): e.firstname = form["firstname"] e.lastname = form["lastname"] e.name = e.firstname + " " + e.lastname else: raise CalendarError, "No full name specified" #Set an initial password at random e.password = SetPassword() e.Store() print e.EditorPage() else: print LoginPage("Not authorized for this operation", script="AddEditor.py", form=form) except CalendarError, errorText: print AdminPage(errorText)
def main(): try: form = CGIgetForm() user = CGIlogin(form, printHeader=False) e = Editor(form["username"]) if user == e.user or user == "admin" or user in GetSupervisors(): if form["newpassword"]: e.password = form["newpassword"].strip() if form["verification"]: if form["verification"].strip() == e.password: message = "Password successfully changed." e.Store() if user == e.user: print MakeCookie (user, e.password) else: message = \ "Password not changed as the two entries did not match." CGIprintHeader() print e.EditorPage(message) else: print LoginPage(script="ChangePassword.py", form=form) except CalendarError, errorText: print ErrorPage(errorText)
def main(): try: form = CGIgetForm() user = CGIlogin(form, printHeader=False) e = Editor(form["username"]) if user == e.user or user == "admin" or user in GetSupervisors(): if form["newpassword"]: e.password = form["newpassword"].strip() if form["verification"]: if form["verification"].strip() == e.password: message = "Password successfully changed." e.Store() if user == e.user: print MakeCookie(user, e.password) else: message = \ "Password not changed as the two entries did not match." CGIprintHeader() print e.EditorPage(message) else: print LoginPage(script="ChangePassword.py", form=form) except CalendarError, errorText: print ErrorPage(errorText)