d5d0e1036b
* docs: add docs * ignore dumi theme test * fix: error TS2717: Subsequent property declarations must have the same type. * update docs * deploy gh-pages * plugins docs * hash & cname * exportStatic * ssr * vercel * vercel * fix: deploy vercel * Delete vercel.json * docs * fix APP_DIST * on master branch
1.8 KiB
1.8 KiB
title |
---|
@nocobase/plugin-users |
@nocobase/plugin-users
提供用户模块
用户模块目前的实现较简单安装
yarn nocobase pull users --start
Action API
users:check
检查用户是否已登录
await api.resource('users').check();
users:login
登录
await api.resource('users').login({
values: {
email,
password,
},
});
users:register
注册
await api.resource('users').register({
values: {
email,
password,
...others,
},
});
users:logout
注销
注销后端暂无任何处理,实际需要清除 token。await api.resource('users').logout();
users:lostpassword
忘记密码
await api.resource('users').lostpassword({
values: {
email,
}
});
users:resetpassword
重置密码
未实现邮件发送await api.resource('users').lostpassword({
values: {
email,
password,
reset_token,
}
});
users:getUserByResetToken
根据 reset token 获取用户信息
await api.resource('users').getUserByResetToken({
values: {
reset_token,
}
});
Fields Types
context 未实现
上下文类型,可以从 app.context 里获取信息,如 UA、Client IP 等。利用 context 类型,createdBy/updatedBy 的实现也变得更简单了:
createdBy
{
name: 'created_by_id',
type: 'context',
dataIndex: 'state.currentUser.id',
createOnly: true,
}
updatedBy
{
name: 'updated_by_id',
type: 'context',
dataIndex: 'state.currentUser.id',
}
Field Interfaces
createdBy
创建人
updatedBy
最后更新人