Users model and integration
This commit is contained in:
@@ -19,6 +19,7 @@
|
||||
<script type="text/javascript" charset="utf-8" src="/javascripts/beathaven/audio.js"></script>
|
||||
<script type="text/javascript" charset="utf-8" src="/javascripts/beathaven/player.js"></script>
|
||||
<script type="text/javascript" charset="utf-8" src="/javascripts/beathaven/vkontakte.js"></script>
|
||||
<script type="text/javascript" charset="utf-8" src="/javascripts/beathaven/session.js"></script>
|
||||
<script type="text/javascript" charset="windows-1251" src="http://vkontakte.ru/js/api/openapi.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
@@ -0,0 +1,5 @@
|
||||
var Session = {
|
||||
|
||||
user_id: null,
|
||||
vkid: null
|
||||
}
|
||||
@@ -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');
|
||||
|
||||
Reference in New Issue
Block a user