mirror of
https://github.com/overleaf/overleaf.git
synced 2024-11-07 20:31:06 -05:00
f455a11aa8
Reconfirm user accounts GitOrigin-RevId: 0343ff745e881cd51b5efbfb97404b6b926905c8
34 lines
No EOL
1.1 KiB
CoffeeScript
34 lines
No EOL
1.1 KiB
CoffeeScript
expect = require("chai").expect
|
|
should = require('chai').should()
|
|
async = require("async")
|
|
User = require "./helpers/User"
|
|
|
|
describe 'User Must Reconfirm', ->
|
|
|
|
before (done) ->
|
|
@user = new User()
|
|
async.series [
|
|
@user.ensureUserExists.bind(@user)
|
|
(cb) => @user.mongoUpdate {$set: {'must_reconfirm': true}}, cb
|
|
], done
|
|
|
|
it 'should not allow sign in', (done) ->
|
|
@user.login (err) =>
|
|
expect(err?).to.equal false
|
|
@user.isLoggedIn (err, isLoggedIn) ->
|
|
expect(isLoggedIn).to.equal false
|
|
done()
|
|
|
|
describe 'Requesting reconfirmation email', ->
|
|
it 'should return a success to client for existing account', (done) ->
|
|
@user.reconfirmAccountRequest @user.email, (err, response) =>
|
|
expect(err?).to.equal false
|
|
expect(response.statusCode).to.equal 200
|
|
done()
|
|
|
|
it 'should return a success to client for non-existent account', (done) ->
|
|
# we return success so that we do not leak account info
|
|
@user.reconfirmAccountRequest 'fake@overleaf.com', (err, response) =>
|
|
expect(err?).to.equal false
|
|
expect(response.statusCode).to.equal 200
|
|
done() |