From 481bd67fbd10bb1493332121c235d7c1fb1a9dcc Mon Sep 17 00:00:00 2001 From: Henry Oswald Date: Tue, 26 May 2015 15:25:46 +0100 Subject: [PATCH] changed paths to use hyphens and add succesfull join page --- .../SubscriptionGroupController.coffee | 10 ++++++++-- .../Subscription/SubscriptionRouter.coffee | 5 +++-- .../subscriptions/group/successful_join.jade | 19 +++++++++++++++++++ services/web/config/settings.defaults.coffee | 2 +- ...roup-subscription-invite-controller.coffee | 2 +- 5 files changed, 32 insertions(+), 6 deletions(-) create mode 100644 services/web/app/views/subscriptions/group/successful_join.jade diff --git a/services/web/app/coffee/Features/Subscription/SubscriptionGroupController.coffee b/services/web/app/coffee/Features/Subscription/SubscriptionGroupController.coffee index 07b229b00b..b9f3d29343 100644 --- a/services/web/app/coffee/Features/Subscription/SubscriptionGroupController.coffee +++ b/services/web/app/coffee/Features/Subscription/SubscriptionGroupController.coffee @@ -57,7 +57,7 @@ module.exports = opts = to : req.session.user.email group_name: licence.name - completeJoinUrl: "#{settings.siteUrl}/user/subscription/#{subscription_id}/group/complete_join?token=#{token}" + completeJoinUrl: "#{settings.siteUrl}/user/subscription/#{subscription_id}/group/complete-join?token=#{token}" EmailHandler.sendEmail "completeJoinGroupAccount", opts, -> res.send 200 @@ -69,6 +69,12 @@ module.exports = return res.send 403 SubscriptionLocator.getSubscription subscription_id, (err, subscription)-> SubscriptionGroupHandler.addUserToGroup subscription.admin_id, req.user.email, (err, user)-> - res.send "joined" + res.redir "#{settings.siteUrl}/user/subscription/#{subscription_id}/group/successful-join" + renderSuccessfulJoinPage: (req, res)-> + subscription_id = req.params.subscription_id + licence = SubscriptionDomainAllocator.findDomainLicenceBySubscriptionId(subscription_id) + res.render "subscriptions/group/successful_join", + title: "Sucessfully joined group" + licenceName:licence.name diff --git a/services/web/app/coffee/Features/Subscription/SubscriptionRouter.coffee b/services/web/app/coffee/Features/Subscription/SubscriptionRouter.coffee index 8a6732e3b0..d5cc2ee3bc 100644 --- a/services/web/app/coffee/Features/Subscription/SubscriptionRouter.coffee +++ b/services/web/app/coffee/Features/Subscription/SubscriptionRouter.coffee @@ -25,8 +25,9 @@ module.exports = app.del '/subscription/group/user/:user_id', AuthenticationController.requireLogin(), SubscriptionGroupController.removeUserFromGroup app.get '/user/subscription/:subscription_id/group/invited', AuthenticationController.requireLogin(), SubscriptionGroupController.renderGroupInvitePage - app.post '/user/subscription/:subscription_id/group/begin_join', AuthenticationController.requireLogin(), SubscriptionGroupController.beginJoinGroup - app.get '/user/subscription/:subscription_id/group/complete_join', AuthenticationController.requireLogin(), SubscriptionGroupController.completeJoin + app.post '/user/subscription/:subscription_id/group/begin-join', AuthenticationController.requireLogin(), SubscriptionGroupController.beginJoinGroup + app.get '/user/subscription/:subscription_id/group/complete-join', AuthenticationController.requireLogin(), SubscriptionGroupController.completeJoin + app.get '/user/subscription/:subscription_id/group/successful-join', AuthenticationController.requireLogin(), SubscriptionGroupController.renderSuccessfulJoinPage #recurly callback app.post '/user/subscription/callback', SubscriptionController.recurlyNotificationParser, SubscriptionController.recurlyCallback diff --git a/services/web/app/views/subscriptions/group/successful_join.jade b/services/web/app/views/subscriptions/group/successful_join.jade new file mode 100644 index 0000000000..b2b0f26e79 --- /dev/null +++ b/services/web/app/views/subscriptions/group/successful_join.jade @@ -0,0 +1,19 @@ +extends ../../layout + +block scripts + script(type='text/javascript'). + window.subscription_id = '#{subscription_id}' + +block content + .content.content-alt + .container + .row + .col-md-8.col-md-offset-2(ng-cloak) + .card + .page-header + h1 You have joined #{licenceName} + span(ng-show="!requestSent") + div You have claimed your premium account provided by #{licenceName}. + + a.btn.btn-success(href="/project") Done + diff --git a/services/web/config/settings.defaults.coffee b/services/web/config/settings.defaults.coffee index 6876d48f75..c9b1f17841 100644 --- a/services/web/config/settings.defaults.coffee +++ b/services/web/config/settings.defaults.coffee @@ -350,7 +350,7 @@ module.exports = reloadModuleViewsOnEachRequest: true domainLicences: [ - {"domains":["gmail.com"], "adminUser_id":"555208e6ce4812e7d2319daa", "subscription_id":"555c6d1eb844bfb3964e0629", "name":"HENRYS AMAZING LICENCE"} + {"domains":["gmail.com"], "adminUser_id":"555208e6ce4812e7d2319daa", "subscription_id":"555c6d1eb844bfb3964e0629", "name":"HENRYS AMAZING LICENCE", verifyEmail:true} ] # ShareLaTeX Server Pro options (https://www.sharelatex.com/university/onsite.html) diff --git a/services/web/public/coffee/main/subscription/group-subscription-invite-controller.coffee b/services/web/public/coffee/main/subscription/group-subscription-invite-controller.coffee index f123985a70..4a31a5e0b1 100644 --- a/services/web/public/coffee/main/subscription/group-subscription-invite-controller.coffee +++ b/services/web/public/coffee/main/subscription/group-subscription-invite-controller.coffee @@ -7,7 +7,7 @@ define [ $scope.joinGroup = -> console.log "joingin group" - request = $http.post "/user/subscription/#{subscription_id}/group/begin_join", {_csrf:window.csrfToken} + request = $http.post "/user/subscription/#{subscription_id}/group/begin-join", {_csrf:window.csrfToken} request.success (data, status)-> $scope.requestSent = true request.error (data, status)->