AutoLogin Code committed : ps

This commit is contained in:
VE10-Sanjeev 2023-07-14 18:31:17 +05:30
parent 84c7521b13
commit c9ce4038e7
5 changed files with 427 additions and 394 deletions

View File

@ -1953,7 +1953,7 @@ this.proceedonChangeProperty(modified)
section_data.is_completed=true
let login_type_id = parseInt(localStorage.getItem('login_type_id')); // 1 na auto-login , 0 na manual-login
if(params.status=="COMPLETED" && login_type_id == 0){
if(params.status=="COMPLETED" && login_type_id == 1){
let completedPD = localStorage.getItem('completedPD');
completedPD = JSON.parse(completedPD)
let applicant_id = completedPD['applicant_id']
@ -2291,19 +2291,20 @@ this.proceedonChangeProperty(modified)
}
redirectSMC(applicant_id){
console.log("calling SMC redirect",environment.authorization);
// window.location.href=data.records;
let email = localStorage.getItem('officer_mail_id');
// http://salesapp.devopsmcfinance.com/secure?saltkey=$2y$10$H4vSrWl15syQHO.tsT0DdOF7pYSTKZBT85sOFCJerttTdObBRsB36&applicantid=4231&email=aniltiwari@smcfinance.com
if(environment.authorization == 'TnAwuc64pVpcB9xf'){
let salesapp_link ="https://salesapp.smcfinance.com/app/secure?saltkey=$2y$10$H4vSrWl15syQHO.tsT0DdOF7pYSTKZBT85sOFCJerttTdObBRsB36&applicantid="+applicant_id+"&email=aniltiwari@smcfinance.com";
console.log('salesapp_link = ',salesapp_link);
let salesapp_url = salesapp_link;
window.open(salesapp_url);
let salesapp_link ="http://salesapp.smcfinance.com/app/secure?saltkey=$2y$10$H4vSrWl15syQHO.tsT0DdOF7pYSTKZBT85sOFCJerttTdObBRsB36&applicantid="+applicant_id+"&email=aniltiwari@smcfinance.com";
console.log('2p salesapp_link = ',salesapp_link);
window.open(salesapp_link, '_blank');
}else if(environment.authorization == 'sparqvenba2018'){
let salesapp_link ="http://salesapp.devopsmcfinance.com/secure?saltkey=$2y$10$H4vSrWl15syQHO.tsT0DdOF7pYSTKZBT85sOFCJerttTdObBRsB36&applicantid="+applicant_id+"&email=aniltiwari@smcfinance.com";
console.log('salesapp_link = ',salesapp_link);
let salesapp_url = salesapp_link;
window.open(salesapp_url);
console.log('2t salesapp_link = ',salesapp_link);
window.open(salesapp_link, '_blank');
// this.router.navigate([salesapp_link]);
}
}
}

View File

@ -243,19 +243,18 @@
matTooltip="View" matTooltipPosition="top" ><mat-icon>visibility</mat-icon></button>
</div>
<div *ngIf="roleID != 30">
<div *ngIf="details.status == 'STARTED'; else elseBlock">
<button [disabled]="details.status === 'COMPLETED'" mat-button mat-icon-button class="hover-icon" type="button" color="primary" (click)="editForm(details)"
matTooltip="View" matTooltipPosition="top"><mat-icon>visibility</mat-icon></button>
</div>
<ng-template #elseBlock>
<button [style.visibility]="(loginTypeId=='1') ? 'visible' : 'hidden'" [disabled]="details.status !== 'COMPLETED'"
mat-button mat-icon-button class="hover-icon" type="button" color="primary"
matTooltip="Redirected to Sales APP" matTooltipPosition="above" (click)="redirected(details)"><mat-icon>launch</mat-icon></button>
</ng-template>
</div>
</div>
<div fxFlex.xs="20" fxFlex.sm="20" fxFlex.md="20.66" fxFlex.lg="20.66" fxFlex.xl="20.66" class="cell center">
<div *ngIf="loginTypeId=='1'; else elseBlock">
<button mat-button mat-icon-button class="hover-icon" type="button" color="primary"
matTooltip="Redirected to Sales APP" matTooltipPosition="above" (click)="redirected(details)"><mat-icon>link</mat-icon></button>
</div>
<ng-template #elseBlock>
<button mat-button mat-icon-button (click)="newPortal()" type="button" matTooltip="link" matTooltipPosition="above" color="primary"><mat-icon>link</mat-icon></button>
</ng-template>
</div>
<div fxFlex.xs="20" fxFlex.sm="20" fxFlex.md="20.66" fxFlex.lg="20.66" fxFlex.xl="20.66" class="cell center">
<button [disabled]="details.status !== 'COMPLETED'" mat-button mat-icon-button class=" hover-icon" type="button" color="primary" (click)="uploadDatatoCET(details.sales_pd_id)"

