Commit bd2ffcb0 authored by achinta's avatar achinta

wip: change-password

parent a5877609
{ {
"name": "nkda", "name": "lamarts",
"version": "0.0.0", "version": "0.0.0",
"lockfileVersion": 3, "lockfileVersion": 3,
"requires": true, "requires": true,
"packages": { "packages": {
"": { "": {
"name": "nkda", "name": "lamarts",
"version": "0.0.0", "version": "0.0.0",
"dependencies": { "dependencies": {
"@angular/cdk": "^19.1.3", "@angular/cdk": "^19.1.3",
......
...@@ -25,7 +25,7 @@ export class ToasterService { ...@@ -25,7 +25,7 @@ export class ToasterService {
private _openSnackBar(custom_class:string, message: string, action?: string): void { private _openSnackBar(custom_class:string, message: string, action?: string): void {
this._snackBar.open(message, action,{ this._snackBar.open(message, action,{
panelClass: [custom_class], panelClass: custom_class ? 'snack_custom_class':'',
duration: 2000, duration: 2000,
verticalPosition: "top", // Allowed values are 'top' | 'bottom' verticalPosition: "top", // Allowed values are 'top' | 'bottom'
horizontalPosition: "right" // Allowed values are 'start' | 'center' | 'end' | 'left' | 'right' horizontalPosition: "right" // Allowed values are 'start' | 'center' | 'end' | 'left' | 'right'
......
...@@ -17,6 +17,9 @@ export class TransmissionMapperService { ...@@ -17,6 +17,9 @@ export class TransmissionMapperService {
public static readonly USER_PROFILE_TRANSMISSION_URL: string = public static readonly USER_PROFILE_TRANSMISSION_URL: string =
TransmissionMapperService.DEV_TRANSMISSION_URL + '/user/get-profile'; TransmissionMapperService.DEV_TRANSMISSION_URL + '/user/get-profile';
public static readonly CHANGE_PASSWORD_TRANSMISSION_URL: string =
TransmissionMapperService.DEV_TRANSMISSION_URL + '/webomagic-user/v1/user/change-password';
public static readonly GET_TRANSMISSION_URL: string = public static readonly GET_TRANSMISSION_URL: string =
TransmissionMapperService.DEV_TRANSMISSION_URL + '/webomagic/getWebDataSourceByWebsiteDataSourceForFilter?'; TransmissionMapperService.DEV_TRANSMISSION_URL + '/webomagic/getWebDataSourceByWebsiteDataSourceForFilter?';
......
...@@ -33,7 +33,10 @@ import { provideNativeDateAdapter } from '@angular/material/core'; ...@@ -33,7 +33,10 @@ import { provideNativeDateAdapter } from '@angular/material/core';
], ],
standalone:true, standalone:true,
templateUrl: './assignment.component.html', templateUrl: './assignment.component.html',
styleUrl: './assignment.component.scss', styleUrls: [
'./assignment.component.scss',
'../../../style-guide/css/theme.scss'
],
providers: [provideNativeDateAdapter(),provideNativeDateAdapter(),DatePipe], providers: [provideNativeDateAdapter(),provideNativeDateAdapter(),DatePipe],
}) })
......
...@@ -65,6 +65,6 @@ ...@@ -65,6 +65,6 @@
</div> </div>
<div class="theme_mode_changer"> <div class="theme_mode_changer">
<app-theme-mode-changer /> <!-- <app-theme-mode-changer /> -->
</div> </div>
</div> </div>
\ No newline at end of file
...@@ -5,7 +5,9 @@ ...@@ -5,7 +5,9 @@
justify-content: space-between; justify-content: space-between;
// position: relative; // position: relative;
} }
.sidebar_navigation_container{
margin-left: 30px;
}
.sidebar_navigation_container a { .sidebar_navigation_container a {
color: var(--secondary-color); color: var(--secondary-color);
} }
...@@ -22,7 +24,7 @@ ...@@ -22,7 +24,7 @@
flex-direction: row; flex-direction: row;
// margin-top: 20px; // margin-top: 20px;
padding: 10px 0px; padding: 10px 0px;
font-size: 14px; font-size: 18px;
justify-content: space-between; justify-content: space-between;
a { a {
......
...@@ -2,7 +2,7 @@ import { Component, effect, inject, OnInit } from '@angular/core'; ...@@ -2,7 +2,7 @@ import { Component, effect, inject, OnInit } from '@angular/core';
import { Router, RouterModule } from '@angular/router'; import { Router, RouterModule } from '@angular/router';
import { Menu } from '../model/sidebar/menu'; import { Menu } from '../model/sidebar/menu';
import { Sidebar } from '../interface/sidebar'; import { Sidebar } from '../interface/sidebar';
import { ThemeModeChangerComponent } from '../../../component-library/theme-mode-changer/theme-mode-changer.component'; // import { ThemeModeChangerComponent } from '../../../component-library/theme-mode-changer/theme-mode-changer.component';
import { CommonModule } from '@angular/common'; import { CommonModule } from '@angular/common';
import { InitThemeService } from '../../../style-guide/service/initialize-theme.service'; import { InitThemeService } from '../../../style-guide/service/initialize-theme.service';
// import { InitThemeService } from '../../../style-guide/service/initialize-theme.service'; // import { InitThemeService } from '../../../style-guide/service/initialize-theme.service';
...@@ -12,7 +12,7 @@ import { InitThemeService } from '../../../style-guide/service/initialize-theme. ...@@ -12,7 +12,7 @@ import { InitThemeService } from '../../../style-guide/service/initialize-theme.
imports: [ imports: [
CommonModule, CommonModule,
RouterModule, RouterModule,
ThemeModeChangerComponent // ThemeModeChangerComponent
], ],
templateUrl: './sidebar.component.html', templateUrl: './sidebar.component.html',
styleUrl: './sidebar.component.scss' styleUrl: './sidebar.component.scss'
......
...@@ -34,6 +34,7 @@ export class TopBarComponent { ...@@ -34,6 +34,7 @@ export class TopBarComponent {
} }
public logout(): void { public logout(): void {
if(!confirm("Are you sure you want to log out?")) return;
this._logoutService.logout(); this._logoutService.logout();
} }
......
...@@ -25,7 +25,10 @@ import { TeacherTransmissionService } from '../../raintree/transmission/teacher- ...@@ -25,7 +25,10 @@ import { TeacherTransmissionService } from '../../raintree/transmission/teacher-
], ],
standalone: true, standalone: true,
templateUrl: './portal-dashboard.component.html', templateUrl: './portal-dashboard.component.html',
styleUrl: './portal-dashboard.component.scss' styleUrls: [
'./portal-dashboard.component.scss',
'../../style-guide/css/theme.scss'
]
}) })
export class PortalDashboardComponent implements OnInit { export class PortalDashboardComponent implements OnInit {
......
...@@ -2,6 +2,7 @@ ...@@ -2,6 +2,7 @@
display: flex; display: flex;
flex-wrap: wrap; flex-wrap: wrap;
height: 100%; height: 100%;
// margin-top: 30px;
.sidebar { .sidebar {
width: 250px; width: 250px;
background-color: var(--secondary-bg-color); background-color: var(--secondary-bg-color);
...@@ -27,12 +28,13 @@ ...@@ -27,12 +28,13 @@
.top_bar { .top_bar {
width: 100%; width: 100%;
background-color: var(--secondary-bg-color); background-color: var(--secondary-bg-color);
margin-top: 30px;
} }
@media only screen and (max-width: 999px) and (min-width: 300px) { @media only screen and (max-width: 999px) and (min-width: 300px) {
.sidebar { .sidebar {
width: 250px; width: 300px;
background-color: var(--secondary-bg-color); background-color: var(--secondary-bg-color);
padding-left: 20px; padding-left: 20px;
height: 100%; height: 100%;
......
...@@ -6,6 +6,9 @@ import { MatInputModule } from '@angular/material/input'; ...@@ -6,6 +6,9 @@ import { MatInputModule } from '@angular/material/input';
import { MatSelectModule } from '@angular/material/select'; import { MatSelectModule } from '@angular/material/select';
import { SquareButtonComponent } from "../../../component-library/square-button/square-button.component"; import { SquareButtonComponent } from "../../../component-library/square-button/square-button.component";
import { ToasterService } from '../../../component-library/toaster/toaster.service'; import { ToasterService } from '../../../component-library/toaster/toaster.service';
import { AuthTransmissionService } from '../../../raintree/transmission/auth-transmission.service';
import { TransmissionMapperService } from '../../../mappers/transmission-mapper.service';
import { RaintreeResponse } from '../../../raintree/interface/raintree-response';
@Component({ @Component({
selector: 'app-change-password', selector: 'app-change-password',
...@@ -16,13 +19,14 @@ import { ToasterService } from '../../../component-library/toaster/toaster.servi ...@@ -16,13 +19,14 @@ import { ToasterService } from '../../../component-library/toaster/toaster.servi
ReactiveFormsModule, ReactiveFormsModule,
MatInputModule, MatInputModule,
SquareButtonComponent SquareButtonComponent
], ],
templateUrl: './change-password.component.html', templateUrl: './change-password.component.html',
styleUrl: './change-password.component.scss' styleUrl: './change-password.component.scss'
}) })
export class ChangePasswordComponent { export class ChangePasswordComponent {
public toaster = inject(ToasterService) public toaster = inject(ToasterService);
private _auth = inject(AuthTransmissionService);
public updatePasswordForm = new FormGroup({ public updatePasswordForm = new FormGroup({
currentPassword: new FormControl("", [Validators.required]), currentPassword: new FormControl("", [Validators.required]),
...@@ -31,13 +35,36 @@ export class ChangePasswordComponent { ...@@ -31,13 +35,36 @@ export class ChangePasswordComponent {
}); });
public changePassword(): void { public changePassword(): void {
if(this.updatePasswordForm.invalid) return; if (this.updatePasswordForm.invalid) return;
if(this.updatePasswordForm.value.confirmPassword !== this.updatePasswordForm.value.newPassword) { if (this.updatePasswordForm.value.confirmPassword !== this.updatePasswordForm.value.newPassword) {
this.toaster.error("Confirm password does not match new password", 'Ok'); this.toaster.error("Confirm password does not match new password", 'Ok');
return; return;
} }
console.log(this.updatePasswordForm.value); console.log(this.updatePasswordForm.value);
// call API for change password // call API for change password
this._auth.changePassword(
TransmissionMapperService.CHANGE_PASSWORD_TRANSMISSION_URL,
{
"old_password": `${this.updatePasswordForm.value.currentPassword}`,
"new_password": `${this.updatePasswordForm.value.newPassword}`
},
() => { },
() => { },
(response: RaintreeResponse) => {
console.log(response);
},
(error) => {
console.log(error);
},
() => { }
);
} }
// { // {
......
...@@ -57,4 +57,26 @@ export class AuthTransmissionService extends TransmissionService { ...@@ -57,4 +57,26 @@ export class AuthTransmissionService extends TransmissionService {
) )
} }
public changePassword(
url: string,
payload:any,
onPreExecute: () => void,
onPostExecute: (response: any) => void,
onSuccess: (response: any) => void,
onFailure: (error: string) => void,
onComplete: () => void
): void {
this.executePostPayload(
url,
payload,
onPreExecute,
onPostExecute,
onSuccess,
onFailure,
onComplete,
true
)
}
} }
...@@ -21,6 +21,7 @@ export class JWTService { ...@@ -21,6 +21,7 @@ export class JWTService {
"user-id": userId, "user-id": userId,
"apikey": authorizationToken, "apikey": authorizationToken,
'Content-Type': 'application/json', 'Content-Type': 'application/json',
// 'Project-Id': 278,
}); });
} }
......
...@@ -54,3 +54,7 @@ body { ...@@ -54,3 +54,7 @@ body {
fill: var(--primary-color) !important; fill: var(--primary-color) !important;
} }
} }
.snack_custom_class{
margin-top: 30px !important;
}
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