[REV] base,auth_password_policy: add form view for changing password
This reverts commit 14d97ec2
We revert this to keep the same design when changing password for
one or multiple users.
Task-3184727
Part-of: odoo/odoo#112806
This commit is contained in:
@@ -19,14 +19,4 @@
|
||||
</xpath>
|
||||
</field>
|
||||
</record>
|
||||
<record id="change_password_user" model="ir.ui.view">
|
||||
<field name="name">Change Password User</field>
|
||||
<field name="inherit_id" ref="base.change_password_user_form_view"/>
|
||||
<field name="model">change.password.user</field>
|
||||
<field name="arch" type="xml">
|
||||
<xpath expr="//field[@name='new_passwd']" position="attributes">
|
||||
<attribute name="widget">password_meter</attribute>
|
||||
</xpath>
|
||||
</field>
|
||||
</record>
|
||||
</odoo>
|
||||
|
||||
@@ -87,7 +87,7 @@ class TestSelfAccessProfile(TestHrCommon):
|
||||
})
|
||||
view = self.env.ref('hr.res_users_view_form_profile')
|
||||
available_actions = james.get_views([(view.id, 'form')], {'toolbar': True})['views']['form']['toolbar']['action']
|
||||
change_password_action = self.env.ref("base.change_password_action_server")
|
||||
change_password_action = self.env.ref("base.change_password_wizard_action")
|
||||
|
||||
self.assertFalse(any(x['id'] == change_password_action.id for x in available_actions))
|
||||
|
||||
|
||||
@@ -1809,32 +1809,6 @@ class UsersView(models.Model):
|
||||
})
|
||||
return res
|
||||
|
||||
def action_change_password(self):
|
||||
if len(self) == 1:
|
||||
view_id = self.env.ref('base.change_password_user_form_view').id
|
||||
return {
|
||||
'name': _('Change Password'),
|
||||
'view_mode': 'form',
|
||||
'target': 'new',
|
||||
'res_model': 'change.password.user',
|
||||
'type': 'ir.actions.act_window',
|
||||
'view_id': view_id,
|
||||
'views': [(view_id, 'form')],
|
||||
'context': {
|
||||
'default_user_id': self.id,
|
||||
'default_user_login': self.login,
|
||||
},
|
||||
}
|
||||
else:
|
||||
return {
|
||||
'name': _('Change Passwords'),
|
||||
'view_mode': 'form',
|
||||
'target': 'new',
|
||||
'res_model': 'change.password.wizard',
|
||||
'type': 'ir.actions.act_window',
|
||||
'views': [[False, 'form']],
|
||||
}
|
||||
|
||||
class CheckIdentity(models.TransientModel):
|
||||
""" Wizard used to re-check the user's credentials (password)
|
||||
|
||||
@@ -1895,7 +1869,7 @@ class ChangePasswordUser(models.TransientModel):
|
||||
_name = 'change.password.user'
|
||||
_description = 'User, Change Password Wizard'
|
||||
|
||||
wizard_id = fields.Many2one('change.password.wizard', string='Wizard', ondelete='cascade')
|
||||
wizard_id = fields.Many2one('change.password.wizard', string='Wizard', required=True, ondelete='cascade')
|
||||
user_id = fields.Many2one('res.users', string='User', required=True, ondelete='cascade')
|
||||
user_login = fields.Char(string='User Login', readonly=True)
|
||||
new_passwd = fields.Char(string='New Password', default='')
|
||||
|
||||
@@ -39,44 +39,17 @@
|
||||
<!-- the user list is editable, but one cannot add or delete rows -->
|
||||
<tree string="Users" editable="bottom" create="false" delete="false">
|
||||
<field name="user_id" invisible="1"/>
|
||||
<field name="user_login" force_save="1"/>
|
||||
<field name="user_login"/>
|
||||
<field name="new_passwd" required="True" password="True"/>
|
||||
</tree>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<record id="change_password_user_form_view" model="ir.ui.view">
|
||||
<field name="name">Change Password User</field>
|
||||
<field name="model">change.password.user</field>
|
||||
<field name="arch" type="xml">
|
||||
<form string="Change Password">
|
||||
<field name="user_id" invisible="1"/>
|
||||
<group>
|
||||
<group>
|
||||
<field name="user_login"/>
|
||||
</group>
|
||||
<group>
|
||||
<field name="new_passwd" required="True" password="True" force_save="1"/>
|
||||
</group>
|
||||
</group>
|
||||
<footer>
|
||||
<button string="Change Password" name="change_password_button" type="object" class="btn-primary" data-hotkey="q"/>
|
||||
<button string="Cancel" class="btn-secondary" special="cancel" data-hotkey="z"/>
|
||||
</footer>
|
||||
</form>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<record id="change_password_action_server" model="ir.actions.server">
|
||||
<record id="change_password_wizard_action" model="ir.actions.act_window">
|
||||
<field name="name">Change Password</field>
|
||||
<field name="model_id" ref="base.model_res_users"/>
|
||||
<field name="res_model">change.password.wizard</field>
|
||||
<field name="view_mode">form</field>
|
||||
<field name="target">new</field>
|
||||
<field name="binding_model_id" ref="base.model_res_users"/>
|
||||
<field name="groups_id" eval="[(4,ref('base.group_erp_manager'))]"/>
|
||||
<field name="state">code</field>
|
||||
<field name="code">
|
||||
if records:
|
||||
action = records.action_change_password()
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<record id="identity_check_wizard" model="ir.ui.view">
|
||||
|
||||
Reference in New Issue
Block a user