overleaf/services/web/scripts/clear_project_tokens.js
Eric Mc Sween 33d1f603df Merge pull request #2226 from overleaf/spd-clearprojectokens
Add script to clear tokens from a specific project

GitOrigin-RevId: a810e2b7fe2e34efb937bffc0e39c409076daa23
2019-10-14 13:38:07 +00:00

19 lines
566 B
JavaScript

const ProjectDetailsHandler = require('../app/src/Features/Project/ProjectDetailsHandler')
const projectId = process.argv[2]
if (!/^(?=[a-f\d]{24}$)(\d+[a-f]|[a-f]+\d)/.test(projectId)) {
console.error('Usage: node clear_project_tokens.js projectId')
process.exit(1)
}
ProjectDetailsHandler.clearTokens(projectId, err => {
if (err) {
console.error(
`Error clearing project tokens from project ${projectId}`,
err
)
process.exit(1)
}
console.log(`Successfully cleared project tokens from project ${projectId}`)
process.exit(0)
})