mirror of
https://github.com/yu-i-i/overleaf-cep.git
synced 2026-05-23 17:19:37 +02:00
[server-ce] fix direct invocation of create-user.mjs script in web (#26152)
GitOrigin-RevId: 9c7917e489dc8f3651f4ccf88a740ad60b6b4437
This commit is contained in:
@@ -48,3 +48,13 @@ Please visit the following URL to set a password for ${email} and log in:
|
||||
)
|
||||
})
|
||||
}
|
||||
|
||||
if (filename === process.argv[1]) {
|
||||
try {
|
||||
await main()
|
||||
process.exit(0)
|
||||
} catch (error) {
|
||||
console.error({ error })
|
||||
process.exit(1)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -99,6 +99,14 @@ describe('ServerCEScripts', function () {
|
||||
expect(await getUser('foo@bar.com')).to.deep.equal({ isAdmin: false })
|
||||
})
|
||||
|
||||
it('should also work with mjs version', async function () {
|
||||
const out = run(
|
||||
'node modules/server-ce-scripts/scripts/create-user.mjs --email=foo@bar.com'
|
||||
)
|
||||
expect(out).to.include('/user/activate?token=')
|
||||
expect(await getUser('foo@bar.com')).to.deep.equal({ isAdmin: false })
|
||||
})
|
||||
|
||||
it('should create an admin user with --admin flag', async function () {
|
||||
run(
|
||||
'node modules/server-ce-scripts/scripts/create-user.js --admin --email=foo@bar.com'
|
||||
|
||||
Reference in New Issue
Block a user