feat: bypass login check

parent 4df64223
...@@ -264,7 +264,7 @@ export class AppService implements OnInit { ...@@ -264,7 +264,7 @@ export class AppService implements OnInit {
checklogin() { checklogin() {
this._logger.log('service.ts:AppService,checklogin'); this._logger.log('service.ts:AppService,checklogin');
if (DataStore.Path) { if (DataStore.Path) {
if (DataStore.Path['name'] === 'FOF' || DataStore.Path['name'] === 'Forgot') { if (document.location.pathname === '/luna/connect') {
} else { } else {
if (User.logined) { if (User.logined) {
if (document.location.pathname === '/login') { if (document.location.pathname === '/login') {
...@@ -273,53 +273,51 @@ export class AppService implements OnInit { ...@@ -273,53 +273,51 @@ export class AppService implements OnInit {
this._router.navigate([document.location.pathname]); this._router.navigate([document.location.pathname]);
} }
// jQuery('angular2').show(); // jQuery('angular2').show();
} else if (document.location.pathname === '/luna/connect') {
User.logined = true;
} else { } else {
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=' + window.location.href = document.location.origin + '/users/login?next=' +
document.location.pathname + document.location.search; document.location.pathname + document.location.search;
// this._router.navigate(['login']); // this._router.navigate(['login']);
}, },
// () => { // () => {
// if (User.logined) { // if (User.logined) {
// if (document.location.pathname === '/login') { // if (document.location.pathname === '/login') {
// this._router.navigate(['']); // this._router.navigate(['']);
// } else { // } else {
// this._router.navigate([document.location.pathname]); // this._router.navigate([document.location.pathname]);
// } // }
// } else { // } else {
// this._router.navigate(['login']); // this._router.navigate(['login']);
// } // }
// jQuery('angular2').show(); // jQuery('angular2').show();
// } // }
); );
}
} }
} } else {
} else {
this._router.navigate(['FOF']); this._router.navigate(['FOF']);
// jQuery('angular2').show(); // jQuery('angular2').show();
} }
......
...@@ -39,12 +39,6 @@ export class ElementNavComponent implements OnInit { ...@@ -39,12 +39,6 @@ export class ElementNavComponent implements OnInit {
} }
ngOnInit() { ngOnInit() {
this.ChangeLanWarningDialog = this._dialog.open(
ChangLanWarningDialogComponent,
{
height: '200px',
width: '300px',
});
} }
click(event) { click(event) {
...@@ -105,6 +99,12 @@ export class ElementNavComponent implements OnInit { ...@@ -105,6 +99,12 @@ export class ElementNavComponent implements OnInit {
break; break;
} }
case 'English': { case 'English': {
this.ChangeLanWarningDialog = this._dialog.open(
ChangLanWarningDialogComponent,
{
height: '200px',
width: '300px',
});
this.ChangeLanWarningDialog.afterClosed().subscribe( this.ChangeLanWarningDialog.afterClosed().subscribe(
result => { result => {
if (result) { if (result) {
...@@ -114,6 +114,12 @@ export class ElementNavComponent implements OnInit { ...@@ -114,6 +114,12 @@ export class ElementNavComponent implements OnInit {
break; break;
} }
case 'Chinese': { case 'Chinese': {
this.ChangeLanWarningDialog = this._dialog.open(
ChangLanWarningDialogComponent,
{
height: '200px',
width: '300px',
});
this.ChangeLanWarningDialog.afterClosed().subscribe( this.ChangeLanWarningDialog.afterClosed().subscribe(
result => { result => {
if (result) { if (result) {
......
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