Fix crash when changing admin email
This commit is contained in:
parent
85c2bbd14c
commit
762f890f41
@ -18,9 +18,10 @@ export default class Users extends Collections.users {
|
|||||||
assert(app instanceof TheApp);
|
assert(app instanceof TheApp);
|
||||||
await super.init(app, name);
|
await super.init(app, name);
|
||||||
app.on("started", async () => {
|
app.on("started", async () => {
|
||||||
|
const username = "admin";
|
||||||
const users = await app.collections.users
|
const users = await app.collections.users
|
||||||
.suList()
|
.suList()
|
||||||
.filter({ email: app.manifest.admin_email })
|
.filter({ username })
|
||||||
.fetch();
|
.fetch();
|
||||||
if (users.empty) {
|
if (users.empty) {
|
||||||
app.Logger.warn(
|
app.Logger.warn(
|
||||||
@ -28,7 +29,7 @@ export default class Users extends Collections.users {
|
|||||||
`Creating an admin account for ${app.manifest.admin_email}`
|
`Creating an admin account for ${app.manifest.admin_email}`
|
||||||
);
|
);
|
||||||
await app.collections.users.suCreate({
|
await app.collections.users.suCreate({
|
||||||
username: "admin",
|
username,
|
||||||
password: "adminadmin",
|
password: "adminadmin",
|
||||||
email: "admin@example.com",
|
email: "admin@example.com",
|
||||||
roles: [],
|
roles: [],
|
||||||
|
Loading…
x
Reference in New Issue
Block a user