+ def form_valid(self, form):
+ form.save()
+ user = auth.authenticate(
+ username=form.cleaned_data['username'],
+ password=form.cleaned_data['password1']
+ )
+ auth.login(self.request, user)
+ return HttpResponseRedirect(quote_plus(self.request.GET.get('next', '/'), safe='/?='))
+