feat: update

parent 4363db72
...@@ -128,6 +128,14 @@ export class HttpService { ...@@ -128,6 +128,14 @@ export class HttpService {
return this.http.get('/api/terminal/v1/sessions/' + token + '/replay'); return this.http.get('/api/terminal/v1/sessions/' + token + '/replay');
} }
get_user_id_from_token(token: string) {
const params = new HttpParams()
.set('user-only', '1')
.set('token', token);
return this.http.get('/api/users/v1/connection-token/', {params: params});
}
} }
@Injectable() @Injectable()
......
...@@ -31,6 +31,7 @@ export class ElementGuacamoleComponent implements OnInit { ...@@ -31,6 +31,7 @@ export class ElementGuacamoleComponent implements OnInit {
// /guacamole/api/tokens will redirect to http://guacamole/api/tokens // /guacamole/api/tokens will redirect to http://guacamole/api/tokens
if (this.token) { if (this.token) {
this.userid = this._localStorage.get('user'); this.userid = this._localStorage.get('user');
if (this.userid) {
this._http.get_guacamole_token(this.userid, this.token).subscribe( this._http.get_guacamole_token(this.userid, this.token).subscribe(
data => { data => {
DataStore.guacamole_token = data['authToken']; DataStore.guacamole_token = data['authToken'];
...@@ -44,6 +45,15 @@ export class ElementGuacamoleComponent implements OnInit { ...@@ -44,6 +45,15 @@ export class ElementGuacamoleComponent implements OnInit {
} }
); );
}); });
} else {
this._http.get_user_id_from_token(this.token)
.subscribe(
data => {
this._localStorage.set('user', data['user']);
}
);
}
} else { } else {
const base = window.btoa(this.host.id + '\0' + 'c' + '\0' + 'jumpserver'); const base = window.btoa(this.host.id + '\0' + 'c' + '\0' + 'jumpserver');
if (environment.production) { if (environment.production) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment