diff --git a/designsafe/apps/accounts/forms.py b/designsafe/apps/accounts/forms.py index 2ae74268f5..b617eba585 100644 --- a/designsafe/apps/accounts/forms.py +++ b/designsafe/apps/accounts/forms.py @@ -240,26 +240,11 @@ class UserProfileForm(forms.Form): """ firstName = forms.CharField(label='First name') lastName = forms.CharField(label='Last name') - email = forms.EmailField() - phone = forms.CharField() - institutionId = forms.ChoiceField( - label='Institution', choices=(), - error_messages={'invalid': 'Please select your affiliated institution'}) - title = forms.ChoiceField(label='Position/Title', choices=USER_PROFILE_TITLES) - countryId = forms.ChoiceField( - label='Country of residence', choices=(), - error_messages={'invalid': 'Please select your Country of residence'}) - citizenshipId = forms.ChoiceField( - label='Country of citizenship', choices=(), - error_messages={'invalid': 'Please select your Country of citizenship'}) ethnicity = forms.ChoiceField(label='Ethnicity', choices=ETHNICITY_OPTIONS) gender = forms.ChoiceField(label='Gender', choices=GENDER_OPTIONS) def __init__(self, *args, **kwargs): super(UserProfileForm, self).__init__(*args, **kwargs) - self.fields['institutionId'].choices = get_institution_choices() - self.fields['countryId'].choices = get_country_choices() - self.fields['citizenshipId'].choices = get_country_choices() class TasUserProfileAdminForm(forms.Form): diff --git a/designsafe/apps/accounts/templates/designsafe/apps/accounts/profile.html b/designsafe/apps/accounts/templates/designsafe/apps/accounts/profile.html index 5c0558e287..85ba529baf 100644 --- a/designsafe/apps/accounts/templates/designsafe/apps/accounts/profile.html +++ b/designsafe/apps/accounts/templates/designsafe/apps/accounts/profile.html @@ -17,18 +17,12 @@

Personal information

Email address
{{profile.email}}
-
Phone number
-
{{profile.phone}}
-
Institution
{{profile.institution}}
Title
{{profile.title}}
-
Country of residence
-
{{profile.country}}
-
Country of citizenship
{{profile.citizenship}}
diff --git a/designsafe/apps/accounts/templates/designsafe/apps/accounts/profile_edit.html b/designsafe/apps/accounts/templates/designsafe/apps/accounts/profile_edit.html index 7713227e42..ef3bc60108 100644 --- a/designsafe/apps/accounts/templates/designsafe/apps/accounts/profile_edit.html +++ b/designsafe/apps/accounts/templates/designsafe/apps/accounts/profile_edit.html @@ -7,10 +7,9 @@

Personal Profile


+ Update your personal profile using the TACC Account Management portal.
{% csrf_token %} - {% bootstrap_form form %} -

Professional Profile


{% bootstrap_form pro_form %} diff --git a/designsafe/apps/accounts/tests.py b/designsafe/apps/accounts/tests.py index 7649deafb5..86f1b0d398 100644 --- a/designsafe/apps/accounts/tests.py +++ b/designsafe/apps/accounts/tests.py @@ -143,10 +143,10 @@ def mock_user_side_effect(username = 'ds_admin', email = 'test@test.test'): self.client.login(username='ds_admin', password='admin/password') data = {'firstName': 'DS', - 'lastName': 'User', 'email': 'test@test.test', + 'lastName': 'User', 'phone': '555-555-5555', 'institutionId': '1', 'title': 'Center Non-Researcher Staff', - 'countryId': '1', 'citizenshipId': '1', + 'countryId': '1', 'ethnicity': 'White', 'gender': 'Other', 'bio': 'NEW TEST BIO', 'website': 'NEW_WEBSITE', 'orcid_id': 'NEW_ORCID_ID', 'nh_interests': '13', @@ -162,8 +162,3 @@ def mock_user_side_effect(username = 'ds_admin', email = 'test@test.test'): assert 'NEW TEST BIO' in str(resp.content) assert 'NEW_WEBSITE' in str(resp.content) assert 'NEW_ORCID_ID' in str(resp.content) - - data['email'] = 'error@test.test' - resp = self.client.post(edit_url, data) - resp = self.client.get(manage_url) - assert 'The submitted email already exists! Your email has not been updated!' in str(resp.content) diff --git a/designsafe/apps/accounts/urls.py b/designsafe/apps/accounts/urls.py index be8930ae05..18e1585e55 100644 --- a/designsafe/apps/accounts/urls.py +++ b/designsafe/apps/accounts/urls.py @@ -11,7 +11,6 @@ url(r'^identities/$', views.manage_identities, name='manage_identities'), url(r'^licenses/$', views.manage_licenses, name='manage_licenses'), url(r'^applications/$', views.manage_applications, name='manage_applications'), - url(r'^notifications/settings/$', views.manage_notifications, name='manage_notifications'), url(r'^register/$', views.register, name='register'), url(r'^nees-account/(?:(?P\d+)/)?$', views.nees_migration, name='nees_migration'), url(r'^password-reset/(?:(?P.+)/)?$', views.password_reset, name='password_reset'), diff --git a/designsafe/apps/accounts/views.py b/designsafe/apps/accounts/views.py index 7a6671deb6..0899ec7f70 100644 --- a/designsafe/apps/accounts/views.py +++ b/designsafe/apps/accounts/views.py @@ -308,48 +308,34 @@ def profile_edit(request): pro_form = forms.ProfessionalProfileForm(request.POST or None, instance=ds_profile) if request.method == 'POST': - form = forms.UserProfileForm(request.POST, initial=tas_user) - if form.is_valid() and pro_form.is_valid(): - existing_user = (tas.get_user(email=form.cleaned_data['email'])) - if existing_user and (existing_user['email'] != tas_user['email']): - messages.error(request, 'The submitted email already exists! Your email has not been updated!') - return HttpResponseRedirect(reverse('designsafe_accounts:profile_edit')) + if pro_form.is_valid(): + pro_form.save() - data = form.cleaned_data pro_data = pro_form.cleaned_data # punt on PI Eligibility for now - data['piEligibility'] = tas_user['piEligibility'] # retain original account source - data['source'] = tas_user['source'] - saved_user = tas.save_user(tas_user['id'], data) messages.success(request, 'Your profile has been updated!') try: ds_profile = user.profile - ds_profile.ethnicity = data['ethnicity'] - ds_profile.gender = data['gender'] ds_profile.bio = pro_data['bio'] ds_profile.website = pro_data['website'] ds_profile.orcid_id = pro_data['orcid_id'] ds_profile.professional_level = pro_data['professional_level'] ds_profile.nh_interests_primary = pro_data['nh_interests_primary'] - ds_profile.institution = saved_user.get('institution', None) except ObjectDoesNotExist as e: logger.info('exception e: {} {}'.format(type(e), e )) ds_profile = DesignSafeProfile( user=user, - ethnicity=data['ethnicity'], - gender=data['gender'], bio=pro_data['bio'], website=pro_data['website'], orcid_id=pro_data['orcid_id'], professional_level=pro_data['professional_level'], nh_interests_primary=pro_data['nh_interests_primary'], - institution=saved_user.get('institution', None) ) ds_profile.update_required = False diff --git a/designsafe/static/scripts/notifications/html/notification_list.html b/designsafe/static/scripts/notifications/html/notification_list.html index dc270e9fa8..3832b19c24 100644 --- a/designsafe/static/scripts/notifications/html/notification_list.html +++ b/designsafe/static/scripts/notifications/html/notification_list.html @@ -93,7 +93,5 @@

Coming soon!

No unread notifications.

You have no unread notifications. - Click here - to manage your notification settings.