2
0
mirror of https://github.com/xcat2/confluent.git synced 2024-11-22 09:32:21 +00:00

Implement a password unexpiration mechanism in xcc

If the node has expired password, do what is necessary to unexpire the
password
to get through assignment.
This commit is contained in:
Jarrod Johnson 2022-03-30 08:07:25 -04:00
parent d214e7e442
commit 69a06a6923

View File

@ -228,6 +228,20 @@ class NodeHandler(immhandler.NodeHandler):
if '_csrf_token' in wc.cookies:
wc.set_header('X-XSRF-TOKEN', wc.cookies['_csrf_token'])
if rspdata.get('pwchg_required', None) == 'true':
if newpassword is None:
# a normal login hit expired condition
tmppassword = 'Tmp42' + password[5:]
wc.request('POST', '/api/function', json.dumps(
{'USER_UserPassChange': '1,{0}'.format(tmppassword)}))
rsp = wc.getresponse()
rsp.read()
# We must step down change interval and reusecycle to restore password
wc.grab_json_response('/api/dataset', {'USER_GlabalMinPassChgInt': '0', 'USER_GlobalMinPassReuseCycle': '0'})
wc.request('POST', '/api/function', json.dumps(
{'USER_UserPassChange': '1,{0}'.format(password)}))
rsp = wc.getresponse()
rsp.read()
return (wc, {})
wc.request('POST', '/api/function', json.dumps(
{'USER_UserPassChange': '1,{0}'.format(newpassword)}))
rsp = wc.getresponse()