aboutsummaryrefslogtreecommitdiff
path: root/frontend/src/app/_pages/profile
diff options
context:
space:
mode:
Diffstat (limited to 'frontend/src/app/_pages/profile')
-rw-r--r--frontend/src/app/_pages/profile/profile.component.css5
-rw-r--r--frontend/src/app/_pages/profile/profile.component.html8
-rw-r--r--frontend/src/app/_pages/profile/profile.component.ts44
3 files changed, 33 insertions, 24 deletions
diff --git a/frontend/src/app/_pages/profile/profile.component.css b/frontend/src/app/_pages/profile/profile.component.css
index bbd4c9ba..48b1304b 100644
--- a/frontend/src/app/_pages/profile/profile.component.css
+++ b/frontend/src/app/_pages/profile/profile.component.css
@@ -22,4 +22,9 @@ mat-form-field {
.selectedPicture {
background-color: var(--ns-accent);
+}
+
+.mat-raised-button {
+ width: 180px !important;
+ height: 50px !important;
} \ No newline at end of file
diff --git a/frontend/src/app/_pages/profile/profile.component.html b/frontend/src/app/_pages/profile/profile.component.html
index 8d655513..39f33255 100644
--- a/frontend/src/app/_pages/profile/profile.component.html
+++ b/frontend/src/app/_pages/profile/profile.component.html
@@ -27,11 +27,11 @@
<div class="row gx-3 mb-3">
<!-- Form Group (password)-->
<div class="col-md-6">
- <small *ngIf="wrongPassBool" class="form-text danger-Text">Neispravna lozinka.</small>
<mat-form-field appearance="fill">
<mat-label>Važeća lozinka</mat-label>
<input matInput id="inputPassword" name="inputPassword" type="password" placeholder="" [(ngModel)]="this.oldPass">
</mat-form-field>
+ <small *ngIf="wrongPassBool" class="form-text danger-Text">Neispravna lozinka.</small>
<small *ngIf="wrongOldPassBool" class="form-text danger-Text">Pogrešan format.</small>
</div>
<!-- Form Group (new password)-->
@@ -50,7 +50,7 @@
<div class="col-md-6">
<div class="col text-center">
<!-- Save changes button-->
- <button mat-raised-button color="primary" (click)="savePasswordChanges()">Promeni lozinku</button>
+ <button mat-raised-button color="basic" (click)="savePasswordChanges()">Promeni lozinku</button>
</div>
</div>
<!-- Form Group (new password again)-->
@@ -122,7 +122,7 @@
<div class="container">
<div class="card-group">
<!--bootstrap card with 3 horizontal images-->
- <div class="row overflow-auto" style="max-height: 200px;">
+ <div class="row overflow-auto" style="max-height: 255px;">
<div class="card col-md-3" *ngFor="let picture of this.pictures" (click)="this.photoId = picture.photoId.toString()" [ngClass]="{'selectedPicture': this.photoId == picture.photoId.toString()}">
<img src="{{picture.path}}">
</div>
@@ -134,7 +134,7 @@
<div class="row mt-5">
<div class="col text-center">
<!-- Save changes button-->
- <button mat-raised-button color="primary" (click)="saveInfoChanges()">Sačuvaj izmene</button>
+ <button mat-raised-button color="basic" (click)="saveInfoChanges()">Sačuvaj izmene</button>
</div>
</div>
</form>
diff --git a/frontend/src/app/_pages/profile/profile.component.ts b/frontend/src/app/_pages/profile/profile.component.ts
index 3c81883e..aed8e40c 100644
--- a/frontend/src/app/_pages/profile/profile.component.ts
+++ b/frontend/src/app/_pages/profile/profile.component.ts
@@ -44,7 +44,7 @@ export class ProfileComponent implements OnInit {
wrongNewPass2Bool: boolean = false;
pattName: RegExp = /^[a-zA-ZšŠđĐčČćĆžŽ]+([ \-][a-zA-ZšŠđĐčČćĆžŽ]+)*$/;
- pattUsername: RegExp = /^[a-zA-Z0-9]{6,18}$/;
+ pattUsername: RegExp = /^[a-zA-Z0-9]{4,18}$/;
pattTwoSpaces: RegExp = / /;
pattEmail: RegExp = /^[a-zA-Z0-9]+([\.\-\+][a-zA-Z0-9]+)*\@([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}$/;
pattPassword: RegExp = /.{6,30}$/;
@@ -96,24 +96,26 @@ export class ProfileComponent implements OnInit {
if (this.user.username != editedUser.username) { //promenio username, ide logout
this.user = editedUser;
this.resetInfo();
- shared.openDialog("Obaveštenje", "Nakon promene korisničkog imena, moraćete ponovo da se ulogujete.");
- this.authService.logOut();
- this.router.navigate(['']);
- return;
- }
- shared.openDialog("Obaveštenje", "Podaci su uspešno promenjeni.");
- this.user = editedUser;
- this.resetInfo();
- }, (error: any) =>{
- if (error.error == "Username already exists!") {
const dialogRef = this.dialog?.open(AlertDialogComponent, {
width: '350px',
- data: { title: "Obaveštenje", message: "Ukucano korisničko ime je već zauzeto! Izaberite neko drugo." }
+ data: { title: "Obaveštenje", message: "Nakon promene korisničkog imena, moraćete ponovo da se ulogujete." }
});
dialogRef?.afterClosed().subscribe(res => {
- this.resetInfo();
+ this.authService.logOut();
+ this.router.navigate(['']);
+ return;
});
}
+ else {
+ shared.openDialog("Obaveštenje", "Podaci su uspešno promenjeni.");
+ this.user = editedUser;
+ this.resetInfo();
+ }
+ }, (error: any) =>{
+ if (error.error == "Username already exists!") {
+ shared.openDialog("Obaveštenje", "Ukucano korisničko ime je već zauzeto! Izaberite neko drugo.");
+ this.resetInfo();
+ }
});
}
@@ -126,12 +128,10 @@ export class ProfileComponent implements OnInit {
if (this.newPass1 == '' && this.newPass2 == '') //ne zeli da promeni lozinku
return;
- //console.log("zeli da promeni lozinku");
if (this.newPass1 != this.newPass2) { //netacno ponovio novu lozinku
this.wrongNewPassBool = true;
this.resetNewPassInputs();
- //console.log("Netacno ponovljena lozinka");
return;
}
@@ -139,19 +139,23 @@ export class ProfileComponent implements OnInit {
this.userInfoService.changeUserPassword(passwordArray).subscribe((response: any) => {
//console.log("PROMENIO LOZINKU");
this.resetNewPassInputs();
- shared.openDialog("Obaveštenje", "Nakon promene lozinke, moraćete ponovo da se ulogujete.");
- this.authService.logOut();
- this.router.navigate(['']);
+ const dialogRef = this.dialog?.open(AlertDialogComponent, {
+ width: '350px',
+ data: { title: "Obaveštenje", message: "Nakon promene lozinke, moraćete ponovo da se ulogujete." }
+ });
+ dialogRef?.afterClosed().subscribe(res => {
+ this.authService.logOut();
+ this.router.navigate(['']);
+ return;
+ });
}, (error: any) => {
if (error.error == 'Wrong old password!') {
this.wrongPassBool = true;
- //(<HTMLSelectElement>document.getElementById("inputPassword")).focus();
return;
}
else if (error.error == 'Identical password!') {
shared.openDialog("Obaveštenje", "Stara i nova lozinka su identične.");
this.resetNewPassInputs();
- //(<HTMLSelectElement>document.getElementById("inputNewPassword")).focus();
return;
}
});