mirror of
https://github.com/overleaf/overleaf.git
synced 2024-11-21 20:47:08 -05:00
moved login page to new user page controller
This commit is contained in:
parent
fa36891faf
commit
434fca8874
4 changed files with 23 additions and 11 deletions
|
@ -1,9 +1,8 @@
|
|||
|
||||
|
||||
module.exports =
|
||||
|
||||
registerPage : (req, res)->
|
||||
|
||||
registerPage : (req, res)->
|
||||
sharedProjectData =
|
||||
project_name:req.query.project_name
|
||||
user_first_name:req.query.user_first_name
|
||||
|
@ -17,4 +16,11 @@ module.exports =
|
|||
redir: req.query.redir
|
||||
sharedProjectData: sharedProjectData
|
||||
newTemplateData: newTemplateData
|
||||
new_email:req.query.new_email || ""
|
||||
new_email:req.query.new_email || ""
|
||||
|
||||
loginPage : (req, res)->
|
||||
res.render 'user/login',
|
||||
title: 'Login',
|
||||
redir: req.query.redir
|
||||
|
||||
|
||||
|
|
|
@ -20,11 +20,6 @@ uuid = require("node-uuid")
|
|||
|
||||
module.exports =
|
||||
|
||||
loginForm : (req, res)->
|
||||
res.render 'user/login',
|
||||
title: 'Login',
|
||||
redir: req.query.redir
|
||||
|
||||
apiRegister : (req, res, next = (error) ->)->
|
||||
logger.log email: req.body.email, "attempted register"
|
||||
redir = Url.parse(req.body.redir or "/project").path
|
||||
|
|
|
@ -48,7 +48,7 @@ module.exports = class Router
|
|||
|
||||
app.get '/', HomeController.index
|
||||
|
||||
app.get '/login', UserController.loginForm
|
||||
app.get '/login', UserPagesController.loginPage
|
||||
app.post '/login', AuthenticationController.login
|
||||
app.get '/logout', UserController.logout
|
||||
app.get '/restricted', SecurityManager.restricted
|
||||
|
|
|
@ -56,7 +56,6 @@ describe "UserPagesController", ->
|
|||
done()
|
||||
@UserPagesController.registerPage @req, @res
|
||||
|
||||
|
||||
it "should not set the newTemplateData if there is nothing in the session", (done)->
|
||||
@res.render = (page, opts)=>
|
||||
assert.equal opts.newTemplateData.templateName, undefined
|
||||
|
@ -64,6 +63,18 @@ describe "UserPagesController", ->
|
|||
@UserPagesController.registerPage @req, @res
|
||||
|
||||
|
||||
describe "loginForm", ->
|
||||
|
||||
it "should render the login page", (done)->
|
||||
@res.render = (page)=>
|
||||
page.should.equal "user/login"
|
||||
done()
|
||||
@UserPagesController.loginPage @req, @res
|
||||
|
||||
|
||||
it "should set the redirect", (done)->
|
||||
redirect = "/go/here/please"
|
||||
@req.query.redir = redirect
|
||||
@res.render = (page, opts)=>
|
||||
opts.redir.should.equal redirect
|
||||
done()
|
||||
@UserPagesController.loginPage @req, @res
|
||||
|
|
Loading…
Reference in a new issue