currentfeature/docs
Last change
on this file since 6d9d4a5 was
76ebb1b,
checked in by Borja Lopez <borja@…>, 5 years ago
|
(#29) Add user verification by email on signup.
From now on, when a new user signs up, we set the account into an "unverified"
state. In order to complete the signup procedure, the user has to click on a
link we send by email to the email address provided on signup.
IMPORTANT: A new dependency has been added, pyramid_mailer, so remember to
install it in any existing openworkouts environment (this is done automatically
if you use the ./bin/start script):
pip install pyramid_mailer
|
-
Property mode set to
100644
|
File size:
871 bytes
|
Line | |
---|
1 | |
---|
2 | def migrate(root): |
---|
3 | """ |
---|
4 | Adds the verified and verification token attributesfor all existing users, |
---|
5 | setting verified to True (verifying all users automatically) |
---|
6 | |
---|
7 | >>> from ow.models.root import OpenWorkouts |
---|
8 | >>> from ow.models.user import User |
---|
9 | >>> root = OpenWorkouts() |
---|
10 | >>> user = User(email='user@example.net') |
---|
11 | >>> assert getattr(user, 'verified', None) is not None |
---|
12 | >>> delattr(user, 'verified') |
---|
13 | >>> assert getattr(user, 'verified', None) is None |
---|
14 | >>> root.add_user(user) |
---|
15 | >>> assert getattr(user, 'verified', None) is None |
---|
16 | >>> migrate(root) |
---|
17 | >>> user = root.users[0] |
---|
18 | >>> assert getattr(user, 'verified', None) is not None |
---|
19 | >>> assert user.verified |
---|
20 | """ |
---|
21 | for user in root.users: |
---|
22 | if getattr(user, 'verified', None) is None: |
---|
23 | user.verified = True |
---|
24 | user.verification_token = None |
---|
Note: See
TracBrowser
for help on using the repository browser.