-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 On 10/02/2010 03:32 PM, Ryan McKillen wrote: > I'm using the Quickstart plugin with Pyloins. My auth.py is pasted below. > I'm authenticating against a username filed in my database, but I'd like to > give users the option of logging in with their email address or username. > How can I add an additional authenticator to allow this? Thanks for the > help! > > from repoze.what.plugins.quickstart import setup_sql_auth > from ubercab.model.meta import Session > from ubercab.model.user import User > from ubercab.model.authorization import Group, Permission > def add_auth(app, skip_authentication): > return setup_sql_auth(app, User, Group, Permission, Session, > skip_authentication = skip_authentication, > log_level = 'info', > login_url = '/login', > login_handler = '/authenticate', > post_login_url = '/dashboard', > logout_handler = '/logout', > post_logout_url = '/login', > cookie_secret = 'de9f2c7fd25e1b3afad3e85a0bd17d9b100db4b3', > translations = { > 'user_name': 'username', > 'group_name': 'name', > 'permission_name': 'name' > } > )
I don't know anything about repoze.what.plugins.quickstart, but quick browse of the sources indicates that you need to pass a custom 'form_plugin' to the 'setup_sql_auth' middleware factory. The default if you don't pass one is to construct on instance of the FriendlyForm plugin: in your case, I would probably derive my plugin from that class, and pass in an instance of it. Tres. - -- =================================================================== Tres Seaver +1 540-429-0999 tsea...@palladion.com Palladion Software "Excellence by Design" http://palladion.com -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.10 (GNU/Linux) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/ iEYEARECAAYFAkyocUkACgkQ+gerLs4ltQ4XZwCfQR8VHiiaYmpRyRYuKQQpnVST 5qsAn0Ve6K4nFgwfYZA3T4NZXhOzHqO+ =/7BG -----END PGP SIGNATURE----- _______________________________________________ Repoze-dev mailing list Repoze-dev@lists.repoze.org http://lists.repoze.org/listinfo/repoze-dev