Skip to content
This repository was archived by the owner on Nov 21, 2025. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions ui/src/app/pages/nav/nav.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,21 +23,21 @@ export class NavComponent implements OnInit {
"readSddcSoftwareConfigByID","readSddcSoftwareConfigByVRO","readSddcSoftwareConfigByVC","readSddcSoftwareConfigByUserAndPage","readVROsSddcSoftwareConfigByUser","readSddcSoftwareConfigByTypeAndUser"];
servermapping:string []= ["updateServerMapping","readMappingsByVROIDAndPage","readMappingsByVCIDAndPage","readSddcSoftwareConfigByTypeAndUser"];
facility:string[] = ["createFacilitySoftwareConfig","readFacilityByType","readFacilityByPage"];

setting:string[] = ["createSensorSetting","readSensorSettingsByPage","updateSensorSetting","deleteSensorSetting","startFullMappingAggregation","generateServerPDUMapping","readUnMappedServers"];
sensorsetting:string[] = ["createSensorSetting","readSensorSettingsByPage","updateSensorSetting","deleteSensorSetting"];
systemSetting:string[] = ["startFullMappingAggregation","generateServerPDUMapping","readUnMappedServers"];
assetmanagement:string [] = ["createAnAsset", "updateAsset", "deleteAsset", "readAsset", "readAssetBySource"];
adaptermanagement:string [] = ["createFacilityAdapter","updateFacilityAdapter","readAnFacilityAdapterById","deleteAnFacilityAdapterById","readFacilityAdaptersByPage"];
constructor(private activedRoute:ActivatedRoute,private router: Router,private auth:AuthenticationService) { }
logout(){
localStorage.clear()
this.auth.logout();

}
userprofile(){
this.router.navigate(["/ui/nav/user/user-profile"]);
}

ngOnInit() {
this.username = this.auth.getUsername();
}
Expand Down
2 changes: 1 addition & 1 deletion ui/src/app/pages/user-login/user-login.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ <h3 class="welcome">Welcome to</h3>
</clr-password-container>
<clr-checkbox-wrapper>
<label>Remember me</label>
<input type="checkbox" name="rememberMe" clrCheckbox />
<input type="checkbox" name="rememberMe" clrCheckbox [(ngModel)]="user.rememberMe"/>
</clr-checkbox-wrapper>
<div *ngIf="tips" class="error active" >
{{textContent}}
Expand Down
34 changes: 23 additions & 11 deletions ui/src/app/pages/user-login/user-login.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,29 +19,32 @@ export class UserLoginComponent implements OnInit {
tips:boolean = false;
textContent = "";
user ={
id:"",
username:"",
password:"",
id:"",
username:"",
password:"",
rememberMe:false
}
constructor(private router: Router,private data:AuthenticationService,private ls:LocalStorage) {
}
userName:string
password:string
password:string
rememberMe:boolean
toLogin(){
this.userName = this.user.username;
this.password = this.user.password;
this.rememberMe = this.user.rememberMe;

if(this.userName == ""){
this.tips = true;
this.textContent = "please input a userName";

}else if(this.password == ""){
this.tips = true;
this.textContent = "please input a password";
}else{
this.login(this.userName,this.password);
}
}

login(userName,password){
let userInfoBase64:string = "";
let user:string = "";
Expand All @@ -55,6 +58,10 @@ export class UserLoginComponent implements OnInit {
privilegeName = priData;
let currentUser = btoa(JSON.stringify({username: JSON.parse(user).sub, token: res['access_token'], authorities:privilegeName,expires_in:res['expires_in']}));
sessionStorage.setItem('currentUser', currentUser);
if (this.rememberMe) {
localStorage.setItem("username", btoa(userName));
localStorage.setItem("password", btoa(password));
}
this.tips = false;
this.router.navigate(["ui/nav"]);
}
Expand All @@ -67,11 +74,16 @@ export class UserLoginComponent implements OnInit {
this.tips = true;
this.textContent = "Internal error";
}

})
})
}

ngOnInit() {
let username = localStorage.getItem("username");
let password = localStorage.getItem("password");
if (username == null || password == null) {
return
}
this.login(atob(username), atob(password));
}
ngOnInit() {

}

}