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
|
@ -3,7 +3,6 @@
|
||||||
module.exports =
|
module.exports =
|
||||||
|
|
||||||
registerPage : (req, res)->
|
registerPage : (req, res)->
|
||||||
|
|
||||||
sharedProjectData =
|
sharedProjectData =
|
||||||
project_name:req.query.project_name
|
project_name:req.query.project_name
|
||||||
user_first_name:req.query.user_first_name
|
user_first_name:req.query.user_first_name
|
||||||
|
@ -18,3 +17,10 @@ module.exports =
|
||||||
sharedProjectData: sharedProjectData
|
sharedProjectData: sharedProjectData
|
||||||
newTemplateData: newTemplateData
|
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 =
|
module.exports =
|
||||||
|
|
||||||
loginForm : (req, res)->
|
|
||||||
res.render 'user/login',
|
|
||||||
title: 'Login',
|
|
||||||
redir: req.query.redir
|
|
||||||
|
|
||||||
apiRegister : (req, res, next = (error) ->)->
|
apiRegister : (req, res, next = (error) ->)->
|
||||||
logger.log email: req.body.email, "attempted register"
|
logger.log email: req.body.email, "attempted register"
|
||||||
redir = Url.parse(req.body.redir or "/project").path
|
redir = Url.parse(req.body.redir or "/project").path
|
||||||
|
|
|
@ -48,7 +48,7 @@ module.exports = class Router
|
||||||
|
|
||||||
app.get '/', HomeController.index
|
app.get '/', HomeController.index
|
||||||
|
|
||||||
app.get '/login', UserController.loginForm
|
app.get '/login', UserPagesController.loginPage
|
||||||
app.post '/login', AuthenticationController.login
|
app.post '/login', AuthenticationController.login
|
||||||
app.get '/logout', UserController.logout
|
app.get '/logout', UserController.logout
|
||||||
app.get '/restricted', SecurityManager.restricted
|
app.get '/restricted', SecurityManager.restricted
|
||||||
|
|
|
@ -56,7 +56,6 @@ describe "UserPagesController", ->
|
||||||
done()
|
done()
|
||||||
@UserPagesController.registerPage @req, @res
|
@UserPagesController.registerPage @req, @res
|
||||||
|
|
||||||
|
|
||||||
it "should not set the newTemplateData if there is nothing in the session", (done)->
|
it "should not set the newTemplateData if there is nothing in the session", (done)->
|
||||||
@res.render = (page, opts)=>
|
@res.render = (page, opts)=>
|
||||||
assert.equal opts.newTemplateData.templateName, undefined
|
assert.equal opts.newTemplateData.templateName, undefined
|
||||||
|
@ -64,6 +63,18 @@ describe "UserPagesController", ->
|
||||||
@UserPagesController.registerPage @req, @res
|
@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