feat: add button to sign out to all connected devices
This commit is contained in:
parent
c4bb7c9b17
commit
38e227a9d4
@ -170,13 +170,13 @@ export const UserSettings: React.FC = () => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const handleSignout = async (): Promise<void> => {
|
const handleSignout = async (): Promise<void> => {
|
||||||
try {
|
|
||||||
setFetchState('loading')
|
setFetchState('loading')
|
||||||
await authentication.signoutServerSide()
|
await authentication.signoutServerSide()
|
||||||
} catch (error) {
|
|
||||||
setFetchState('error')
|
|
||||||
setMessage('errors:server-error')
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const handleSignoutAllDevices = async (): Promise<void> => {
|
||||||
|
setFetchState('loading')
|
||||||
|
await authentication.signoutAllDevicesServerSide()
|
||||||
}
|
}
|
||||||
|
|
||||||
const handleDeletionProvider = (
|
const handleDeletionProvider = (
|
||||||
@ -375,6 +375,11 @@ export const UserSettings: React.FC = () => {
|
|||||||
{t('application:signout')}
|
{t('application:signout')}
|
||||||
</Button>
|
</Button>
|
||||||
</div>
|
</div>
|
||||||
|
<div className='mt-4'>
|
||||||
|
<Button type='button' color='red' onClick={handleSignoutAllDevices}>
|
||||||
|
{t('application:signout-all-devices')}
|
||||||
|
</Button>
|
||||||
|
</div>
|
||||||
<FormState
|
<FormState
|
||||||
state={fetchState}
|
state={fetchState}
|
||||||
message={message != null ? t(message) : undefined}
|
message={message != null ? t(message) : undefined}
|
||||||
|
@ -25,6 +25,7 @@
|
|||||||
"success-email-changed": "Please check your emails to confirm your new email address. You are now signed out.",
|
"success-email-changed": "Please check your emails to confirm your new email address. You are now signed out.",
|
||||||
"delete": "Delete",
|
"delete": "Delete",
|
||||||
"signout": "Sign out",
|
"signout": "Sign out",
|
||||||
|
"signout-all-devices": "Sign out of all devices",
|
||||||
"signin-with-an-account": "Sign in with an account",
|
"signin-with-an-account": "Sign in with an account",
|
||||||
"signout-with-an-account": "Sign out with an account",
|
"signout-with-an-account": "Sign out with an account",
|
||||||
"success-deleted-provider": "The provider has been deleted.",
|
"success-deleted-provider": "The provider has been deleted.",
|
||||||
|
@ -25,6 +25,7 @@
|
|||||||
"success-email-changed": "Veuillez vérifier vos emails pour confirmer votre nouvelle adresse email. Vous êtes maintenant déconnecté.",
|
"success-email-changed": "Veuillez vérifier vos emails pour confirmer votre nouvelle adresse email. Vous êtes maintenant déconnecté.",
|
||||||
"delete": "Supprimer",
|
"delete": "Supprimer",
|
||||||
"signout": "Se déconnecter",
|
"signout": "Se déconnecter",
|
||||||
|
"signout-all-devices": "Se déconnecter de tous les appareils",
|
||||||
"signin-with-an-account": "Se connecter avec un compte",
|
"signin-with-an-account": "Se connecter avec un compte",
|
||||||
"signout-with-an-account": "Se déconnecter avec un compte",
|
"signout-with-an-account": "Se déconnecter avec un compte",
|
||||||
"success-deleted-provider": "Le moyen de connexion a été supprimé.",
|
"success-deleted-provider": "Le moyen de connexion a été supprimé.",
|
||||||
|
@ -112,6 +112,13 @@ export class Authentication {
|
|||||||
this.signout()
|
this.signout()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public async signoutAllDevicesServerSide(): Promise<void> {
|
||||||
|
try {
|
||||||
|
await this.api.delete('/users/signout')
|
||||||
|
} catch {}
|
||||||
|
this.signout()
|
||||||
|
}
|
||||||
|
|
||||||
public signin(): void {
|
public signin(): void {
|
||||||
cookies.set('refreshToken', this.tokens.refreshToken)
|
cookies.set('refreshToken', this.tokens.refreshToken)
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user