Revision 8316698a snf-astakos-app/astakos/im/forms.py
b/snf-astakos-app/astakos/im/forms.py | ||
---|---|---|
54 | 54 |
""" |
55 | 55 |
Extends the built in UserCreationForm in several ways: |
56 | 56 |
|
57 |
* Adds email, first_name and last_name field.
|
|
57 |
* Adds email, first_name, last_name, recaptcha_challenge_field, recaptcha_response_field field.
|
|
58 | 58 |
* The username field isn't visible and it is assigned a generated id. |
59 | 59 |
* User created is not active. |
60 | 60 |
""" |
... | ... | |
134 | 134 |
""" |
135 | 135 |
super(InvitedLocalUserCreationForm, self).__init__(*args, **kwargs) |
136 | 136 |
self.fields.keyOrder = ['email', 'inviter', 'first_name', |
137 |
'last_name', 'password1', 'password2'] |
|
137 |
'last_name', 'password1', 'password2', |
|
138 |
'recaptcha_challenge_field', |
|
139 |
'recaptcha_response_field'] |
|
138 | 140 |
#set readonly form fields |
139 | 141 |
self.fields['inviter'].widget.attrs['readonly'] = True |
140 | 142 |
self.fields['email'].widget.attrs['readonly'] = True |
... | ... | |
144 | 146 |
user = super(InvitedLocalUserCreationForm, self).save(commit=False) |
145 | 147 |
level = user.invitation.inviter.level + 1 |
146 | 148 |
user.level = level |
147 |
user.invitations = INVITATIONS_PER_LEVEL[level] |
|
149 |
user.invitations = INVITATIONS_PER_LEVEL.get(level, 0) |
|
150 |
user.email_verified = True |
|
148 | 151 |
if commit: |
149 | 152 |
user.save() |
150 | 153 |
return user |
Also available in: Unified diff