Skip to content

Commit

Permalink
Logout (#127)
Browse files Browse the repository at this point in the history
* Logout and user read v2=>v5 <> *revert* # lintFIX#1

* logout Fix #3

* logout Fix #4

* logout Fix #5

* logout Fix #6

* logout Fix #7
  • Loading branch information
aAmitSengar authored May 24, 2022
1 parent 18a161f commit b614cd3
Show file tree
Hide file tree
Showing 20 changed files with 261 additions and 82 deletions.
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,13 +42,12 @@
"@angular/router": "~8.2.1",
"@angular/service-worker": "~8.2.1",
"@project-sunbird/telemetry-sdk": "0.0.26",
"@sunbird-cb/collection": "1.0.11",
"@sunbird-cb/collection": "^1.0.11",
"@sunbird-cb/design-system": "0.0.1",
"@sunbird-cb/rain-dashboards": "^0.2.0",
"@sunbird-cb/resolver": "^1.0.0",
"@sunbird-cb/utils": "^1.0.8",
"@sunbird-cb/utils": "^1.0.12",
"@types/file-saver": "^2.0.1",
"uuid": "^8.3.2",
"brace": "^0.11.1",
"chart.js": "^2.8.0",
"d3": "^5.9.7",
Expand Down Expand Up @@ -86,6 +85,7 @@
"topojson-client": "^3.1.0",
"tslib": "^1.10.0",
"typeface-roboto": "0.0.75",
"uuid": "^8.3.2",
"video.js": "7.6.0",
"videojs-contrib-quality-levels": "^2.0.9",
"videojs-hls-quality-selector": "^1.0.5",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { Observable } from 'rxjs'
const API_END_POINTS = {
WORKFLOW_TO_APPROVE: '/apis/protected/v8/workflowhandler/applicationsSearch',
// PROFILE_REGISTRY: 'apis/protected/v8/user/profileRegistry/getUserRegistryByUser/',
PROFILE_REGISTRY: 'apis/proxies/v8/api/user/v5/read/',
PROFILE_REGISTRY: 'apis/proxies/v8/api/user/v2/read/',
WORKFLOW_HANDLER: 'apis/protected/v8/workflowhandler/transition',
WF_HISTORY_BY_APPID: 'apis/protected/v8/workflowhandler/historyByApplicationId/',
// GET_MY_DEPARTMENT: '/apis/protected/v8/portal/mdo/mydepartment?allUsers=false',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ const API_END_POINTS = {
GET_MY_DEPARTMENT: '/apis/protected/v8/portal/mdo/mydepartment?allUsers=true',
CREATE_USER: 'apis/protected/v8/admin/userRegistration/create-user',
// PROFILE_REGISTRY: 'apis/protected/v8/user/profileRegistry/getUserRegistryByUser/',
PROFILE_REGISTRY: '/apis/proxies/v8/api/user/v5/read/',
PROFILE_REGISTRY: '/apis/proxies/v8/api/user/v2/read/',
ADD_USER_TO_DEPARTMENT: 'apis/protected/v8/portal/deptAction',
WF_HISTORY_BY_APPID: 'apis/protected/v8/workflowhandler/historyByApplicationId/',
SEARCH_USER: 'apis/protected/v8/user/autocomplete/department',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,11 @@ export class BudgetproofspopupComponent implements OnInit {
dataSource = new MatTableDataSource<PeriodicElement>(this.uploadedFilesAssets)
selection = new SelectionModel<PeriodicElement>(true, [])

constructor(private dialogRef: MatDialogRef<BudgetproofspopupComponent>, @Inject(MAT_DIALOG_DATA) data: any,
private uploadService: UploadService) {
constructor(
private dialogRef: MatDialogRef<BudgetproofspopupComponent>,
@Inject(MAT_DIALOG_DATA) data: any,
private uploadService: UploadService,
) {
this.sectioname = data.data
this.uploadform = new FormGroup({
files: new FormControl('', [Validators.required]),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ const API_END_POINTS = {
PROFILE_DETAIL: `${PROTECTED_SLAG_V8}/social/post/timeline`,
SOCIAL_VIEW_CONVERSATION: `${PROTECTED_SLAG_V8}/social/post/viewConversation`,
// getUserdetailsV2FromRegistry: '/apis/protected/v8/user/profileRegistry/getUserRegistryByUser',
READ_PROFILE: '/apis/proxies/v8/api/user/v5/read',
READ_PROFILE: '/apis/proxies/v8/api/user/v2/read',
CHECK_ISADMIN: '/apis/protected/v8/portal/isAdmin/mdo',
// GET_MY_DEPARTMENT: '/apis/protected/v8/portal/mdo/mydepartment?allUsers=false',
GET_MY_DEPARTMENT_ALL: '/apis/protected/v8/portal/mdo/mydepartment?allUsers=true',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { Observable } from 'rxjs'
import { HttpClient } from '@angular/common/http'

const API_END_POINTS = {
GETPRFOILEDATA: 'apis/proxies/v8/api/user/v5/read',
GETPRFOILEDATA: 'apis/proxies/v8/api/user/v2/read',
CREATE_ASSET: 'apis/proxies/v8/action/content/v3/create',
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { ConfigurationsService } from '@sunbird-cb/utils'
const PROTECTED_SLAG_V8 = '/apis/protected/v8'
const API_END_POINTS = {
USERS: `${PROTECTED_SLAG_V8}/workallocation/userSearch`,
GET_ALL_USERS: `/apis/proxies/v8/api/user/v5/read`,
GET_ALL_USERS: `/apis/proxies/v8/api/user/v2/read`,
GET_ALL_WAT_LIST: `${PROTECTED_SLAG_V8}/workallocation/getWorkOrders`,
GET_USER_BY_WID: `${PROTECTED_SLAG_V8}/workallocation/getUserBasicInfo/`,
ADD_WORK_ORDERS: `${PROTECTED_SLAG_V8}/workallocation/add/workorder`,
Expand Down
4 changes: 2 additions & 2 deletions project/ws/app/src/lib/routes/users/services/users.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ const API_END_POINTS = {
// CREATE_USER: 'apis/protected/v8/admin/userRegistration/create-user',
CREATE_USER: 'apis/protected/v8/user/profileDetails/createUser',
// PROFILE_REGISTRY: 'apis/protected/v8/user/profileRegistry/getUserRegistryByUser/',
PROFILE_REGISTRY_V1: '/apis/proxies/v8/api/user/v5/read/',
PROFILE_REGISTRY_V2: '/apis/proxies/v8/api/user/v5/read',
PROFILE_REGISTRY_V1: '/apis/proxies/v8/api/user/v2/read/',
PROFILE_REGISTRY_V2: '/apis/proxies/v8/api/user/v2/read',
CREATE_PROFILE_REGISTRY: '/apis/protected/v8/user/profileRegistry/createUserRegistryV2',
ADD_USER_TO_DEPARTMENT: '/apis/proxies/v8/user/private/v1/assign/role',
WF_HISTORY_BY_APPID: 'apis/protected/v8/workflowhandler/historyByApplicationId/',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { HttpClient } from '@angular/common/http'
import { Observable } from 'rxjs'

const API_END_POINTS = {
GETPRFOILEDATA: 'apis/proxies/v8/api/user/v5/read',
GETPRFOILEDATA: 'apis/proxies/v8/api/user/v2/read',
CREATE_ASSET: 'apis/proxies/v8/action/content/v3/create',
UPLOAD_FILE: 'apis/proxies/v8/upload/action/content/v3/upload',
UPDATE_WORKORDER: 'apis/protected/v8/workallocation/update/workorder',
Expand Down
5 changes: 5 additions & 0 deletions src/app/app-routing.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import { PublicFaqComponent } from './routes/public/public-faq/public-faq.compon
import { TncComponent } from './routes/tnc/tnc.component'
import { TncAppResolverService } from './services/tnc-app-resolver.service'
import { TncPublicResolverService } from './services/tnc-public-resolver.service'
import { PublicLogoutComponent } from './routes/public/public-logout/public-logout.component'
// import { AppTocResolverService } from '@ws/app/src/lib/routes/app-toc/resolvers/app-toc-resolver.service'

// 💥💥💥💥💥💥💥💥💥💥💥💥💥💥💥💥💥💥💥💥💥💥💥💥💥💥💥💥💥💥💥💥💥💥💥💥💥💥💥
Expand Down Expand Up @@ -307,6 +308,10 @@ const routes: Routes = [
pageData: PageResolve,
},
},
{
path: 'public/logout',
component: PublicLogoutComponent,
},
{
path: 'public/mobile-app',
component: MobileAppHomeComponent,
Expand Down
2 changes: 2 additions & 0 deletions src/app/app.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ import { TncPublicResolverService } from './services/tnc-public-resolver.service
import { FormsModule, ReactiveFormsModule } from '@angular/forms'
import { ServiceWorkerModule } from '@angular/service-worker'
import { environment } from '../environments/environment'
import { PublicLogoutModule } from './routes/public/public-logout/public-logout.module'
@Injectable()
export class HammerConfig extends GestureConfig {
buildHammer(element: HTMLElement) {
Expand Down Expand Up @@ -138,6 +139,7 @@ const getBaseHref = (platformLocation: PlatformLocation): string => {
MobileAppModule,
PipeSafeSanitizerModule,
TourModule,
PublicLogoutModule,
ServiceWorkerModule.register('ngsw-worker.js', { enabled: environment.production }),
],
exports: [
Expand Down
12 changes: 10 additions & 2 deletions src/app/component/app-nav-bar/app-nav-bar.component.html
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<mat-toolbar [color]="primaryNavbarBackground?.color" [ngStyle]="primaryNavbarBackground?.styles"
<mat-toolbar *ngIf="showAppNavBar" [color]="primaryNavbarBackground?.color" [ngStyle]="primaryNavbarBackground?.styles"
class="mat-elevation-z3 custom mobile">
<div class="fix-ww" id="root-tool-bar" title="toolbar" i18n-aria-label role="toolbar">
<ng-container *ngIf="mode === 'top'">
Expand Down Expand Up @@ -74,7 +74,15 @@
</ng-container>
</div> -->
</mat-toolbar>

<mat-toolbar *ngIf="!showAppNavBar">
<div class="fix-ww" id="root-tool-bar" title="toolbar" i18n-aria-label role="toolbar">
<ng-container *ngIf="mode === 'top'">
<a class="logo-dim" role="link" title="Home" i18n-aria-title i18n-aria-label>
<img [src]="appIcon" alt="Application Logo" class="app-logo" />
</a>
</ng-container>
</div>
</mat-toolbar>
<ng-template #navbarSide let-item="item">
<ng-container *ngIf="item.type === 'widgetButton'" [wsResolverWidget]="item.config"></ng-container>
<ws-widget-btn-feature *ngIf="item.type === 'featureButton' && item.config.actionBtnId !== 'feature_notification'"
Expand Down
5 changes: 3 additions & 2 deletions src/app/component/app-nav-bar/app-nav-bar.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,12 +55,13 @@ export class AppNavBarComponent implements OnInit, OnChanges {
ngOnInit() {
this.router.events.subscribe((e: Event) => {
if (e instanceof NavigationEnd) {
if ((e.url.includes('/app/setup') && this.configSvc.instanceConfig && !this.configSvc.instanceConfig.showNavBarInSetup)) {
if (e.url.includes('/public/logout')) {
this.showAppNavBar = false
} else if ((e.url.includes('/app/setup') && this.configSvc.instanceConfig && !this.configSvc.instanceConfig.showNavBarInSetup)) {
this.showAppNavBar = false
} else {
this.showAppNavBar = true
}

}
})

Expand Down
20 changes: 10 additions & 10 deletions src/app/component/root/root.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -87,19 +87,19 @@ export class RootComponent implements OnInit, AfterViewInit {
) {
this.mobileAppsSvc.init()
}
private get defaultRedirectUrl(): string {
try {
const baseUrl = document.baseURI
return baseUrl || location.origin
} catch (error) {
return location.origin
}
}
// private get defaultRedirectUrl(): string {
// try {
// const baseUrl = document.baseURI
// return baseUrl || location.origin
// } catch (error) {
// return location.origin
// }
// }
@HostListener('window:unload', ['$event'])
unloadHandler(event: any) {
if (event && event.type === 'unload') {
this.authSvc.logout()
window.location.href = `${this.defaultRedirectUrl}apis/reset`
// this.authSvc.logout()
// window.location.href = `${this.defaultRedirectUrl}apis/reset`
}
}
ngOnInit() {
Expand Down
25 changes: 25 additions & 0 deletions src/app/routes/public/public-logout/public-logout.component.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
<div class="main_container flex flex-row">
<div class="left_container flex flex-col items-center justify-center">
<div class="logo_box flex items-center">
<img src="/assets/instances/eagle/app_logos/KarmayogiBharat_Logo_Horizontal.svg" alt="logo">
</div>
<div class="slider_box items-center flex">
<img class="width-1-1" src="/assets/instances/eagle/banners/home/1/s.jpg" alt="slider1">
</div>
</div>
<div class=" right_container flex flex-col items-center justify-center">
<div class="right_inner_container">
<div class="right_logo_box">
<img src="/assets/instances/eagle/app_logos/KarmayogiBharat_Logo_Horizontal.svg" alt="logo">
</div>
<div class="text_box flex items-center justify-center">
<h1 class="text-3xl"> You are logged out!</h1>
</div>
<div class="button_box flex flex-col items-center justify-center">
<button class="button m_b_2" (click)="login()">Login to portal</button>
<!-- <button class="button m_b_2">Login to MDO portal</button> -->
</div>
</div>

</div>
</div>
57 changes: 57 additions & 0 deletions src/app/routes/public/public-logout/public-logout.component.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
body {
font-family: 'Poppins', sans-serif;
position: relative;
letter-spacing: 0.2px;
// background: url(images/Login_background.png) no-repeat center center fixed;
background-size: cover;
}

.right_container {
background-color: #fff;
width: 45%;
height: 100vh;
box-sizing: border-box;
box-shadow: 0px 20px 60px #3e3e3e29;
}

.left_container {
padding: 4.5rem 6rem;
box-sizing: border-box;
width: 55%;
height: 100vh;
}

.logo_box {
width: 320px;
}

.slider_box {
padding: 5rem 0 2rem 0;
width: 320px;
box-sizing: border-box;
box-sizing: border-box;
}

.text_box {
margin: 3rem 0;
}

.right_inner_container {
width: 320px;
}

.m_b_2 {
margin-bottom: 1rem;
}

.button {
font-family: 'Poppins', sans-serif;
color: #F9F9F9;
font-size: 14px;
line-height: 19px;
height: 40px;
background-color: rgb(0, 116, 182, 1);
border-radius: 8px;
transition: all .25s ease-in;
width: 100%;
}
45 changes: 45 additions & 0 deletions src/app/routes/public/public-logout/public-logout.component.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
import { Component, OnInit, OnDestroy } from '@angular/core'
import { ConfigurationsService, NsPage } from '@sunbird-cb/utils'
import { Subscription } from 'rxjs'
import { ActivatedRoute } from '@angular/router'

@Component({
selector: 'ws-public-logout',
templateUrl: './public-logout.component.html',
styleUrls: ['./public-logout.component.scss'],
})
export class PublicLogoutComponent implements OnInit, OnDestroy {
contactUsMail = ''
contactPage: any
platform = 'Learner'
panelOpenState = false
pageNavbar: Partial<NsPage.INavBackground> = this.configSvc.pageNavBar
private subscriptionContact: Subscription | null = null

constructor(
private configSvc: ConfigurationsService,
private activateRoute: ActivatedRoute,
// private authSvc: AuthKeycloakService,
) { }

ngOnInit() {
this.subscriptionContact = this.activateRoute.data.subscribe(data => {
this.contactPage = data.pageData.data
})
if (this.configSvc.instanceConfig) {
this.contactUsMail = this.configSvc.instanceConfig.mailIds.contactUs
}
// this.authSvc.force_logout().then(() => { })
}

ngOnDestroy() {
if (this.subscriptionContact) {
this.subscriptionContact.unsubscribe()
}
}
login() {
const host = window.location.origin
window.location.href = `${host}/protected/v8/resource`
// window.location.reload()
}
}
28 changes: 28 additions & 0 deletions src/app/routes/public/public-logout/public-logout.module.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
import { NgModule } from '@angular/core'
import { CommonModule } from '@angular/common'
import { PublicLogoutComponent } from './public-logout.component'
import {
MatToolbarModule,
MatCardModule,
MatDividerModule,
MatIconModule,
MatExpansionModule,
} from '@angular/material'
import { BtnPageBackModule } from '@sunbird-cb/collection'
import { PipeSafeSanitizerModule } from '@sunbird-cb/utils'

@NgModule({
declarations: [PublicLogoutComponent],
imports: [
CommonModule,
MatToolbarModule,
MatCardModule,
BtnPageBackModule,
MatDividerModule,
MatIconModule,
MatExpansionModule,
PipeSafeSanitizerModule,
],
exports: [PublicLogoutComponent],
})
export class PublicLogoutModule { }
Loading

0 comments on commit b614cd3

Please sign in to comment.