Sessions, lastfm auth workarounds
This commit is contained in:
@@ -1,5 +1,7 @@
|
||||
var Settings = {
|
||||
|
||||
lastfm_login_url: null,
|
||||
|
||||
getAccountInfo: function(callback) {
|
||||
Session.query('/user/update', {}, callback);
|
||||
},
|
||||
@@ -29,14 +31,27 @@ $('.settings-container .tabs .tab').live('click', function(){
|
||||
$('.form-container').html($('.forms .'+ $(this).attr('data-fieldset')).html());
|
||||
Settings.loadFormData($(this).attr('data-fieldset'));
|
||||
}
|
||||
if ($(this).attr('data-fieldset') == 'lastfm') {
|
||||
Session.query('/lastfm/getinfo', {}, function(data){
|
||||
console.log(data);
|
||||
Settings.lastfm_login_url = data.lastfm_login_url;
|
||||
})
|
||||
}
|
||||
});
|
||||
|
||||
$('.lastfm-connect').live('click', function(){
|
||||
window.open(Settings.lastfm_login_url);
|
||||
});
|
||||
|
||||
$('.settings-container .form input').live('blur', function(){
|
||||
params = {
|
||||
'username': $('.settings-container .form input[name$="username"]').first().val(),
|
||||
'email': $('.settings-container .form input[name$="email"]').first().val(),
|
||||
};
|
||||
Settings.saveAccountInfo(params, function(){
|
||||
$('#header-container .hello .greating').text('Hi there, '+ (params.username.length > 0 ? params.username : '%username%') +'!');
|
||||
});
|
||||
var active_tab = $('.settings-container .tabs .tab.active').attr('data-fieldset');
|
||||
if (active_tab == 'account') {
|
||||
params = {
|
||||
'username': $('.settings-container .form input[name$="username"]').first().val(),
|
||||
'email': $('.settings-container .form input[name$="email"]').first().val(),
|
||||
};
|
||||
Settings.saveAccountInfo(params, function(){
|
||||
$('#header-container .hello .greating').text('Hi there, '+ (params.username.length > 0 ? params.username : '%username%') +'!');
|
||||
});
|
||||
}
|
||||
})
|
||||
@@ -10,7 +10,7 @@ function authInfo(response) {
|
||||
if (!ar.username) {
|
||||
VK.Api.call('getVariable', {key: 1281}, function(r) {
|
||||
Session.query('/user/update', {'name': r.response}, function(ar2) {
|
||||
$('#header-container .hello .greating').text('Hi there, '+ ar2.username +'!');
|
||||
$('#header-container .hello .greating').text('Hi there, '+ (ar2.username ? ar2.username : '%username%') +'!');
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user