Commit da6bc3f1 authored by Kostas Papadimitriou's avatar Kostas Papadimitriou
Browse files

astakos: Profile fields clean up

- Direct access to user uuid is no longer useful to the users.
- `auth token`, `auth token expires` and `renew token action` are now accessed
  from the api access view.
parent 3bc219fa
...@@ -436,18 +436,16 @@ class ProfileForm(forms.ModelForm): ...@@ -436,18 +436,16 @@ class ProfileForm(forms.ModelForm):
""" """
email = forms.EmailField(label='E-mail address', help_text='E-mail address') email = forms.EmailField(label='E-mail address', help_text='E-mail address')
renew = forms.BooleanField(label='Renew token', required=False) renew = forms.BooleanField(label='Renew token', required=False)
uuid = forms.CharField(label='User id', required=False)
class Meta: class Meta:
model = AstakosUser model = AstakosUser
fields = ('email', 'first_name', 'last_name', 'auth_token', fields = ('email', 'first_name', 'last_name')
'auth_token_expires', 'uuid')
def __init__(self, *args, **kwargs): def __init__(self, *args, **kwargs):
self.session_key = kwargs.pop('session_key', None) self.session_key = kwargs.pop('session_key', None)
super(ProfileForm, self).__init__(*args, **kwargs) super(ProfileForm, self).__init__(*args, **kwargs)
instance = getattr(self, 'instance', None) instance = getattr(self, 'instance', None)
ro_fields = ('email', 'auth_token', 'auth_token_expires', 'uuid') ro_fields = ('email',)
if instance and if instance and
for field in ro_fields: for field in ro_fields:
self.fields[field].widget.attrs['readonly'] = True self.fields[field].widget.attrs['readonly'] = True
...@@ -455,15 +453,6 @@ class ProfileForm(forms.ModelForm): ...@@ -455,15 +453,6 @@ class ProfileForm(forms.ModelForm):
def clean_email(self): def clean_email(self):
return return
def clean_auth_token(self):
return self.instance.auth_token
def clean_auth_token_expires(self):
return self.instance.auth_token_expires
def clean_uuid(self):
return self.instance.uuid
def save(self, commit=True): def save(self, commit=True):
user = super(ProfileForm, self).save(commit=False) user = super(ProfileForm, self).save(commit=False)
user.is_verified = True user.is_verified = True
...@@ -1024,14 +1013,11 @@ class ExtendedProfileForm(ProfileForm): ...@@ -1024,14 +1013,11 @@ class ExtendedProfileForm(ProfileForm):
'new_email_address', 'new_email_address',
'first_name', 'first_name',
'last_name', 'last_name',
'old_password', 'old_password',
'new_password1', 'new_password1',
'new_password2', 'new_password2',
'change_email', 'change_email',
'change_password', 'change_password',
] ]
super(ExtendedProfileForm, self).__init__(*args, **kwargs) super(ExtendedProfileForm, self).__init__(*args, **kwargs)
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment