fix: install user error

This commit is contained in:
Chareice 2023-02-19 16:20:14 +08:00
parent 24fb25754f
commit 01663da7ec

View File

@ -155,6 +155,10 @@ export default class UsersPlugin extends Plugin<UserPluginConfig> {
async install(options) { async install(options) {
const { rootNickname, rootPassword, rootEmail } = this.getInstallingData(options); const { rootNickname, rootPassword, rootEmail } = this.getInstallingData(options);
const User = this.db.getCollection('users'); const User = this.db.getCollection('users');
if (await User.repository.findOne({ filter: { email: rootEmail } })) {
return;
}
const user = await User.repository.create({ const user = await User.repository.create({
values: { values: {
email: rootEmail, email: rootEmail,