mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-11-08 15:05:46 +01:00
closes #122
This commit is contained in:
@@ -28,6 +28,7 @@ var ajaxify = {};
|
||||
ajaxify.go = function(url, callback, template, quiet) {
|
||||
// leave room and join global
|
||||
app.enter_room('global');
|
||||
app.showLoginMessage();
|
||||
|
||||
var url = url.replace(/\/$/, "");
|
||||
|
||||
|
||||
@@ -21,6 +21,7 @@ var socket,
|
||||
|
||||
socket.on('event:connect', function(data) {
|
||||
console.log('connected to nodebb socket: ', data);
|
||||
app.username = data.username;
|
||||
});
|
||||
|
||||
socket.on('event:alert', function(data) {
|
||||
@@ -228,7 +229,6 @@ var socket,
|
||||
mobileMenu.onNavigate();
|
||||
});
|
||||
|
||||
|
||||
app.populate_online_users();
|
||||
|
||||
var url = window.location.href,
|
||||
@@ -254,6 +254,17 @@ var socket,
|
||||
}
|
||||
|
||||
|
||||
app.showLoginMessage = function() {
|
||||
if(location.href.indexOf('loggedin') !== -1) {
|
||||
app.alert({
|
||||
type: 'success',
|
||||
title: 'Welcome Back ' + app.username + '!',
|
||||
message: 'You have successfully logged in!',
|
||||
timeout: 5000
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
jQuery('document').ready(function() {
|
||||
addTouchEvents();
|
||||
});
|
||||
|
||||
@@ -28,7 +28,7 @@
|
||||
data: loginData,
|
||||
success: function(data, textStatus, jqXHR) {
|
||||
$('#login-error-notify').hide();
|
||||
window.location.replace(RELATIVE_PATH + "/");
|
||||
window.location.replace(RELATIVE_PATH + "/?loggedin");
|
||||
},
|
||||
error : function(data, textStatus, jqXHR) {
|
||||
$('#login-error-notify').show().delay(1000).fadeOut(250);
|
||||
|
||||
@@ -47,13 +47,19 @@ var SocketIO = require('socket.io').listen(global.server, { log:false }),
|
||||
|
||||
userSockets[uid] = userSockets[uid] || [];
|
||||
userSockets[uid].push(socket);
|
||||
if(uid)
|
||||
io.sockets.in('global').emit('api:user.isOnline', isUserOnline(uid));
|
||||
|
||||
if(uid) {
|
||||
socket.join('uid_' + uid);
|
||||
io.sockets.in('global').emit('api:user.isOnline', isUserOnline(uid));
|
||||
|
||||
user.getUserField(uid, 'username', function(username) {
|
||||
socket.emit('event:connect', {status: 1, username:username});
|
||||
});
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
socket.emit('event:connect', {status: 1});
|
||||
|
||||
|
||||
socket.on('disconnect', function() {
|
||||
|
||||
|
||||
Reference in New Issue
Block a user