mirror of
https://github.com/overleaf/overleaf.git
synced 2025-01-23 01:23:59 +00:00
added delete user script in grunt
This commit is contained in:
parent
4029b76d9e
commit
ed17bd026d
1 changed files with 21 additions and 1 deletions
|
@ -356,4 +356,24 @@ module.exports = (grunt) ->
|
|||
#{settings.siteUrl}/user/password/set?passwordResetToken=#{token}
|
||||
|
||||
"""
|
||||
done()
|
||||
done()
|
||||
|
||||
grunt.registerTask 'delete-user', "deletes a user and all their data", () ->
|
||||
done = @async()
|
||||
email = grunt.option("email")
|
||||
if !email?
|
||||
console.error "Usage: grunt delete-user --email joe@example.com"
|
||||
process.exit(1)
|
||||
settings = require "settings-sharelatex"
|
||||
UserGetter = require "./app/js/Features/User/UserGetter"
|
||||
UserDeleter = require "./app/js/Features/User/UserDeleter"
|
||||
UserGetter.getUser email:email, (error, user) ->
|
||||
if error?
|
||||
throw error
|
||||
if !user?
|
||||
console.log("user #{email} not in database, potentially already deleted")
|
||||
return done()
|
||||
UserDeleter.deleteUser user._id, (err)->
|
||||
if err?
|
||||
throw err
|
||||
done()
|
Loading…
Reference in a new issue