2014-04-09 10:04:47 -04:00
|
|
|
UserLocator = require("./UserLocator")
|
|
|
|
dropboxHandler = require('../Dropbox/DropboxHandler')
|
|
|
|
logger = require("logger-sharelatex")
|
|
|
|
Settings = require("settings-sharelatex")
|
|
|
|
fs = require('fs')
|
2014-04-09 07:17:50 -04:00
|
|
|
|
|
|
|
module.exports =
|
|
|
|
|
2014-04-09 07:22:57 -04:00
|
|
|
registerPage : (req, res)->
|
2014-04-09 07:17:50 -04:00
|
|
|
sharedProjectData =
|
|
|
|
project_name:req.query.project_name
|
|
|
|
user_first_name:req.query.user_first_name
|
|
|
|
|
|
|
|
newTemplateData = {}
|
|
|
|
if req.session.templateData?
|
|
|
|
newTemplateData.templateName = req.session.templateData.templateName
|
|
|
|
|
|
|
|
res.render 'user/register',
|
2014-08-01 08:47:14 -04:00
|
|
|
title: 'register'
|
2014-04-09 07:17:50 -04:00
|
|
|
redir: req.query.redir
|
|
|
|
sharedProjectData: sharedProjectData
|
|
|
|
newTemplateData: newTemplateData
|
2014-04-09 07:22:57 -04:00
|
|
|
new_email:req.query.new_email || ""
|
|
|
|
|
|
|
|
loginPage : (req, res)->
|
|
|
|
res.render 'user/login',
|
2014-08-01 08:47:14 -04:00
|
|
|
title: 'login',
|
2014-04-09 07:22:57 -04:00
|
|
|
redir: req.query.redir
|
|
|
|
|
2014-04-09 10:04:47 -04:00
|
|
|
settingsPage : (req, res)->
|
|
|
|
logger.log user: req.session.user, "loading settings page"
|
|
|
|
UserLocator.findById req.session.user._id, (err, user)->
|
|
|
|
dropboxHandler.getUserRegistrationStatus user._id, (err, status)->
|
|
|
|
userIsRegisteredWithDropbox = !err? and status.registered
|
|
|
|
res.render 'user/settings',
|
2014-10-07 08:31:13 -04:00
|
|
|
title:'account_settings'
|
2014-04-09 10:04:47 -04:00
|
|
|
userIsRegisteredWithDropbox: userIsRegisteredWithDropbox
|
|
|
|
user: user,
|
|
|
|
languages: Settings.languages,
|
|
|
|
accountSettingsTabActive: true
|