Skip to content
Snippets Groups Projects
Commit e8fb4817 authored by Anton Georgiev's avatar Anton Georgiev
Browse files

add logic to trigger logout if user timed out on auth step

parent 10bd63e3
No related branches found
No related tags found
No related merge requests found
......@@ -31,6 +31,12 @@ export function logoutRouteHandler(nextState, replace, callback) {
};
export function authenticatedRouteHandler(nextState, replace, callback) {
const credentialsSnapshot = {
meetingId: Auth.meetingID,
requesterUserId: Auth.userID,
requesterToken: Auth.token,
};
if (Auth.loggedIn) {
callback();
}
......@@ -40,7 +46,16 @@ export function authenticatedRouteHandler(nextState, replace, callback) {
Auth.authenticate()
.then(callback)
.catch(reason => {
logClient('error', { error: reason, method: 'authenticatedRouteHandler' });
logClient('error', { error: reason, method: 'authenticatedRouteHandler', credentialsSnapshot });
// make sure users who did not connect are not added to the meeting
// do **not** use the custom call - it relies on expired data
Meteor.call('userLogout', credentialsSnapshot, (error, result) => {
if (error) {
console.error('error');
}
});
replace({ pathname: `/error/${reason.error}` });
callback();
});
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment