Skip to content

Commit

Permalink
Merge commit 'origin/master' into WINKSTART-543
Browse files Browse the repository at this point in the history
  • Loading branch information
JRMaitre committed Jan 12, 2012
2 parents 65d334d + dcadec3 commit b84d441
Show file tree
Hide file tree
Showing 33 changed files with 916 additions and 571 deletions.
5 changes: 4 additions & 1 deletion config/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,11 +38,14 @@
'account_id': null,
'auth_token': null,
'user_id': null
},
'myaccount': {
'api_url': 'http://apps.2600hz.com:8000/v1'
}
};

amplify.cache = false;

document.title = "2600hz WinkStart";

})(window.winkstart = window.winkstart || {}, window.amplify = window.amplify || {}, jQuery);
23 changes: 13 additions & 10 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,20 @@
<head>
<!-- Awesome URL Parsing -->
<script type="text/javascript">
var URL_DATA = {},
URL_STRINGS = window.location.href.match(/^([^\?#]+)[\?#]*([^#]*).*$/),
URL = URL_STRINGS[1],
URL_DATA_STRINGS = (URL_STRINGS[2]) ? URL_STRINGS[2].split('&') : [],
DATA,
i;
var URL_PARTS = window.location.href.match(/^([^\?#]+)[\?#]*([^#]*).*$/).slice(1),
URL = URL_PARTS[0],
URL_DATA = function() {
var url_data_parts = (URL_PARTS[1]) ? URL_PARTS[1].split('&') : [],
url_data = {},
data;

for(i = 0; i < URL_DATA_STRINGS.length; i++) {
DATA = URL_DATA_STRINGS[i].split('=');
URL_DATA[DATA[0]] = DATA[1];
}
for(var i = 0; i < url_data_parts.length; i++) {
data = url_data_parts[i].split('=');
url_data[data[0]] = data[1];
}

return url_data;
}();
</script>

<link type="text/css" href="css/base.css" rel="stylesheet" media="screen" />
Expand Down
18 changes: 11 additions & 7 deletions whapps/auth/auth.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@ winkstart.module('auth', 'auth',
'auth.authenticate' : 'authenticate',
'auth.shared_auth' : 'shared_auth',
'auth.register' : 'register',
'auth.save_registration' : 'save_registration'
'auth.save_registration' : 'save_registration',
'nav.my_logout_click': 'my_logout_click'
},

validation: [
Expand Down Expand Up @@ -174,6 +175,10 @@ winkstart.module('auth', 'auth',
});
},

my_logout_click: function() {
winkstart.publish('auth.activate');
},

login: function(args) {
var THIS = this;
var username = args == undefined ? '' : args.username;
Expand Down Expand Up @@ -269,7 +274,7 @@ winkstart.module('auth', 'auth',
}

winkstart.getJSON('auth.get_user', rest_data, function (json, xhr) {
$('.universal_nav #my_logout').html("Logout");
$('.universal_nav #my_logout').html('Logout');
$('.universal_nav .my_account_wrapper').css('visibility', 'visible');
$('.universal_nav #my_account').html(json.data.first_name + ' ' + json.data.last_name);

Expand Down Expand Up @@ -299,8 +304,7 @@ winkstart.module('auth', 'auth',
shared_auth: function(args) {
var THIS = this;

rest_data = {
crossbar : true,
var rest_data = {
api_url : winkstart.apps[args.app_name].api_url,
data: {
realm : winkstart.apps['auth'].realm, // Treat auth as global
Expand All @@ -309,14 +313,14 @@ winkstart.module('auth', 'auth',
}
};

get_user_fn = function(auth_token, app_name, callback) {
var get_user_fn = function(auth_token, app_name, callback) {
var options = {
crossbar: true,
account_id: winkstart.apps['auth'].account_id,
api_url : winkstart.apps['auth'].api_url,
user_id: winkstart.apps['auth'].user_id
};

winkstart.apps[app_name] = $.extend(true, {}, options, winkstart.apps[app_name]);
winkstart.apps[app_name]['auth_token'] = auth_token;

winkstart.getJSON('auth.get_user', options, function(json, xhr) {
Expand All @@ -328,7 +332,7 @@ winkstart.module('auth', 'auth',
callback();
}
});
}
};

if(winkstart.apps['auth'].api_url != winkstart.apps[args.app_name].api_url) {
winkstart.putJSON('auth.shared_auth', rest_data, function (json, xhr) {
Expand Down
Loading

0 comments on commit b84d441

Please sign in to comment.