fix: update

parent 0ead13eb
...@@ -278,78 +278,67 @@ export class AppService implements OnInit { ...@@ -278,78 +278,67 @@ export class AppService implements OnInit {
} else if (document.location.pathname === '/luna/connect') { } else if (document.location.pathname === '/luna/connect') {
User.logined = true; User.logined = true;
} else { } else {
// this.browser();
this._http.get_user_profile() this._http.get_user_profile()
.subscribe( .subscribe(
data => { data => {
User.id = data['id']; User.id = data['id'];
User.name = data['name']; User.name = data['name'];
User.username = data['username']; User.username = data['username'];
User.email = data['email']; User.email = data['email'];
User.is_active = data['is_active']; User.is_active = data['is_active'];
User.is_superuser = data['is_superuser']; User.is_superuser = data['is_superuser'];
User.role = data['role']; User.role = data['role'];
// User.groups = data['groups']; // User.groups = data['groups'];
User.wechat = data['wechat']; User.wechat = data['wechat'];
User.comment = data['comment']; User.comment = data['comment'];
User.date_expired = data['date_expired']; User.date_expired = data['date_expired'];
if (data['phone']) { if (data['phone']) {
User.phone = data['phone'].toString(); User.phone = data['phone'].toString();
} }
User.logined = data['logined']; User.logined = data['logined'];
this._logger.debug(User); this._logger.debug(User);
this._localStorage.set('user', data['id']); this._localStorage.set('user', data['id']);
}, },
err => { err => {
// this._logger.error(err); // this._logger.error(err);
User.logined = false; User.logined = false;
window.location.href = document.location.origin + '/users/login?next=' + document.location.pathname + document.location.search; window.location.href = document.location.origin + '/users/login?next=' +
// this._router.navigate(['login']); document.location.pathname + document.location.search;
}, // this._router.navigate(['login']);
// () => { },
// if (User.logined) { // () => {
// if (document.location.pathname === '/login') { // if (User.logined) {
// this._router.navigate(['']); // if (document.location.pathname === '/login') {
// } else { // this._router.navigate(['']);
// this._router.navigate([document.location.pathname]); // } else {
// } // this._router.navigate([document.location.pathname]);
// } else { // }
// this._router.navigate(['login']); // } else {
// } // this._router.navigate(['login']);
// jQuery('angular2').show(); // }
// } // jQuery('angular2').show();
// }
); );
}
} }
} }
} else {
this._router.navigate(['FOF']);
// jQuery('angular2').show();
}
} }
else { browser() {
this; this._http.report_browser();
. }
_router;
.
navigate(['FOF']);
// jQuery('angular2').show();
}
}
browser();
{
this._http.report_browser();
}
getQueryString(name); getQueryString(name) {
{ const reg = new RegExp('(^|&)' + name + '=([^&]*)(&|$)', 'i');
const reg = new RegExp('(^|&)' + name + '=([^&]*)(&|$)', 'i'); const r = window.location.search.substr(1).match(reg);
const r = window.location.search.substr(1).match(reg); if (r != null) {
if (r != null) { return unescape(r[2]);
return unescape(r[2]); }
return null;
} }
return null;
}
// //
// //
......
...@@ -38,7 +38,8 @@ export class ElementGuacamoleComponent implements OnInit { ...@@ -38,7 +38,8 @@ export class ElementGuacamoleComponent implements OnInit {
this._http.guacamole_token_add_asset(this.token, data['authToken']).subscribe( this._http.guacamole_token_add_asset(this.token, data['authToken']).subscribe(
data2 => { data2 => {
this._logger.debug(data); this._logger.debug(data);
this.target = document.location.origin + '/guacamole/#/client/' + data2['result'] + '?asset_token=jumpserver&token=' + data['authToken']; this.target = document.location.origin + '/guacamole/#/client/' + data2['result'] +
'?asset_token=jumpserver&token=' + data['authToken'];
}, },
error2 => { error2 => {
this._logger.error(error2); this._logger.error(error2);
......
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