rbac/www/user/reset_password/reset_password.dspy
2025-01-03 17:42:22 +08:00

18 lines
540 B
Plaintext

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()
dbname = await rfexe('get_module_dbname', 'rbac')
async with db.sqlorContext(dbname) as sor:
await sor.U('users', ns)
return UiMessage(title='Success', message='Password reset success')
return UiError(title='Error', message='Reset password failed')