DarrylA
unread,Sep 10, 2011, 10:38:32 PM9/10/11Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
  to cherrypy-devel
How do I go about submitting a tool for review to be included into the
code base?
I wrote a first-class forms authentication plugin for CherryPy.
Here's how it works:
In your config, you'd add these lines:
tools.auth_forms.on = True
tools.auth_forms.login_url = "/path/to/my/login"
tools.auth_forms.session_key = "STARTREKISGREAT"
In your login page handler, you'd do something like this:
	@cherrypy.expose
	def login(self, username=None, password=None, returnUrl="/"):
		if username is None or password is None:
			return .... login screen template .render(returnUrl = returnUrl)
		error_msg = AuthenticationDB.check_credentials(username, password)
		if error_msg:
			return .... login screen template .render(returnUrl = returnUrl,
errorMsg = error_msg, username = username)
		else:
			HTTPFormsAuthentication.login_and_redirect(username, returnUrl)
	@cherrypy.expose
	def logout(self, returnUrl="/"):
		HTTPFormsAuthentication.logout()
		raise cherrypy.HTTPRedirect(returnUrl)
That's it!  I can send the plugin to whomever.
-DarrylA