when redirected from the login page, go straight into sessionView

This commit is contained in:
Anton Georgiev 2014-05-15 15:54:39 +00:00
parent bc09084ec2
commit 32fea5be69
5 changed files with 37 additions and 33 deletions

View File

@ -12,15 +12,16 @@ define [
routes:
'session': 'showSession',
'login': 'showLogin',
# '*actions': 'defaultAction'
initialize: ->
@appView = new AppView()
showLogin: () ->
showLogin: () ->#TEMP I want to show the session window right away
globals.router.navigate "/login", {replace: true}
@loginView ?= new LoginView()
@appView.render(@loginView)
@sessionView ?= new SessionView()#TEMP I want to show the session window right away
@appView.render(@sessionView)#TEMP I want to show the session window right away
showSession: () ->
globals.router.navigate "/session", {replace: true}

View File

@ -38,6 +38,6 @@ module.exports = class MainRouter
"user_id=#{userId}\n" +
"auth_token=#{authToken}\n\n"
#render a blank page page.html
res.render "session",
#go straight into the session view
res.render "index",
title: config.appName

View File

@ -19,30 +19,37 @@ login = (req, resp) ->
bbbapi.create(createParams, serverAndSecret, {}, (errorOuter, responseOuter, bodyOuter) ->
#console.log JSON.stringify(response)
bbbapi.join(joinParams, serverAndSecret, {}, (error, response, body) ->
xml = '' + response.body
#console.log "\n\nxml=" + xml
{parseString} = require 'xml2js'
parseString(xml, (err, result) ->
meeting_id = result.response.meeting_id
user_id = result.response.user_id
auth_token = result.response.auth_token
console.log "\nmeeting_id = " + meeting_id +
"\nuser_id = " + user_id +
"\nauth_token = " + auth_token
if error
console.log error
else
xml = '' + response.body
console.log "\n\nxml=" + xml
{parseString} = require 'xml2js'
parseString(xml, (err, result) ->
if err
console.log "Error: " + err
else
meeting_id = result.response.meeting_id
user_id = result.response.user_id
auth_token = result.response.auth_token
console.log "\nmeeting_id = " + meeting_id +
"\nuser_id = " + user_id +
"\nauth_token = " + auth_token
#url = "http:/192.168.0.203/html5.client?meeting_id=" + meeting_id + "&user_id=" + user_id + "&auth_token=" + auth_token
url = "192.168.0.203:3000/html5.client?meeting_id=" + meeting_id + "&user_id=" + user_id + "&auth_token=" + auth_token
json =
resp.json({
success: {
url: url
},
failure: {
message: "Something went terribly wrong"
}
})
)
url = "http://192.168.0.203:3000/html5.client?meeting_id=" + meeting_id + "&user_id=" +
user_id + "&auth_token=" + auth_token
json =
resp.json({
success: {
url: url
},
failure: {
message: "Something went terribly wrong"
}
})
)
)
)

View File

@ -10,10 +10,7 @@ myModule.controller('MainCtrl', function($scope, $http, $location, $window) {
jQuery.getJSON("config.json", function (json) {
$http.post('/login', account).success(function(res) {
//alert(res.success.url);
//TODO check if I really need $location
$scope.myurl = res.success.url;
$window.location.href = res.success.url;
});
});
}

View File

@ -13,7 +13,6 @@
<div ng-controller="MainCtrl">
<form ng-submit="postUsername()">
<input type="submit" value="Send"> <br /><br />
<a ng-href="http://{{myurl}}">HTML5 CLIENT</a>
</form>
</div>
</body>