- Timestamp:
- 26 Apr 2009, 12:07:48 (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
waeup/branches/ulif-rewrite/src/waeup/authentication.txt
r4086 r4092 24 24 >>> browser.handleErrors = False 25 25 26 Accessing the front page 27 ======================== 26 Creating users (principals) 27 =========================== 28 29 Before we can login, we have to provide a user (``principal`` in Zope 30 terms). On the API level we can so by looking up a 31 UserAuthenticationUtility named ``users``: 32 33 >>> from zope.component import getUtility 34 >>> from zope.app.authentication.interfaces import IAuthenticatorPlugin 35 >>> authenticator = getUtility(IAuthenticatorPlugin, name=u'users') 36 37 This plugin also enables us to add new users. At least a username and 38 a password is required: 39 40 >>> authenticator.addUser('bob', 'bobssecret') 41 42 We can also add complete `Account` objects. An `Account` stores the 43 user credentials and some metadata persistently: 44 45 >>> from waeup.authentication import Account 46 >>> alice = Account('alice', 'alicesecret') 47 >>> authenticator.addAccount(alice) 48 49 50 Logging in via side bar 51 ======================= 28 52 29 53 We can access the front page without restrictions: … … 33 57 200 Ok 34 58 35 There is a login form on the fron page sidebar:59 There is a login form on the front page sidebar: 36 60 37 61 >>> 'form.login' in browser.contents … … 43 67 >>> browser.getControl(name='form.password').value = 'grok' 44 68 >>> browser.getControl('Login').click() 69
Note: See TracChangeset for help on using the changeset viewer.