Skip to content

Commit

Permalink
Merge pull request #16 from bepatient-fr/mobi_6291_encryption_data
Browse files Browse the repository at this point in the history
Mobi 6291 encryption data
  • Loading branch information
M3te0r authored Jan 14, 2022
2 parents 632f1ec + 75cbcdd commit 9bca3e8
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 3 deletions.
13 changes: 11 additions & 2 deletions ikaaro/fields.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,10 +54,11 @@ class Field(BaseField):
multilingual = False
required = False
title = None
readonly = False # Means the field should not be editable by the user
readonly = False # Means the field should not be editable by the user
datatype = None
widget = None
obsolete = False
encrypted = False

def get_value(self, resource, name, language=None):
raise NotImplementedError
Expand Down Expand Up @@ -89,7 +90,14 @@ def get_value_title(self, resource, name, language=None, mode=None):

# XXX For backwards compatibility
datatype_keys = [
'default', 'multiple', 'multilingual', 'indexed', 'stored', 'is_valid']
'default',
'multiple',
'multilingual',
'indexed',
'stored',
'is_valid',
'encrypted',
]
def get_datatype(self):
kw = {}
for key in self.datatype_keys:
Expand Down Expand Up @@ -263,6 +271,7 @@ def get_value_title(self, resource, name, language=None, mode=None):
class Email_Field(Metadata_Field):
datatype = Email()
size = 40
encrypted = True



Expand Down
3 changes: 2 additions & 1 deletion ikaaro/users.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@ class UserEmail_Field(Email_Field):
stored = True
required = True
unique = True
encrypted = True


class UserPassword_Field(Password_Field):
Expand Down Expand Up @@ -125,7 +126,7 @@ class User(Folder):
user_timezone = Char_Field()
user_state = UserState_Field()
groups = UserGroups_Field()
username = Char_Field(indexed=True, stored=True) # Backwards compatibility
username = Char_Field(indexed=True, stored=True, encrypted=True) # Backwards compatibility

# Remove some fields
title = None
Expand Down

0 comments on commit 9bca3e8

Please sign in to comment.