Reputation: 93
for an existing mobile app i want to create api through controller to communicate with odoo, i know about login fields/parameters
{"jsonrpc": "2.0","params":{"db":"odoodb","login":"[email protected]","password":"admin123"}}
for which api already have created, but now i want to know about odoo's default change password form's fields/parameters for PUT method, please help. using odoo 14. regards
Upvotes: 0
Views: 848
Reputation: 1668
The payload for that purpose is:
{
"params": {
"fields": [
{"name": "old_pwd", "value": "123456"},
{"name": "new_password", "value": "654321"},
{"name": "confirm_pwd", "value": "654321"}
]
}
}
Tested in v15 but in v13 and v14 the code looks the same.
I hope this answer could help.
Upvotes: 1
Reputation: 404
You can use this url to change the password of the user.
But the user must be logged to an Odoo session in the request headers
http://localhost:8069/my/security
You can send the params through GET or POST:
old = Old password
new1 = New password
new2 = Re-enter new Password
See the code in the web module for more info here
@route('/my/security', type='http', auth='user', website=True, methods=['GET', 'POST'])
def security(self, **post):
values = self._prepare_portal_layout_values()
values['get_error'] = get_error
if request.httprequest.method == 'POST':
values.update(self._update_password(
post['old'].strip(),
post['new1'].strip(),
post['new2'].strip()
))
return request.render('portal.portal_my_security', values, headers={
'X-Frame-Options': 'DENY'
})
Upvotes: 1