View File

@ -293,12 +293,12 @@ redirected(value_obj){
console.log(value_obj.applicant_id);
if (environment.authorization == 'TnAwuc64pVpcB9xf') {
let salesapp_link = "https://salesapp.smcfinance.com/app/secure?saltkey=$2y$10$H4vSrWl15syQHO.tsT0DdOF7pYSTKZBT85sOFCJerttTdObBRsB36&applicantid=" + applicant_id + "&email=aniltiwari@smcfinance.com";
console.log('salesapp_link = ',salesapp_link);
console.log('in list salesapp_link = ', salesapp_link);
let salesapp_url = salesapp_link;
window.open(salesapp_url);
} else if (environment.authorization == 'sparqvenba2018') {
let salesapp_link = "http://salesapp.devopsmcfinance.com/secure?saltkey=$2y$10$H4vSrWl15syQHO.tsT0DdOF7pYSTKZBT85sOFCJerttTdObBRsB36&applicantid=" + applicant_id + "&email=aniltiwari@smcfinance.com";
console.log('salesapp_link = ',salesapp_link);
console.log('in list salesapp_link = ', salesapp_link);
let salesapp_url = salesapp_link;
window.open(salesapp_url);
}
@ -472,8 +472,7 @@ redirected(value_obj){
}
regeneratereport(data,option)
{
regeneratereport(data, option) {
const dialogRef = this.dialog.open(ReGenerateReportComponent, {
data: { pdid: data, option: option },
@ -522,8 +521,7 @@ export class DialogOverviewExampleDialog {
this.dialogRef.close(this.choosedPD)
}
getgst(pd_id)
{
getgst(pd_id) {
let link = "https://gstapp.devopsmcfinance.com/home?saltkey=VQDa79tyBlpu7ZuKt6U&data="

View File

@ -60,7 +60,7 @@ export class AutoLoginComponent implements OnInit {
console.log(today);
if(this.dateRangeValidator(date_timing,today)){
console.log('Token vaild because 24 Hrs Not Expried ! So, permitted to log in');
console.log('Token vaild because within 24 Hrs ! So, permitted to log in');
// http://localhost:4200/#/auto?token=TXdpc2VTYWxlc0B5YWhvby5jb20jc2luZTEyMzQjMjkzIzE5IzA0LzA3LzIwMjMgMTk6MzE6MTYjbXdpc2VzYWxlczFAc2luZS5jb20%3D
let auth = { 'Username': mailid, 'Password': password };
this.aws.dologin(auth).subscribe(res => {
@ -100,29 +100,64 @@ export class AutoLoginComponent implements OnInit {
}
dateRangeValidator(fromDate,toDate){
// Perform validation logic
if (fromDate && toDate) {
const fromDateTime = new Date(fromDate).getTime();
const toDateTime = new Date(toDate).getTime();
const twentyFourHours = 24 * 60 * 60 * 1000; // 24 hours in milliseconds
// console.log('toDateTime - fromDateTime > twentyFourHours');
// console.log(toDateTime,'-',fromDateTime,'>',twentyFourHours);
// console.log(toDateTime - fromDateTime > twentyFourHours);
if (toDateTime - fromDateTime >= twentyFourHours) {
const inputDate = fromDate;
const [day, month, year, hour, minute, second] = inputDate.split(/[/: ]/);
// Months in JavaScript are zero-indexed, so we need to subtract 1 from the month value
const jsMonth = parseInt(month, 10) - 1;
const date = new Date(parseInt(year, 10), jsMonth, parseInt(day, 10), parseInt(hour, 10), parseInt(minute, 10), parseInt(second, 10));
const angularDate = date.toString();
const from_Date = new Date(angularDate);
const to_Date = new Date(toDate);
console.log("Aftr Date ",from_Date," to ",to_Date);
if (from_Date && to_Date) {
const timeDifference = to_Date.getTime() - from_Date.getTime();
console.log('time Difference',timeDifference);
const hoursDifference = timeDifference / (1000 * 60 * 60);
console.log('hours Difference',hoursDifference);
if (hoursDifference <= 24) {
// The time duration is within 24 hours
console.log('Valid: Time duration is within 24 hours');
return true;
}
else{
return true;
}
// Calculate the time difference in milliseconds
// const diffInMilliseconds = Math.abs(toDateTime - fromDateTime);
// const diffInHours = diffInMilliseconds / (1000 * 60 * 60);
// Check if the difference is at least 24 hours if (diffInHours < 24)
} else {
// The time duration is more than 24 hours
console.log('Invalid: Time duration exceeds 24 hours');
return false;
// http://localhost:4200/#/auto?token=TXdpc2VTYWxlc0B5YWhvby5jb20jc2luZTEyMzQjMjkzIzE5IzA3LzA3LzIwMjMgMTA6MDQ6NDkjbXdpc2VzYWxlczFAc2luZS5jb20jOTA2
}
}else{
console.log('Invalid: Date Not Founded');
return false;
}
}
// dateRangeValidator(fromDate,toDate){
// // Perform validation logic
// if (fromDate && toDate) {
// const fromDateTime = new Date(fromDate).getTime();
// const toDateTime = new Date(toDate).getTime();
// const twentyFourHours = 24 * 60 * 60 * 1000; // 24 hours in milliseconds
// // console.log('toDateTime - fromDateTime > twentyFourHours');
// // console.log(toDateTime,'-',fromDateTime,'>',twentyFourHours);
// // console.log(toDateTime - fromDateTime > twentyFourHours);
// if (toDateTime - fromDateTime >= twentyFourHours) {
// return true;
// }
// else{
// return true;
// }
// // Calculate the time difference in milliseconds
// // const diffInMilliseconds = Math.abs(toDateTime - fromDateTime);
// // const diffInHours = diffInMilliseconds / (1000 * 60 * 60);
// // Check if the difference is at least 24 hours if (diffInHours < 24)
// }else{
// return false;
// }
// }
decodeBase64String(encodedString) {
try {
const decodedString = atob(encodedString);

View File

@ -16,7 +16,7 @@ import { CognitoService } from '../../AwsService/cognito.service';
import { DashboardService } from 'app/dashboard/dashboard.service';
import { LoaderService } from 'app/shared/loaderService/loader.service';
import { OtpComponent } from '../otp/otp.component';
import { ActivatedRoute } from '@angular/router';
@Component({
selector: 'ms-login-session',
@ -47,9 +47,8 @@ export class LoginComponent implements OnInit{
dialogRef: MatDialogRef<OtpComponent, any>;
hide: boolean;
constructor(
private router: Router, public aws: AwsService, public dialog: MatDialog,
private router: Router, public aws: AwsService, public dialog: MatDialog,private route: ActivatedRoute,
public shared:CognitoService,private dashBoardService:DashboardService , private loaderService:LoaderService) {
}
ngOnInit(){
this.hide = true;
@ -117,6 +116,7 @@ export class LoginComponent implements OnInit{
this.loaderService.closeMatSpinnerDialog();
//alert(err.message);
})
// console.log("AWS getlocale = ",this.aws.getlocale());
}
/**
* New password set