Notifying user to revoke shared tokens

This commit is contained in:
James Barnsley
2020-04-13 14:15:22 +12:00
parent 74843ccc5e
commit e1e39000ab
3 changed files with 40 additions and 2 deletions

View File

@ -1,6 +1,8 @@
import ReactGA from 'react-ga';
import { formatUser } from '../../util/format';
const coreActions = require('../core/actions');
const uiActions = require('../ui/actions');
const lastfmActions = require('./actions');
const LastfmMiddleware = (function () {
@ -25,6 +27,27 @@ const LastfmMiddleware = (function () {
// TODO: Use callbacks for better code accuracy
setTimeout(() => { store.dispatch(lastfmActions.getMe()); }, 100);
next(action);
break;
case 'LASTFM_AUTHORIZATION_REVOKED':
if (store.getState().ui.allow_reporting) {
ReactGA.event({ category: 'LastFM', action: 'Authorization revoked' });
}
store.dispatch(uiActions.createNotification({
content: 'Logout successful',
description: 'If you have shared your authorization, make sure you revoke your token',
sticky: true,
links: [
{
url: 'https://www.last.fm/settings/applications',
text: 'Authorized apps',
new_window: true,
},
],
}));
next(action);
break;

View File

@ -10,6 +10,7 @@ import {
formatUser,
} from '../../util/format';
const coreActions = require('../core/actions');
const uiActions = require('../ui/actions');
const spotifyActions = require('./actions');
const pusherActions = require('../pusher/actions');
@ -31,8 +32,21 @@ const SpotifyMiddleware = (function () {
case 'SPOTIFY_AUTHORIZATION_REVOKED':
if (store.getState().ui.allow_reporting) {
ReactGA.event({ category: 'Spotify', action: 'Authorization revoked' });
}
ReactGA.event({ category: 'Spotify', action: 'Authorization revoked' });
}
store.dispatch(uiActions.createNotification({
content: 'Logout successful',
description: 'If you have shared your authorization, make sure you revoke your token',
sticky: true,
links: [
{
url: 'https://www.spotify.com/nz/account/apps/',
text: 'Authorized apps',
new_window: true,
},
],
}));
next(action);

View File

@ -29,6 +29,7 @@
&__item {
margin-bottom: 0;
margin-top: 5px;
font-style: inherit !important;
}
}