changed paths to use hyphens and add succesfull join page

This commit is contained in:
Henry Oswald 2015-05-26 15:25:46 +01:00
parent 94b26e71a4
commit 481bd67fbd
5 changed files with 32 additions and 6 deletions

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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)

View file

@ -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)->