Fix handling of (missing) password when user is edited
was accidentally blanking them out, if no password was provided...
This commit is contained in:
parent
9ece43ce57
commit
75b48fdaae
|
@ -67,7 +67,7 @@ class UsersView(PrincipalMasterView):
|
||||||
'display_name',
|
'display_name',
|
||||||
'active',
|
'active',
|
||||||
'active_sticky',
|
'active_sticky',
|
||||||
'password',
|
'set_password',
|
||||||
'roles',
|
'roles',
|
||||||
]
|
]
|
||||||
|
|
||||||
|
@ -98,7 +98,6 @@ class UsersView(PrincipalMasterView):
|
||||||
def configure_grid(self, g):
|
def configure_grid(self, g):
|
||||||
super(UsersView, self).configure_grid(g)
|
super(UsersView, self).configure_grid(g)
|
||||||
|
|
||||||
del g.filters['password']
|
|
||||||
del g.filters['salt']
|
del g.filters['salt']
|
||||||
g.filters['username'].default_active = True
|
g.filters['username'].default_active = True
|
||||||
g.filters['username'].default_verb = 'contains'
|
g.filters['username'].default_verb = 'contains'
|
||||||
|
@ -106,7 +105,9 @@ class UsersView(PrincipalMasterView):
|
||||||
g.filters['active'].default_verb = 'is_true'
|
g.filters['active'].default_verb = 'is_true'
|
||||||
g.filters['person'] = g.make_filter('person', model.Person.display_name,
|
g.filters['person'] = g.make_filter('person', model.Person.display_name,
|
||||||
default_active=True, default_verb='contains')
|
default_active=True, default_verb='contains')
|
||||||
g.filters['password'] = g.make_filter('password', model.User.password,
|
|
||||||
|
# password
|
||||||
|
g.set_filter('password', model.User.password,
|
||||||
verbs=['is_null', 'is_not_null'])
|
verbs=['is_null', 'is_not_null'])
|
||||||
|
|
||||||
g.set_sorter('person', model.Person.display_name)
|
g.set_sorter('person', model.Person.display_name)
|
||||||
|
@ -158,9 +159,8 @@ class UsersView(PrincipalMasterView):
|
||||||
field_display=person_display, service_url=people_url))
|
field_display=person_display, service_url=people_url))
|
||||||
f.set_label('person_uuid', "Person")
|
f.set_label('person_uuid', "Person")
|
||||||
|
|
||||||
# password
|
# set_password
|
||||||
f.set_widget('password', dfwidget.CheckedPasswordWidget())
|
f.set_widget('set_password', dfwidget.CheckedPasswordWidget())
|
||||||
f.set_label('password', "Set Password")
|
|
||||||
# if self.creating:
|
# if self.creating:
|
||||||
# f.set_required('password')
|
# f.set_required('password')
|
||||||
|
|
||||||
|
@ -195,7 +195,7 @@ class UsersView(PrincipalMasterView):
|
||||||
include_authenticated=True))
|
include_authenticated=True))
|
||||||
|
|
||||||
if self.viewing or self.deleting:
|
if self.viewing or self.deleting:
|
||||||
f.remove('password')
|
f.remove('set_password')
|
||||||
|
|
||||||
def get_possible_roles(self):
|
def get_possible_roles(self):
|
||||||
excluded = [
|
excluded = [
|
||||||
|
@ -208,8 +208,8 @@ class UsersView(PrincipalMasterView):
|
||||||
|
|
||||||
def objectify(self, form, data):
|
def objectify(self, form, data):
|
||||||
user = super(UsersView, self).objectify(form, data)
|
user = super(UsersView, self).objectify(form, data)
|
||||||
if data['password']:
|
if data['set_password']:
|
||||||
set_user_password(user, data['password'])
|
set_user_password(user, data['set_password'])
|
||||||
self.update_roles(user, data)
|
self.update_roles(user, data)
|
||||||
return user
|
return user
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue