Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
S
smart
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
wangqinghua
smart
Commits
8e646322
Commit
8e646322
authored
Dec 12, 2019
by
wangqinghua
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update
parent
921c2e94
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
36 additions
and
128 deletions
+36
-128
app.constants.ts
src/main/webapp/app/app.constants.ts
+2
-2
modify-password.component.ts
...pp/app/modal/modify-password/modify-password.component.ts
+7
-41
login.component.ts
src/main/webapp/app/shared/login/login.component.ts
+27
-85
No files found.
src/main/webapp/app/app.constants.ts
View file @
8e646322
export
const
VERSION
=
process
.
env
.
VERSION
;
export
const
DEBUG_INFO_ENABLED
:
boolean
=
!!
process
.
env
.
DEBUG_INFO_ENABLED
;
export
const
SERVER_API_URL_COMS
=
'/coms'
;
//
export const SERVER_API_URL = '/anke';
export
const
SERVER_API_URL
=
'/anke'
;
// export const SERVER_API_URL = '/zhouxi';
export
const
SERVER_API_URL
=
'/zabbixBox'
;
//
export const SERVER_API_URL = '/zabbixBox';
export
const
SERVER_API_URL_MONITOR
=
'/api'
;
export
const
BUILD_TIMESTAMP
=
process
.
env
.
BUILD_TIMESTAMP
;
export
const
pageSize
=
10
;
...
...
src/main/webapp/app/modal/modify-password/modify-password.component.ts
View file @
8e646322
...
...
@@ -4,8 +4,6 @@ import {FormBuilder, FormGroup, Validators} from '@angular/forms';
import
{
NzMessageComponent
,
NzMessageService
}
from
'ng-zorro-antd'
;
import
{
LayoutService
}
from
'../../layouts/layout.service'
;
import
{
LoginService
}
from
'../../shared'
;
import
{
Base64
}
from
'js-base64'
;
import
{
LocalStorageService
}
from
'ngx-webstorage'
;
@
Component
({
selector
:
'smart-modify-password'
,
...
...
@@ -18,14 +16,11 @@ export class ModifyPasswordComponent implements OnInit {
isOkLoading
=
false
;
title
=
'修改密码'
;
validateForm
:
FormGroup
;
reg
=
new
RegExp
(
/^
(?=[
a-zA-Z
]
+
\d
+
)\w{8,20}
$/
);
groupid
;
constructor
(
private
fb
:
FormBuilder
,
private
layoutSer
:
LayoutService
,
private
$localStorage
:
LocalStorageService
,
private
message
:
NzMessageService
,
private
loginService
:
LoginService
)
{
}
private
message
:
NzMessageService
,
private
loginService
:
LoginService
)
{}
ngOnInit
()
{
this
.
initForm
();
...
...
@@ -43,47 +38,18 @@ export class ModifyPasswordComponent implements OnInit {
if
(
this
.
validateForm
.
invalid
)
{
return
false
;
}
if
(
this
.
validateForm
.
value
.
newPassword
!=
this
.
validateForm
.
value
.
realPassword
)
{
this
.
message
.
error
(
'两次输入密码不一致'
);
if
(
this
.
validateForm
.
value
.
newPassword
!=
this
.
validateForm
.
value
.
realPassword
)
{
this
.
message
.
error
(
"两次输入密码不一致"
);
return
false
;
}
this
.
isOkLoading
=
true
;
this
.
getOldEncodepassword
();
}
//获取旧密码加密
getOldEncodepassword
()
{
const
data
=
{
userName
:
this
.
$localStorage
.
retrieve
(
'userInfo'
).
userName
,
password
:
Base64
.
encode
(
this
.
validateForm
.
value
.
oldPassword
)
};
this
.
layoutSer
.
encodePassword
(
data
).
subscribe
(
(
res
)
=>
{
this
.
validateForm
.
patchValue
({
oldPassword
:
res
.
data
});
this
.
getNewEncodepassword
();
}
);
}
//获取新密码加密
getNewEncodepassword
()
{
const
data
=
{
userName
:
this
.
$localStorage
.
retrieve
(
'userInfo'
).
userName
,
password
:
Base64
.
encode
(
this
.
validateForm
.
value
.
realPassword
)
};
this
.
layoutSer
.
encodePassword
(
data
).
subscribe
(
(
res
)
=>
{
this
.
validateForm
.
patchValue
({
realPassword
:
res
.
data
});
this
.
validateForm
.
patchValue
({
newPassword
:
res
.
data
});
this
.
update
();
}
);
}
update
()
{
let
formData
=
new
FormData
();
formData
.
append
(
'newPassword'
,
this
.
validateForm
.
value
.
realPassword
);
formData
.
append
(
'oldPassword'
,
this
.
validateForm
.
value
.
oldPassword
);
formData
.
append
(
'newPassword'
,
this
.
validateForm
.
value
.
realPassword
);
formData
.
append
(
'oldPassword'
,
this
.
validateForm
.
value
.
oldPassword
);
this
.
layoutSer
.
modifyPassword
(
formData
).
subscribe
(
(
res
)
=>
{
if
(
res
.
errCode
==
10000
)
{
...
...
@@ -106,8 +72,8 @@ export class ModifyPasswordComponent implements OnInit {
initForm
()
{
this
.
validateForm
=
this
.
fb
.
group
({
oldPassword
:
[
null
,
[
Validators
.
required
]],
newPassword
:
[
null
,
[
Validators
.
required
,
Validators
.
minLength
(
6
),
Validators
.
maxLength
(
12
)]],
realPassword
:
[
null
,
[
Validators
.
required
,
Validators
.
minLength
(
6
),
Validators
.
maxLength
(
12
)]],
newPassword
:
[
null
,
[
Validators
.
required
,
Validators
.
minLength
(
6
),
Validators
.
maxLength
(
12
)]],
realPassword
:
[
null
,
[
Validators
.
required
,
Validators
.
minLength
(
6
),
Validators
.
maxLength
(
12
)]],
});
}
}
src/main/webapp/app/shared/login/login.component.ts
View file @
8e646322
import
{
Component
,
AfterViewInit
,
Renderer
,
ElementRef
,
OnInit
}
from
'@angular/core'
;
import
{
NgbActiveModal
}
from
'@ng-bootstrap/ng-bootstrap'
;
import
{
Router
}
from
'@angular/router'
;
import
{
JhiEventManager
}
from
'ng-jhipster'
;
import
{
NgbActiveModal
}
from
'@ng-bootstrap/ng-bootstrap'
;
import
{
Router
}
from
'@angular/router'
;
import
{
JhiEventManager
}
from
'ng-jhipster'
;
import
{
LoginService
}
from
'./login.service'
;
import
{
StateStorageService
}
from
'../auth/state-storage.service'
;
import
{
LoginService
}
from
'./login.service'
;
import
{
StateStorageService
}
from
'../auth/state-storage.service'
;
import
{
AbstractControl
,
...
...
@@ -12,13 +12,10 @@ import {
FormGroup
,
Validators
}
from
'@angular/forms'
;
import
{
EmitService
}
from
'../event/eventEmitter'
;
import
{
EmitService
}
from
"../event/eventEmitter"
;
import
{
NzNotificationService
}
from
'ng-zorro-antd'
;
import
{
LocalStorageService
}
from
'ngx-webstorage'
;
import
{
OverAllService
}
from
'../../overAll/overAll.service'
;
import
{
SystemService
}
from
'../../system/system.service'
;
import
{
Base64
}
from
'js-base64'
;
import
{
LayoutService
}
from
'../../layouts/layout.service'
;
@
Component
({
selector
:
'jhi-login-modal'
,
...
...
@@ -32,8 +29,6 @@ export class JhiLoginModalComponent implements OnInit {
authenticationError
:
boolean
;
credentials
:
any
;
userInfo
:
any
=
{};
constructor
(
private
fb
:
FormBuilder
,
private
eventManager
:
JhiEventManager
,
...
...
@@ -43,58 +38,43 @@ export class JhiLoginModalComponent implements OnInit {
private
renderer
:
Renderer
,
private
router
:
Router
,
public
activeModal
:
NgbActiveModal
,
public
emitService
:
EmitService
,
public
notification
:
NzNotificationService
,
public
$localStorage
:
LocalStorageService
,
public
overAll
:
OverAllService
,
private
sysSer
:
SystemService
,
private
layoutSer
:
LayoutService
,
public
emitService
:
EmitService
,
public
notification
:
NzNotificationService
,
public
$localStorage
:
LocalStorageService
,
public
overAll
:
OverAllService
)
{
this
.
credentials
=
{};
this
.
emitService
.
eventEmit
.
subscribe
((
value
:
any
)
=>
{
if
(
value
==
'logout'
)
{
if
(
value
==
"logout"
)
{
this
.
router
.
navigate
([
'app/login'
]);
}
else
{
}
else
{
// this.token = false;
}
});
}
submitForm
()
{
for
(
let
i
in
this
.
validateForm
.
controls
)
{
this
.
validateForm
.
controls
[
i
].
markAsDirty
();
this
.
validateForm
.
controls
[
i
].
updateValueAndValidity
();
for
(
let
i
in
this
.
validateForm
.
controls
)
{
this
.
validateForm
.
controls
[
i
].
markAsDirty
();
this
.
validateForm
.
controls
[
i
].
updateValueAndValidity
();
}
if
(
this
.
validateForm
.
invalid
)
{
if
(
this
.
validateForm
.
invalid
)
{
return
false
;
}
this
.
getEncodepassword
();
}
getEncodepassword
()
{
const
data
=
{
userName
:
this
.
validateForm
.
value
.
loginName
,
password
:
Base64
.
encode
(
this
.
validateForm
.
value
.
password
)
};
this
.
layoutSer
.
encodePassword
(
data
).
subscribe
(
(
res
)
=>
{
this
.
validateForm
.
patchValue
({
password
:
res
.
data
});
this
.
login
();
}
);
}
ngOnInit
():
void
{
this
.
validateForm
=
this
.
fb
.
group
({
loginName
:
[
null
,
[
Validators
.
required
]
],
password
:
[
null
,
[
Validators
.
required
]
],
rememberMe
:
[
true
]
loginName
:
[
null
,
[
Validators
.
required
]
],
password
:
[
null
,
[
Validators
.
required
]
],
rememberMe
:
[
true
]
});
this
.
overAll
.
getSystem
().
subscribe
(
(
res
)
=>
{
(
res
)
=>
{
this
.
systemName
=
res
.
main
.
name
;
}
)
;
)
}
cancel
()
{
...
...
@@ -107,60 +87,22 @@ export class JhiLoginModalComponent implements OnInit {
this
.
activeModal
.
dismiss
(
'cancel'
);
}
//登录
login
()
{
if
(
this
.
validateForm
.
value
.
loginName
==
'monitor'
)
{
window
.
location
.
href
=
'http://pm.sdx.sh.cn/operation/teach-task!screen'
;
return
;
}
this
.
isSpinning
=
true
;
this
.
loginService
.
login
(
this
.
validateForm
.
value
).
then
((
res
)
=>
{
this
.
isSpinning
=
false
;
if
(
res
)
{
this
.
getUserInfo
();
}
else
{
this
.
notification
.
create
(
'error'
,
'登录失败'
,
'用户名或密码错误'
,
{
nzDuration
:
2000
});
if
(
res
){
this
.
router
.
navigate
([
'app/main/home'
]);
this
.
notification
.
create
(
'success'
,
'登录成功'
,
''
,{
nzDuration
:
2000
});
this
.
$localStorage
.
store
(
'userInfo'
,
this
.
validateForm
.
value
);
}
else
{
this
.
notification
.
create
(
'error'
,
'登录失败'
,
'用户名或密码错误'
,{
nzDuration
:
2000
});
}
}).
catch
(()
=>
{
this
.
authenticationError
=
true
;
});
}
//查询登录用户信息
getUserInfo
()
{
const
d
=
{
token
:
this
.
$localStorage
.
retrieve
(
'accessToken'
)
};
this
.
sysSer
.
getUserInfo
(
d
).
subscribe
(
(
res
)
=>
{
this
.
userInfo
.
userName
=
res
.
data
.
name
;
this
.
userInfo
.
userId
=
res
.
data
.
id
;
this
.
userInfo
.
gender
=
res
.
data
.
gender
;
this
.
userInfo
.
roles
=
res
.
data
.
roles
;
this
.
getOrgInfo
();
}
);
}
//查询登录用户部门
getOrgInfo
()
{
this
.
sysSer
.
findOrganizationByUserId
(
this
.
userInfo
.
userId
).
subscribe
(
(
res
)
=>
{
this
.
router
.
navigate
([
'app/main/home'
]);
this
.
notification
.
create
(
'success'
,
'登录成功'
,
''
,
{
nzDuration
:
2000
});
if
(
res
.
data
)
{
this
.
userInfo
.
organizationId
=
res
.
data
.
id
;
this
.
userInfo
.
organizationName
=
res
.
data
.
name
;
}
this
.
$localStorage
.
store
(
'userInfo'
,
this
.
userInfo
);
},
(
error1
=>
{
this
.
router
.
navigate
([
'app/main/home'
]);
this
.
notification
.
create
(
'success'
,
'登录成功'
,
''
,
{
nzDuration
:
2000
});
this
.
$localStorage
.
store
(
'userInfo'
,
this
.
userInfo
);
})
);
}
requestResetPassword
()
{
this
.
activeModal
.
dismiss
(
'to state requestReset'
);
this
.
router
.
navigate
([
'/reset'
,
'request'
]);
...
...
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