From bb89200e8bac2fad60e1464ed1b05a28ce001fb8 Mon Sep 17 00:00:00 2001 From: unknown Date: Tue, 17 Jul 2012 16:23:04 +0200 Subject: [PATCH] All auth form with extra fields added, setings tweaked --- itf/itfprofiles/forms.py | 10 ++++++++++ itf/settings.py | 30 +++++++++++++++++++----------- 2 files changed, 29 insertions(+), 11 deletions(-) diff --git a/itf/itfprofiles/forms.py b/itf/itfprofiles/forms.py index 1dc139d..8056024 100644 --- a/itf/itfprofiles/forms.py +++ b/itf/itfprofiles/forms.py @@ -35,6 +35,16 @@ class ConnectionsWidget(forms.SelectMultiple): #ctx['data_json'] = json.dumps(selected_values) # json.dumps(choices) return ctx +class ItfAllAuthRegForm(forms.Form): + firstname=forms.CharField() + lastname=forms.CharField() + + def save(self, user): + first_name = self.cleaned_data['firstname'] + last_name = self.cleaned_data['lastname'] + p = Person(user=user, first_name=first_name, last_name=last_name) + p.save() + return self class ItfRegistrationForm(RegistrationForm): subscribe = forms.BooleanField(help_text='Subscribe to newsletter?') diff --git a/itf/settings.py b/itf/settings.py index afa0ebc..c9fe704 100755 --- a/itf/settings.py +++ b/itf/settings.py @@ -228,28 +228,36 @@ INSTALLED_APPS = ( 'emailconfirmation', ) -LOGIN_REDIRECT_URL = '/' +LOGIN_REDIRECT_URL = '/itf_profile' #ACCOUNT_AUTHENTICATION_METHOD='' #ACCOUNT_AUTHENTICATION_METHOD = 'username_email' -ACCOUNT_EMAIL_REQUIRED=False +ACCOUNT_EMAIL_REQUIRED=True ACCOUNT_EMAIL_VERIFICATION=False ACCOUNT_EMAIL_SUBJECT_PREFIX="[ITF]" ACCOUNT_SIGNUP_PASSWORD_VERIFICATION=True +ACCOUNT_SIGNUP_FORM_CLASS='itfprofiles.forms.ItfAllAuthRegForm' ACCOUNT_UNIQUE_EMAIL=False -ACCOUNT_PASSWORD_MIN_LENGTH=6 +# TODO ACCOUNT_USER_DISPLAY (=a callable returning user.username) +ACCOUNT_PASSWORD_MIN_LENGTH=4 SOCIALACCOUNT_AVATAR_SUPPORT='avatar' +#SOCIALACCOUNT_QUERY_EMAIL=True EMAIL_CONFIRMATION_DAYS=3 +# check if the below setting allows confirmation of username retrieved from social site +SOCIALACCOUNT_AUTO_SIGNUP=False -#EMAIL_HOST ='smtp.gmail.com' -#EMAIL_HOST_USER = 'subhodipbiswas@gmail.com' -#EMAIL_HOST_PASSWORD ='doaxhentai' -#EMAIL_PORT =587 -#EMAIL_USE_TLS =True -#SERVER_EMAIL = EMAIL_HOST_USER -#DEFAULT_FROM_EMAIL=EMAIL_HOST_USER +# Nice to have but needs checking +#SOCIALACCOUNT_PROVIDERS (= dict) +SOCIALACCOUNT_PROVIDERS = { 'openid': + { 'SERVERS': + [dict(id='yahoo', + name='Yahoo', + openid_url='http://me.yahoo.com'), + dict(id='google', + name='Google', + openid_url='https://www.google.com/accounts/o8/id')]}} -ACCOUNT_ACTIVATION_DAYS = 30 +#ACCOUNT_ACTIVATION_DAYS = 30 #overwrite default settings with local settings try: