2025-01-03 16:24:32 +08:00
|
|
|
if params_kw.password != params_kw.cfm_password:
|
|
|
|
return UiError(title='Error', message='Password not match')
|
|
|
|
|
|
|
|
userid = await get_user()
|
|
|
|
if userid is None:
|
|
|
|
return UiError(title='Error', message='You need login first')
|
|
|
|
|
|
|
|
ns = {
|
|
|
|
'id':userid,
|
|
|
|
'password':params_kw.password
|
|
|
|
}
|
|
|
|
db = DBPools()
|
2025-01-03 17:42:22 +08:00
|
|
|
dbname = await rfexe('get_module_dbname', 'rbac')
|
|
|
|
async with db.sqlorContext(dbname) as sor:
|
2025-01-03 16:24:32 +08:00
|
|
|
await sor.U('users', ns)
|
|
|
|
return UiMessage(title='Success', message='Password reset success')
|
|
|
|
return UiError(title='Error', message='Reset password failed')
|