Skip to content
Snippets Groups Projects
Commit adae8870 authored by Guillaume Heurtier's avatar Guillaume Heurtier
Browse files

FEAT #14566 TIME 0:35 added connection method to token

parent 1713dbb2
No related branches found
No related tags found
No related merge requests found
...@@ -253,8 +253,9 @@ class AuthenticationController ...@@ -253,8 +253,9 @@ class AuthenticationController
unset($user['picture']); unset($user['picture']);
$token = [ $token = [
'exp' => time() + 60 * $sessionTime, 'exp' => time() + 60 * $sessionTime,
'user' => $user 'user' => $user,
'connection' => ConfigurationModel::getConnection()
]; ];
$jwt = JWT::encode($token, CoreConfigModel::getEncryptKey()); $jwt = JWT::encode($token, CoreConfigModel::getEncryptKey());
...@@ -291,7 +292,8 @@ class AuthenticationController ...@@ -291,7 +292,8 @@ class AuthenticationController
'exp' => time() + 3600, 'exp' => time() + 3600,
'user' => [ 'user' => [
'id' => $GLOBALS['id'] 'id' => $GLOBALS['id']
] ],
'connection' => ConfigurationModel::getConnection()
]; ];
$jwt = JWT::encode($token, CoreConfigModel::getEncryptKey()); $jwt = JWT::encode($token, CoreConfigModel::getEncryptKey());
......
...@@ -63,7 +63,10 @@ export class AuthService { ...@@ -63,7 +63,10 @@ export class AuthService {
updateUserInfo(token: string) { updateUserInfo(token: string) {
const currentPicture = this.user.picture; const currentPicture = this.user.picture;
this.user = JSON.parse(atob(token.split('.')[1])).user; const tokenData = JSON.parse(atob(token.split('.')[1]));
this.user = tokenData.user;
this.authMode = tokenData.connection;
this.user.picture = currentPicture; this.user.picture = currentPicture;
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment