mirror of
https://github.com/overleaf/overleaf.git
synced 2024-11-07 20:31:06 -05:00
WIP: Working "accept invite" page
This commit is contained in:
parent
41755212f0
commit
2dede5f793
5 changed files with 50 additions and 6 deletions
|
@ -1,6 +1,8 @@
|
||||||
ProjectGetter = require "../Project/ProjectGetter"
|
ProjectGetter = require "../Project/ProjectGetter"
|
||||||
LimitationsManager = require "../Subscription/LimitationsManager"
|
LimitationsManager = require "../Subscription/LimitationsManager"
|
||||||
UserGetter = require "../User/UserGetter"
|
UserGetter = require "../User/UserGetter"
|
||||||
|
Project = require("../../models/Project").Project
|
||||||
|
User = require("../../models/User").User
|
||||||
CollaboratorsInviteHandler = require('./CollaboratorsInviteHandler')
|
CollaboratorsInviteHandler = require('./CollaboratorsInviteHandler')
|
||||||
mimelib = require("mimelib")
|
mimelib = require("mimelib")
|
||||||
logger = require('logger-sharelatex')
|
logger = require('logger-sharelatex')
|
||||||
|
@ -60,11 +62,19 @@ module.exports = CollaboratorsInviteController =
|
||||||
if !invite
|
if !invite
|
||||||
logger.log {projectId, token}, "no invite found for token"
|
logger.log {projectId, token}, "no invite found for token"
|
||||||
return res.render "project/invite/not-valid"
|
return res.render "project/invite/not-valid"
|
||||||
res.render "project/invite/show", {invite}
|
Project.findOne {_id: projectId}, {owner_ref: 1, name: 1}, (err, project) ->
|
||||||
|
if err?
|
||||||
|
logger.err {err, projectId}, "error getting project"
|
||||||
|
return callback(err)
|
||||||
|
User.findOne {_id: project.owner_ref}, {email: 1, first_name: 1, last_name: 1}, (err, owner) ->
|
||||||
|
if err?
|
||||||
|
logger.err {err, projectId}, "error getting project owner"
|
||||||
|
return callback(err)
|
||||||
|
res.render "project/invite/show", {invite, project, owner}
|
||||||
|
|
||||||
acceptInvite: (req, res, next) ->
|
acceptInvite: (req, res, next) ->
|
||||||
projectId = req.params.Project_id
|
projectId = req.params.Project_id
|
||||||
inviteId = req.params.inviteId
|
inviteId = req.params.invite_id
|
||||||
{token} = req.body
|
{token} = req.body
|
||||||
currentUser = req.session.user
|
currentUser = req.session.user
|
||||||
logger.log {projectId, inviteId}, "accepting invite"
|
logger.log {projectId, inviteId}, "accepting invite"
|
||||||
|
@ -72,4 +82,4 @@ module.exports = CollaboratorsInviteController =
|
||||||
if err?
|
if err?
|
||||||
logger.err {projectId, inviteId}, "error accepting invite by token"
|
logger.err {projectId, inviteId}, "error accepting invite by token"
|
||||||
return next(err)
|
return next(err)
|
||||||
res.sendStatus(201)
|
res.redirect "/project/#{projectId}"
|
||||||
|
|
|
@ -75,7 +75,7 @@ module.exports = CollaboratorsInviteHandler =
|
||||||
return callback(err)
|
return callback(err)
|
||||||
if !invite
|
if !invite
|
||||||
err = new Errors.NotFoundError("no matching invite found")
|
err = new Errors.NotFoundError("no matching invite found")
|
||||||
logger.log {err, projectId, inviteId}, "no matching invite found"
|
logger.log {err, projectId, inviteId, tokenString}, "no matching invite found"
|
||||||
return callback(err)
|
return callback(err)
|
||||||
|
|
||||||
# do the thing
|
# do the thing
|
||||||
|
|
|
@ -1 +1,30 @@
|
||||||
h1 Invite TEST
|
extends ../../layout
|
||||||
|
|
||||||
|
block content
|
||||||
|
.content.content-alt
|
||||||
|
.container
|
||||||
|
.row
|
||||||
|
.col-md-8.col-md-offset-2
|
||||||
|
.card.project-invite-accept
|
||||||
|
.page-header.text-centered
|
||||||
|
h1 #{translate("user_wants_you_to_see_project", {username:owner.first_name, projectname:""})}
|
||||||
|
em #{project.name}
|
||||||
|
.row.text-center
|
||||||
|
.col-md-12
|
||||||
|
p
|
||||||
|
| You are accepting this invite as
|
||||||
|
em #{user.email}
|
||||||
|
.row
|
||||||
|
.col-md-12
|
||||||
|
form.form(
|
||||||
|
name="acceptForm",
|
||||||
|
method="POST",
|
||||||
|
action="/project/#{invite.projectId}/invite/#{invite._id}/accept"
|
||||||
|
)
|
||||||
|
input(name='_csrf', type='hidden', value=csrfToken)
|
||||||
|
input(name='token', type='hidden', value="#{invite.token}")
|
||||||
|
.form-group.text-center
|
||||||
|
button.btn.btn-lg.btn-primary(type="submit")
|
||||||
|
| Accept Invite
|
||||||
|
.form-group.text-center
|
||||||
|
|
5
services/web/public/stylesheets/app/invite.less
Normal file
5
services/web/public/stylesheets/app/invite.less
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
.project-invite-accept {
|
||||||
|
form {
|
||||||
|
padding-top: 15px;
|
||||||
|
}
|
||||||
|
}
|
|
@ -76,8 +76,8 @@
|
||||||
@import "app/translations.less";
|
@import "app/translations.less";
|
||||||
@import "app/contact-us.less";
|
@import "app/contact-us.less";
|
||||||
@import "app/sprites.less";
|
@import "app/sprites.less";
|
||||||
|
@import "app/invite.less";
|
||||||
|
|
||||||
@import "../js/libs/pdfListView/TextLayer.css";
|
@import "../js/libs/pdfListView/TextLayer.css";
|
||||||
@import "../js/libs/pdfListView/AnnotationsLayer.css";
|
@import "../js/libs/pdfListView/AnnotationsLayer.css";
|
||||||
@import "../js/libs/pdfListView/HighlightsLayer.css";
|
@import "../js/libs/pdfListView/HighlightsLayer.css";
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue