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
411689e0
Commit
411689e0
authored
Jan 24, 2018
by
zheng liu
Browse files
Options
Browse Files
Download
Plain Diff
Merged in dev (pull request #43)
feat: update
parents
15d6acf8
cf4ad902
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
40 additions
and
20 deletions
+40
-20
package.json
package.json
+1
-1
app-routing.module.ts
src/app/app-routing.module.ts
+1
-1
app.module.ts
src/app/app.module.ts
+2
-2
app.service.ts
src/app/app.service.ts
+28
-16
globals.ts
src/app/globals.ts
+8
-0
No files found.
package.json
View file @
411689e0
...
...
@@ -4,7 +4,7 @@
"license"
:
"GPLv3"
,
"scripts"
:
{
"ng"
:
"ng"
,
"start"
:
"ng serve --proxy-config proxy.conf.json --preserve-symlinks"
,
"start"
:
"ng serve --proxy-config proxy.conf.json --preserve-symlinks
--port 4202
"
,
"build"
:
"ng build -prod --base-href=/luna/ --deploy '/luna/'"
,
"test"
:
"ng test"
,
"lint"
:
"ng lint"
,
...
...
src/app/app-routing.module.ts
View file @
411689e0
...
...
@@ -19,7 +19,7 @@ import {TermPageComponent} from './term-page/term-page.component';
import
{
ElementServerMenuComponent
}
from
'./elements/server-menu/server-menu.component'
;
const
appRoutes
:
Routes
=
[
{
path
:
'users/login'
,
component
:
LoginComponent
},
//
{path: 'users/login', component: LoginComponent},
{
path
:
'rdp/:token'
,
component
:
RdpPageComponent
},
{
path
:
'term/:token'
,
component
:
TermPageComponent
},
{
path
:
'replay/:token'
,
component
:
ReplayPageComponent
},
...
...
src/app/app.module.ts
View file @
411689e0
...
...
@@ -103,9 +103,9 @@ import {HttpClient, HttpHandler} from '@angular/common/http';
AppService
,
HttpService
,
LayerService
,
NGXLogger
,
HttpClient
,
HttpHandler
HttpHandler
,
NGXLogger
]
})
export
class
AppModule
{
...
...
src/app/app.service.ts
View file @
411689e0
...
...
@@ -13,6 +13,7 @@ import {NGXLogger} from 'ngx-logger';
import
'rxjs/add/operator/map'
;
import
'rxjs/add/operator/catch'
;
import
{
DataStore
,
User
,
Browser
}
from
'./globals'
;
declare
function
unescape
(
s
:
string
):
string
;
@
Injectable
()
...
...
@@ -114,7 +115,7 @@ export class AppService implements OnInit {
// this._logger.level = 0;
// }
//
this.checklogin();
this
.
checklogin
();
}
ngOnInit
()
{
...
...
@@ -135,32 +136,43 @@ export class AppService implements OnInit {
// jQuery('angular2').show();
}
else
{
this
.
browser
();
this
.
_http
.
get
(
'/api/
checklogin
'
)
this
.
_http
.
get
(
'/api/
users/v1/profile/
'
)
.
map
(
res
=>
res
.
json
())
.
subscribe
(
data
=>
{
User
.
id
=
data
.
id
;
User
.
name
=
data
.
name
;
User
.
username
=
data
.
username
;
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
;
User
.
phone
=
data
.
phone
.
toString
();
User
.
logined
=
data
.
logined
;
this
.
_logger
.
debug
(
User
);
},
err
=>
{
this
.
_logger
.
error
(
err
);
//
this._logger.error(err);
User
.
logined
=
false
;
this
.
_router
.
navigate
([
'login'
]);
window
.
location
.
href
=
document
.
location
.
origin
+
'/users/login?next='
+
document
.
location
.
pathname
;
// this._router.navigate(['login']);
},
()
=>
{
if
(
User
.
logined
)
{
if
(
document
.
location
.
pathname
===
'/login'
)
{
this
.
_router
.
navigate
([
''
]);
}
else
{
this
.
_router
.
navigate
([
document
.
location
.
pathname
]);
}
}
else
{
this
.
_router
.
navigate
([
'login'
]);
}
// jQuery('angular2').show();
}
//
() => {
//
if (User.logined) {
//
if (document.location.pathname === '/login') {
//
this._router.navigate(['']);
//
} else {
//
this._router.navigate([document.location.pathname]);
//
}
//
} else {
//
this._router.navigate(['login']);
//
}
// jQuery('angular2').show();
//
}
);
}
}
...
...
src/app/globals.ts
View file @
411689e0
...
...
@@ -66,9 +66,13 @@ export let User: {
avatar
:
string
;
role
:
string
;
email
:
string
;
wechat
:
string
;
comment
:
string
;
is_active
:
boolean
;
is_superuser
:
boolean
;
date_joined
:
string
;
last_login
:
string
;
date_expired
:
string
;
groups
:
Array
<
Group
>
;
logined
:
boolean
;
}
=
{
...
...
@@ -80,9 +84,13 @@ export let User: {
avatar
:
''
,
role
:
''
,
email
:
''
,
wechat
:
''
,
comment
:
''
,
is_active
:
false
,
is_superuser
:
false
,
date_joined
:
''
,
last_login
:
''
,
date_expired
:
''
,
groups
:
[],
logined
:
false
,
};
...
...
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