Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
L
luna
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
ops
luna
Commits
7b62d4bf
Unverified
Commit
7b62d4bf
authored
Mar 12, 2018
by
liuzheng712
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix: update
parent
46d94cdb
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
15 additions
and
51 deletions
+15
-51
app.service.ts
src/app/app.service.ts
+1
-0
guacamole.component.ts
src/app/elements/guacamole/guacamole.component.ts
+14
-51
No files found.
src/app/app.service.ts
View file @
7b62d4bf
...
@@ -277,6 +277,7 @@ export class AppService implements OnInit {
...
@@ -277,6 +277,7 @@ export class AppService implements OnInit {
}
}
User
.
logined
=
data
[
'logined'
];
User
.
logined
=
data
[
'logined'
];
this
.
_logger
.
debug
(
User
);
this
.
_logger
.
debug
(
User
);
this
.
_localStorage
.
set
(
'user'
,
data
[
'id'
]);
},
},
err
=>
{
err
=>
{
// this._logger.error(err);
// this._logger.error(err);
...
...
src/app/elements/guacamole/guacamole.component.ts
View file @
7b62d4bf
import
{
Component
,
ElementRef
,
Input
,
OnInit
,
ViewChild
}
from
'@angular/core'
;
import
{
Component
,
ElementRef
,
Input
,
OnInit
,
ViewChild
}
from
'@angular/core'
;
import
{
CookieService
}
from
'ngx-cookie-service'
;
import
{
CookieService
}
from
'ngx-cookie-service'
;
import
{
HttpService
,
LogService
}
from
'../../app.service'
;
import
{
HttpService
,
Lo
calStorageService
,
Lo
gService
}
from
'../../app.service'
;
import
{
DataStore
,
User
}
from
'../../globals'
;
import
{
DataStore
,
User
}
from
'../../globals'
;
import
{
DomSanitizer
}
from
'@angular/platform-browser'
;
import
{
DomSanitizer
}
from
'@angular/platform-browser'
;
import
{
environment
}
from
'../../../environments/environment'
;
import
{
environment
}
from
'../../../environments/environment'
;
...
@@ -22,63 +22,26 @@ export class ElementGuacamoleComponent implements OnInit {
...
@@ -22,63 +22,26 @@ export class ElementGuacamoleComponent implements OnInit {
constructor
(
private
sanitizer
:
DomSanitizer
,
constructor
(
private
sanitizer
:
DomSanitizer
,
private
_http
:
HttpService
,
private
_http
:
HttpService
,
private
_cookie
:
CookieService
,
private
_cookie
:
CookieService
,
private
_logger
:
LogService
)
{
private
_logger
:
LogService
,
private
_localStorage
:
LocalStorageService
)
{
}
}
ngOnInit
()
{
ngOnInit
()
{
// /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
)
{
if
(
User
.
id
)
{
this
.
userid
=
this
.
_localStorage
.
get
(
'user'
);
this
.
_http
.
get_user_profile
()
this
.
_http
.
get_guacamole_token
(
this
.
userid
).
subscribe
(
.
subscribe
(
data
=>
{
data
=>
{
DataStore
.
guacamole_token
=
data
[
'authToken'
];
User
.
id
=
data
[
'id'
];
this
.
_http
.
guacamole_token_add_asset
(
this
.
token
).
subscribe
(
User
.
name
=
data
[
'name'
];
_
=>
{
User
.
username
=
data
[
'username'
];
this
.
target
=
document
.
location
.
origin
+
'/guacamole/#/client/'
+
data
[
'result'
]
+
'?token='
+
DataStore
.
guacamole_token
;
User
.
email
=
data
[
'email'
];
User
.
is_active
=
data
[
'is_active'
];
User
.
is_superuser
=
data
[
'is_superuser'
];
User
.
role
=
data
[
'role'
];
// User.groups = data['groups'];
User
.
wechat
=
data
[
'wechat'
];
User
.
comment
=
data
[
'comment'
];
User
.
date_expired
=
data
[
'date_expired'
];
if
(
data
[
'phone'
])
{
User
.
phone
=
data
[
'phone'
].
toString
();
}
User
.
logined
=
data
[
'logined'
];
this
.
_http
.
get_guacamole_token
(
User
.
id
).
subscribe
(
data2
=>
{
DataStore
.
guacamole_token
=
data2
[
'authToken'
];
this
.
_http
.
guacamole_token_add_asset
(
this
.
token
).
subscribe
(
_
=>
{
this
.
target
=
document
.
location
.
origin
+
'/guacamole/#/client/'
+
data
[
'result'
]
+
'?token='
+
DataStore
.
guacamole_token
;
},
error2
=>
{
this
.
_logger
.
error
(
error2
);
}
);
});
},
err
=>
{
User
.
logined
=
false
;
window
.
location
.
href
=
document
.
location
.
origin
+
'/users/login?next='
+
document
.
location
.
pathname
;
},
},
error2
=>
{
this
.
_logger
.
error
(
error2
);
}
);
);
}
else
{
});
this
.
_http
.
get_guacamole_token
(
User
.
id
).
subscribe
(
data
=>
{
DataStore
.
guacamole_token
=
data
[
'authToken'
];
this
.
_http
.
guacamole_token_add_asset
(
this
.
token
).
subscribe
(
_
=>
{
this
.
target
=
document
.
location
.
origin
+
'/guacamole/#/client/'
+
data
[
'result'
]
+
'?token='
+
DataStore
.
guacamole_token
;
},
error2
=>
{
this
.
_logger
.
error
(
error2
);
}
);
});
}
}
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
)
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment