Commit bd2ffcb0 authored by achinta's avatar achinta

wip: change-password

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