diff --git a/base/accounts.py b/base/accounts.py index 0e0027f2af..f6057a6381 100644 --- a/base/accounts.py +++ b/base/accounts.py @@ -209,10 +209,14 @@ class RegistrationBackend(object): else: site = RequestSite(request) - new_user = RegistrationProfile.objects.create_inactive_user(username, email, - password, site, - send_email=settings.REGISTRATION_SEND_MAIL) - + 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) + userid = kwargs['userid'] if userid: ccnet_rpc.add_binding(new_user.username, userid) diff --git a/base/registration_urls.py b/base/registration_urls.py index c1d147d149..9d892f02d2 100644 --- a/base/registration_urls.py +++ b/base/registration_urls.py @@ -7,7 +7,6 @@ from registration.views import register from seahub.base.accounts import RegistrationForm - urlpatterns = patterns('', url(r'^activate/complete/$', direct_to_template, @@ -24,7 +23,9 @@ urlpatterns = patterns('', url(r'^register/$', register, { 'backend': 'seahub.base.accounts.RegistrationBackend', - 'form_class': RegistrationForm }, + 'form_class': RegistrationForm, + 'success_url': '/', + }, name='registration_register'), url(r'^register/complete/$', direct_to_template, diff --git a/settings.py b/settings.py index 1c2b74188c..362d82a2f4 100644 --- a/settings.py +++ b/settings.py @@ -113,7 +113,9 @@ AUTHENTICATION_BACKENDS = ( ACCOUNT_ACTIVATION_DAYS = 7 -REGISTRATION_SEND_MAIL = True +# this value should be false, since user will be activated after registration +# since 0.9.2 +REGISTRATION_SEND_MAIL = False # seafile httpserver address and port HTTP_SERVER_ROOT = "http://localhost:8082" diff --git a/templates/registration/registration_form.html b/templates/registration/registration_form.html index 942f862b09..1d37ee1353 100644 --- a/templates/registration/registration_form.html +++ b/templates/registration/registration_form.html @@ -4,7 +4,7 @@