Users model and integration

This commit is contained in:
magnolia-fan
2011-06-21 04:48:53 +04:00
parent 93130968fd
commit 49f1fba33a
9 changed files with 75 additions and 3 deletions
+5
View File
@@ -0,0 +1,5 @@
var Session = {
user_id: null,
vkid: null
}
+12 -2
View File
@@ -5,8 +5,18 @@ function authInfo(response) {
if ($('#search_field').length > 0) {
$('#search_field').focus();
}
VK.Api.call('getVariable', {key: 1281}, function(r) {
$('#header-container .hello').text('Hi there, '+ r.response +'!');
$.post('/user/auth', response.session, function(ar){
if (!ar.username) {
VK.Api.call('getVariable', {key: 1281}, function(r) {
response.session.name = r.response;
$.post('/user/auth', response.session, function(ar2) {
$('#header-container .hello').text('Hi there, '+ ar2.username +'!');
});
});
}
$('#header-container .hello').text('Hi there, '+ (ar.username ? ar.username : '%username%') +'!');
Session.user_id = ar.id;
Session.vkid = response.session.mid;
});
} else {
$('#vk_login, .auth_notice').css('display', 'block');