rbac/www/user/reset_password/reset_password.dspy

17 lines
490 B
Plaintext
Raw Normal View History

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