Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue #ED-2318 #ED-2600 fix: Fixed login issue and blank page #3467

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 7 additions & 4 deletions src/app/profile/categories-edit/categories-edit.page.ts
Original file line number Diff line number Diff line change
@@ -35,6 +35,7 @@ import { SbProgressLoader } from '../../../services/sb-progress-loader.service';
import { ProfileHandler } from '../../../services/profile-handler';
import { SegmentationTagService, TagPrefixConstants } from '../../../services/segmentation-tag/segmentation-tag.service';
import { CategoriesEditService } from './categories-edit.service';
import { TncUpdateHandlerService } from '../../../services/handlers/tnc-update-handler.service';


@Component({
@@ -102,6 +103,7 @@ export class CategoriesEditPage implements OnInit, OnDestroy {
};

isBoardAvailable = true;
isSSOUser = false;

get syllabusControl(): FormControl {
return this.profileEditForm.get('syllabus') as FormControl;
@@ -142,8 +144,8 @@ export class CategoriesEditPage implements OnInit, OnDestroy {
private segmentationTagService: SegmentationTagService,
private categoriesEditService: CategoriesEditService,
private telemetryGeneratorService: TelemetryGeneratorService,
private formAndFrameworkUtilService: FormAndFrameworkUtilService

private formAndFrameworkUtilService: FormAndFrameworkUtilService,
private tncUpdateHandlerService: TncUpdateHandlerService,
) {
this.appGlobalService.closeSigninOnboardingLoader();
this.profile = this.appGlobalService.getCurrentUser();
@@ -167,6 +169,7 @@ export class CategoriesEditPage implements OnInit, OnDestroy {
this.userType = await this.preferences.getString(PreferenceKey.SELECTED_USER_TYPE).toPromise();
this.getCategoriesAndUpdateAttributes((this.profile.serverProfile.profileUserTypes.length > 1 ?
this.profile.serverProfile.profileUserTypes[0].type : this.profile.profileType) || undefined);
this.isSSOUser = await this.tncUpdateHandlerService.isSSOUser(this.profile);
}

ngOnDestroy() {
@@ -299,7 +302,7 @@ export class CategoriesEditPage implements OnInit, OnDestroy {
this.mediumList = (await this.frameworkUtilService.getFrameworkCategoryTerms(nextCategoryTermsRequet).toPromise())
.map(t => ({ name: t.name, code: t.code }));
if (!this.mediumControl.value) {
this.mediumControl.patchValue((this.profile.medium.length ? this.profile.medium : this.guestUserProfile.medium) || []);
this.mediumControl.patchValue((this.profile.medium.length ? this.profile.medium : (this.isSSOUser ? [] : this.guestUserProfile.medium)) || []);
} else {
this.mediumControl.patchValue([]);
}
@@ -337,7 +340,7 @@ export class CategoriesEditPage implements OnInit, OnDestroy {
this.gradeList = (await this.frameworkUtilService.getFrameworkCategoryTerms(nextCategoryTermsRequet).toPromise())
.map(t => ({ name: t.name, code: t.code }));
if (!this.gradeControl.value) {
this.gradeControl.patchValue((this.profile.grade.length ? this.profile.grade : this.guestUserProfile.grade) || []);
this.gradeControl.patchValue((this.profile.grade.length ? this.profile.grade : (this.isSSOUser ? [] : this.guestUserProfile.grade)) || []);
} else {
this.gradeControl.patchValue([]);
}
2 changes: 1 addition & 1 deletion src/app/profile/profile.page.ts
Original file line number Diff line number Diff line change
@@ -363,7 +363,7 @@ export class ProfilePage implements OnInit {
that.isStateValidated = that.profile.stateValidated;
resolve();
}).catch(e => console.error(e));
if(profileData && profileData.framework && Object.keys(profileData.framework).length == 0) {
if(profileData && profileData.framework && Object.keys(profileData.framework).length == 0 && this.isCustodianOrgId) {
await this.getFrameworkDetails();
}
});
7 changes: 4 additions & 3 deletions src/services/formandframeworkutil.service.ts
Original file line number Diff line number Diff line change
@@ -21,6 +21,7 @@ import {
WebviewSessionProviderConfig,
SignInError,
FrameworkCategoryCode,
ProfileType,
} from '@project-sunbird/sunbird-sdk';

import { ContentFilterConfig, PreferenceKey, SystemSettingsIds, PrimaryCategory } from '../app/app.constant';
@@ -728,7 +729,7 @@ export class FormAndFrameworkUtilService {
}

private async setSupportedAttributes(framework, userType?: string) {
if (!userType) {
if (!userType || userType === ProfileType.NONE) {
userType = await this.preferences.getString(PreferenceKey.SELECTED_USER_TYPE).toPromise();
}
const frameworkDetails = {};
@@ -757,15 +758,15 @@ export class FormAndFrameworkUtilService {

getFrameworkCategoryList(userType?: string): Promise<any> {
return new Promise((resolve, reject) => {
if (!userType) {
if (!userType || userType === ProfileType.NONE) {
this.preferences.getString(PreferenceKey.SELECTED_USER_TYPE).toPromise().then((type) => {
userType = type;
}).catch((e) => console.error(e));
}
const framework = this.appGlobalService.getCachedFrameworkCategory();
console.log('................', framework);
if (Object.keys(framework).length === 0 || (Object.keys(framework).length > 0 &&
(framework.userType !== userType || !userType))) {
(framework.userType !== userType || !userType || userType === ProfileType.NONE))) {
this.invokeFrameworkCategoriesFormApi(userType).then((res) => {
resolve(res);
}).catch((e) => console.error(e));
9 changes: 5 additions & 4 deletions src/services/handlers/tnc-update-handler.service.ts
Original file line number Diff line number Diff line change
@@ -190,7 +190,7 @@ export class TncUpdateHandlerService {
await this.consentService.getConsent(profile, true);
}
if (profile.profileType === ProfileType.NONE || profile.profileType === ProfileType.OTHER.toUpperCase()) {
if (onboarding.skipOnboardingForLoginUser) {
if (onboarding.skipOnboardingForLoginUser && !isSSoUser) {
await this.updateUserAsGuest();
} else {
await this.router.navigate([RouterLinks.USER_TYPE_SELECTION_LOGGEDIN], {
@@ -233,7 +233,8 @@ export class TncUpdateHandlerService {
private async checkBmc(profile) {
const locationMappingConfig: FieldConfig<any>[] = await this.formAndFrameworkUtilService.getFormFields(FormConstants.LOCATION_MAPPING);
const userDetails = await this.profileService.getActiveSessionProfile({ requiredFields: ProfileConstants.REQUIRED_FIELDS }).toPromise();
if (await this.isSSOUser(userDetails)) {
const isSSOUser = await this.isSSOUser(userDetails);
if (isSSOUser) {
await this.consentService.getConsent(userDetails, true);
}
if ((userDetails && userDetails.grade && userDetails.medium && userDetails.syllabus &&
@@ -245,8 +246,8 @@ export class TncUpdateHandlerService {
const guestProfile = await this.commonUtilService.getGuestUserConfig().then((profile) => {
return profile;
});
if ( guestProfile.board && guestProfile.board.length && onboarding.skipOnboardingForLoginUser && userDetails.profileType !== ProfileType.ADMIN) {
await this.updateUserAsGuest(guestProfile);
if ( guestProfile.board && guestProfile.board.length && onboarding.skipOnboardingForLoginUser && userDetails.profileType !== ProfileType.ADMIN && !isSSOUser) {
await this.updateUserAsGuest(guestProfile);
} else {
await this.preRequirementToBmcNavigation(profile.userId, locationMappingConfig);
}