Cleaned up login code.
parent
5247bfe332
commit
7b65328789
|
|
@ -308,7 +308,7 @@ export default class RoomClient
|
||||||
|
|
||||||
login()
|
login()
|
||||||
{
|
{
|
||||||
const url = `/auth/login?id=${this._signalingSocket.io.engine.id}&roomId=${this._roomId}&peerId=${this._peerId}`;
|
const url = `/auth/login?roomId=${this._roomId}&peerId=${this._peerId}`;
|
||||||
|
|
||||||
this._loginWindow = window.open(url, 'loginWindow');
|
this._loginWindow = window.open(url, 'loginWindow');
|
||||||
}
|
}
|
||||||
|
|
@ -318,14 +318,22 @@ export default class RoomClient
|
||||||
window.location = '/auth/logout';
|
window.location = '/auth/logout';
|
||||||
}
|
}
|
||||||
|
|
||||||
closeLoginWindow()
|
|
||||||
{
|
|
||||||
this._loginWindow.close();
|
|
||||||
}
|
|
||||||
|
|
||||||
receiveFromChildWindow(data)
|
receiveFromChildWindow(data)
|
||||||
{
|
{
|
||||||
logger.debug('receiveFromChildWindow() | [data:"%o"]', data);
|
logger.debug('receiveFromChildWindow() | [data:"%o"]', data);
|
||||||
|
|
||||||
|
const { displayName, picture } = data;
|
||||||
|
|
||||||
|
this.changeDisplayName(displayName);
|
||||||
|
this.changeProfilePicture(picture);
|
||||||
|
|
||||||
|
store.dispatch(stateActions.setPicture(picture));
|
||||||
|
store.dispatch(stateActions.loggedIn());
|
||||||
|
|
||||||
|
store.dispatch(requestActions.notify(
|
||||||
|
{
|
||||||
|
text : 'You are logged in.'
|
||||||
|
}));
|
||||||
}
|
}
|
||||||
|
|
||||||
_soundNotification()
|
_soundNotification()
|
||||||
|
|
@ -1461,26 +1469,6 @@ export default class RoomClient
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
case 'auth':
|
|
||||||
{
|
|
||||||
const { displayName, picture } = notification.data;
|
|
||||||
|
|
||||||
this.changeDisplayName(displayName);
|
|
||||||
|
|
||||||
this.changeProfilePicture(picture);
|
|
||||||
store.dispatch(stateActions.setPicture(picture));
|
|
||||||
store.dispatch(stateActions.loggedIn());
|
|
||||||
|
|
||||||
store.dispatch(requestActions.notify(
|
|
||||||
{
|
|
||||||
text : 'You are logged in.'
|
|
||||||
}));
|
|
||||||
|
|
||||||
this.closeLoginWindow();
|
|
||||||
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
case 'chatMessage':
|
case 'chatMessage':
|
||||||
{
|
{
|
||||||
const { peerId, chatMessage } = notification.data;
|
const { peerId, chatMessage } = notification.data;
|
||||||
|
|
|
||||||
|
|
@ -237,7 +237,6 @@ async function setupAuth(oidcIssuer)
|
||||||
{
|
{
|
||||||
passport.authenticate('oidc', {
|
passport.authenticate('oidc', {
|
||||||
state : base64.encode(JSON.stringify({
|
state : base64.encode(JSON.stringify({
|
||||||
id : req.query.id,
|
|
||||||
roomId : req.query.roomId,
|
roomId : req.query.roomId,
|
||||||
peerId : req.query.peerId
|
peerId : req.query.peerId
|
||||||
}))
|
}))
|
||||||
|
|
@ -283,21 +282,6 @@ async function setupAuth(oidcIssuer)
|
||||||
|
|
||||||
room.peerAuthenticated(state.peerId);
|
room.peerAuthenticated(state.peerId);
|
||||||
|
|
||||||
const socket = io.sockets.sockets[state.id];
|
|
||||||
|
|
||||||
if (socket)
|
|
||||||
{
|
|
||||||
socket.emit('notification',
|
|
||||||
{
|
|
||||||
method : 'auth',
|
|
||||||
data :
|
|
||||||
{
|
|
||||||
displayName : displayName,
|
|
||||||
picture : photo
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
res.send(httpHelper({
|
res.send(httpHelper({
|
||||||
success : true,
|
success : true,
|
||||||
displayName : displayName,
|
displayName : displayName,
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue