1
0
mirror of https://github.com/haiwen/seahub.git synced 2025-09-02 07:27:04 +00:00

Modify registration flow, add new flag into settings.py

* when ACTIVATE_AFTER_REGISTRATION set to True, user will be activated after registration, and no email sending;
* when ACTIVATE_AFTER_REGISTRATION set to False, and REGISTRAION_SEND_EMAIL set to True, user will be activated by email;
* when ACTIVATE_AFTER_REGISTRATION set to False, and REGISTRAION_SEND_EMAIL set to Flase, user will be activated by admin.
This commit is contained in:
xiez
2012-04-21 13:58:55 +08:00
parent 00f9575c74
commit 325d39a288
3 changed files with 28 additions and 12 deletions

View File

@@ -209,13 +209,21 @@ class RegistrationBackend(object):
else:
site = RequestSite(request)
new_user = RegistrationProfile.objects.create_active_user(username, email,
password, site,
send_email=settings.REGISTRATION_SEND_MAIL)
# login the user
new_user.backend='auth.backends.ModelBackend'
login(request, new_user)
if settings.ACTIVATE_AFTER_REGISTRATION == True:
# since user will be activated after registration,
# so we will not use email sending, just create acitvated user
new_user = RegistrationProfile.objects.create_active_user(username, email,
password, site,
send_email=False)
# login the user
new_user.backend='auth.backends.ModelBackend'
login(request, new_user)
else:
# create inactive user, user can be activated by admin, or through activated email
new_user = RegistrationProfile.objects.create_inactive_user(username, email,
password, site,
send_email=settings.REGISTRATION_SEND_MAIL)
userid = kwargs['userid']
if userid: