forked from EVOgeek/Vmeda.Online
		
	MOBILE-4469 login: Move login constants to new file
This commit is contained in:
		
							parent
							
								
									0c50ebd310
								
							
						
					
					
						commit
						006f9018a9
					
				| @ -16,7 +16,7 @@ import { AfterViewInit, Component, ElementRef, HostBinding, OnDestroy } from '@a | |||||||
| 
 | 
 | ||||||
| import { CoreUtils } from '@services/utils/utils'; | import { CoreUtils } from '@services/utils/utils'; | ||||||
| import { ModalController, Translate } from '@singletons'; | import { ModalController, Translate } from '@singletons'; | ||||||
| import { CoreLoginHelperProvider, GET_STARTED_URL } from '@features/login/services/login-helper'; | import { FAQ_QRCODE_IMAGE_HTML, FAQ_URL_IMAGE_HTML, GET_STARTED_URL } from '@features/login/constants'; | ||||||
| import { CoreDomUtils } from '@services/utils/dom'; | import { CoreDomUtils } from '@services/utils/dom'; | ||||||
| import { CoreCancellablePromise } from '@classes/cancellable-promise'; | import { CoreCancellablePromise } from '@classes/cancellable-promise'; | ||||||
| 
 | 
 | ||||||
| @ -39,8 +39,8 @@ export class CoreLoginSiteHelpComponent implements AfterViewInit, OnDestroy { | |||||||
|     constructor(protected el: ElementRef<HTMLElement>) { |     constructor(protected el: ElementRef<HTMLElement>) { | ||||||
|         const getStartedTitle = Translate.instant('core.login.faqsetupsitelinktitle'); |         const getStartedTitle = Translate.instant('core.login.faqsetupsitelinktitle'); | ||||||
|         const canScanQR = CoreUtils.canScanQR(); |         const canScanQR = CoreUtils.canScanQR(); | ||||||
|         const urlImageHtml = CoreLoginHelperProvider.FAQ_URL_IMAGE_HTML; |         const urlImageHtml = FAQ_URL_IMAGE_HTML; | ||||||
|         const qrCodeImageHtml = CoreLoginHelperProvider.FAQ_QRCODE_IMAGE_HTML; |         const qrCodeImageHtml = FAQ_QRCODE_IMAGE_HTML; | ||||||
|         const setupLinkHtml = `<a href="${GET_STARTED_URL}" title="${getStartedTitle}">${GET_STARTED_URL}</a>`; |         const setupLinkHtml = `<a href="${GET_STARTED_URL}" title="${getStartedTitle}">${GET_STARTED_URL}</a>`; | ||||||
|         const questions: Array<QuestionDefinition | false> = [ |         const questions: Array<QuestionDefinition | false> = [ | ||||||
|             { |             { | ||||||
|  | |||||||
| @ -16,7 +16,7 @@ import { Component } from '@angular/core'; | |||||||
| 
 | 
 | ||||||
| import { CoreConfig } from '@services/config'; | import { CoreConfig } from '@services/config'; | ||||||
| import { CoreUtils } from '@services/utils/utils'; | import { CoreUtils } from '@services/utils/utils'; | ||||||
| import { CoreLoginHelperProvider, GET_STARTED_URL } from '@features/login/services/login-helper'; | import { GET_STARTED_URL, ONBOARDING_DONE } from '@features/login/constants'; | ||||||
| import { ModalController } from '@singletons'; | import { ModalController } from '@singletons'; | ||||||
| 
 | 
 | ||||||
| /** | /** | ||||||
| @ -88,7 +88,7 @@ export class CoreLoginSiteOnboardingComponent { | |||||||
|      * Saves the onboarding has finished. |      * Saves the onboarding has finished. | ||||||
|      */ |      */ | ||||||
|     protected saveOnboardingDone(): void { |     protected saveOnboardingDone(): void { | ||||||
|         CoreConfig.set(CoreLoginHelperProvider.ONBOARDING_DONE, 1); |         CoreConfig.set(ONBOARDING_DONE, 1); | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
| } | } | ||||||
|  | |||||||
							
								
								
									
										23
									
								
								src/core/features/login/constants.ts
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										23
									
								
								src/core/features/login/constants.ts
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,23 @@ | |||||||
|  | // (C) Copyright 2015 Moodle Pty Ltd.
 | ||||||
|  | //
 | ||||||
|  | // Licensed under the Apache License, Version 2.0 (the "License");
 | ||||||
|  | // you may not use this file except in compliance with the License.
 | ||||||
|  | // You may obtain a copy of the License at
 | ||||||
|  | //
 | ||||||
|  | //     http://www.apache.org/licenses/LICENSE-2.0
 | ||||||
|  | //
 | ||||||
|  | // Unless required by applicable law or agreed to in writing, software
 | ||||||
|  | // distributed under the License is distributed on an "AS IS" BASIS,
 | ||||||
|  | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 | ||||||
|  | // See the License for the specific language governing permissions and
 | ||||||
|  | // limitations under the License.
 | ||||||
|  | 
 | ||||||
|  | export const GET_STARTED_URL = 'https://moodle.com'; | ||||||
|  | export const ONBOARDING_DONE = 'onboarding_done'; | ||||||
|  | export const FAQ_QRCODE_INFO_DONE = 'qrcode_info_done'; | ||||||
|  | export const FAQ_URL_IMAGE_HTML = '<img src="assets/img/login/faq_url.png" role="presentation" alt="">'; | ||||||
|  | export const FAQ_QRCODE_IMAGE_HTML = '<img src="assets/img/login/faq_qrcode.png" role="presentation" alt="">'; | ||||||
|  | export const EMAIL_SIGNUP_FEATURE_NAME = 'CoreLoginEmailSignup'; | ||||||
|  | export const FORGOTTEN_PASSWORD_FEATURE_NAME = 'NoDelegate_ForgottenPassword'; | ||||||
|  | export const IDENTITY_PROVIDERS_FEATURE_NAME = 'NoDelegate_IdentityProviders'; | ||||||
|  | export const IDENTITY_PROVIDER_FEATURE_NAME_PREFIX = 'NoDelegate_IdentityProvider_'; | ||||||
| @ -21,7 +21,7 @@ import { CoreApp } from '@services/app'; | |||||||
| import { CoreNetwork } from '@services/network'; | import { CoreNetwork } from '@services/network'; | ||||||
| import { CoreSiteCheckResponse, CoreSites } from '@services/sites'; | import { CoreSiteCheckResponse, CoreSites } from '@services/sites'; | ||||||
| import { CoreDomUtils } from '@services/utils/dom'; | import { CoreDomUtils } from '@services/utils/dom'; | ||||||
| import { CoreLoginHelper, CoreLoginHelperProvider } from '@features/login/services/login-helper'; | import { CoreLoginHelper } from '@features/login/services/login-helper'; | ||||||
| import { Translate } from '@singletons'; | import { Translate } from '@singletons'; | ||||||
| import { CoreSitePublicConfigResponse, CoreUnauthenticatedSite } from '@classes/sites/unauthenticated-site'; | import { CoreSitePublicConfigResponse, CoreUnauthenticatedSite } from '@classes/sites/unauthenticated-site'; | ||||||
| import { CoreEvents } from '@singletons/events'; | import { CoreEvents } from '@singletons/events'; | ||||||
| @ -33,6 +33,7 @@ import { CoreUserGuestSupportConfig } from '@features/user/classes/support/guest | |||||||
| import { SafeHtml } from '@angular/platform-browser'; | import { SafeHtml } from '@angular/platform-browser'; | ||||||
| import { CorePlatform } from '@services/platform'; | import { CorePlatform } from '@services/platform'; | ||||||
| import { CoreSitesFactory } from '@services/sites-factory'; | import { CoreSitesFactory } from '@services/sites-factory'; | ||||||
|  | import { EMAIL_SIGNUP_FEATURE_NAME, FORGOTTEN_PASSWORD_FEATURE_NAME } from '@features/login/constants'; | ||||||
| 
 | 
 | ||||||
| /** | /** | ||||||
|  * Page to enter the user credentials. |  * Page to enter the user credentials. | ||||||
| @ -199,9 +200,8 @@ export class CoreLoginCredentialsPage implements OnInit, OnDestroy { | |||||||
|             this.showScanQR = await CoreLoginHelper.displayQRInCredentialsScreen(this.siteConfig.tool_mobile_qrcodetype); |             this.showScanQR = await CoreLoginHelper.displayQRInCredentialsScreen(this.siteConfig.tool_mobile_qrcodetype); | ||||||
|         } |         } | ||||||
| 
 | 
 | ||||||
|         this.canSignup = this.siteConfig.registerauth == 'email' && |         this.canSignup = this.siteConfig.registerauth == 'email' && !this.site.isFeatureDisabled(EMAIL_SIGNUP_FEATURE_NAME); | ||||||
|             !this.site.isFeatureDisabled(CoreLoginHelperProvider.EMAIL_SIGNUP_FEATURE_NAME); |         this.showForgottenPassword = !this.site.isFeatureDisabled(FORGOTTEN_PASSWORD_FEATURE_NAME); | ||||||
|         this.showForgottenPassword = !this.site.isFeatureDisabled(CoreLoginHelperProvider.FORGOTTEN_PASSWORD_FEATURE_NAME); |  | ||||||
|         this.exceededAttemptsHTML = CoreLoginHelper.buildExceededAttemptsHTML( |         this.exceededAttemptsHTML = CoreLoginHelper.buildExceededAttemptsHTML( | ||||||
|             !!this.supportConfig?.canContactSupport(), |             !!this.supportConfig?.canContactSupport(), | ||||||
|             this.showForgottenPassword, |             this.showForgottenPassword, | ||||||
|  | |||||||
| @ -27,7 +27,6 @@ import { | |||||||
|     AuthEmailSignupProfileFieldsCategory, |     AuthEmailSignupProfileFieldsCategory, | ||||||
|     AuthEmailSignupSettings, |     AuthEmailSignupSettings, | ||||||
|     CoreLoginHelper, |     CoreLoginHelper, | ||||||
|     CoreLoginHelperProvider, |  | ||||||
| } from '@features/login/services/login-helper'; | } from '@features/login/services/login-helper'; | ||||||
| import { CoreNavigator } from '@services/navigator'; | import { CoreNavigator } from '@services/navigator'; | ||||||
| import { CoreForms } from '@singletons/form'; | import { CoreForms } from '@singletons/form'; | ||||||
| @ -35,6 +34,7 @@ import { CoreRecaptchaComponent } from '@components/recaptcha/recaptcha'; | |||||||
| import { CorePath } from '@singletons/path'; | import { CorePath } from '@singletons/path'; | ||||||
| import { CoreDom } from '@singletons/dom'; | import { CoreDom } from '@singletons/dom'; | ||||||
| import { CoreSitesFactory } from '@services/sites-factory'; | import { CoreSitesFactory } from '@services/sites-factory'; | ||||||
|  | import { EMAIL_SIGNUP_FEATURE_NAME } from '@features/login/constants'; | ||||||
| 
 | 
 | ||||||
| /** | /** | ||||||
|  * Page to signup using email. |  * Page to signup using email. | ||||||
| @ -238,10 +238,7 @@ export class CoreLoginEmailSignupPage implements OnInit { | |||||||
|      * @returns True if success. |      * @returns True if success. | ||||||
|      */ |      */ | ||||||
|     protected async treatSiteConfig(): Promise<boolean> { |     protected async treatSiteConfig(): Promise<boolean> { | ||||||
|         if ( |         if (this.siteConfig?.registerauth == 'email' && !this.site.isFeatureDisabled(EMAIL_SIGNUP_FEATURE_NAME)) { | ||||||
|             this.siteConfig?.registerauth == 'email' && |  | ||||||
|             !this.site.isFeatureDisabled(CoreLoginHelperProvider.EMAIL_SIGNUP_FEATURE_NAME) |  | ||||||
|         ) { |  | ||||||
|             this.siteName = await this.site.getSiteName(); |             this.siteName = await this.site.getSiteName(); | ||||||
| 
 | 
 | ||||||
|             this.authInstructions = this.siteConfig.authinstructions; |             this.authInstructions = this.siteConfig.authinstructions; | ||||||
|  | |||||||
| @ -20,7 +20,7 @@ import { CoreNetwork } from '@services/network'; | |||||||
| import { CoreSiteBasicInfo, CoreSites, CoreSitesReadingStrategy } from '@services/sites'; | import { CoreSiteBasicInfo, CoreSites, CoreSitesReadingStrategy } from '@services/sites'; | ||||||
| import { CoreDomUtils } from '@services/utils/dom'; | import { CoreDomUtils } from '@services/utils/dom'; | ||||||
| import { CoreUtils } from '@services/utils/utils'; | import { CoreUtils } from '@services/utils/utils'; | ||||||
| import { CoreLoginHelper, CoreLoginHelperProvider } from '@features/login/services/login-helper'; | import { CoreLoginHelper } from '@features/login/services/login-helper'; | ||||||
| import { CoreSite } from '@classes/sites/site'; | import { CoreSite } from '@classes/sites/site'; | ||||||
| import { CoreEvents } from '@singletons/events'; | import { CoreEvents } from '@singletons/events'; | ||||||
| import { CoreError } from '@classes/errors/error'; | import { CoreError } from '@classes/errors/error'; | ||||||
| @ -32,6 +32,7 @@ import { CoreUserAuthenticatedSupportConfig } from '@features/user/classes/suppo | |||||||
| import { Translate } from '@singletons'; | import { Translate } from '@singletons'; | ||||||
| import { SafeHtml } from '@angular/platform-browser'; | import { SafeHtml } from '@angular/platform-browser'; | ||||||
| import { CoreSitePublicConfigResponse } from '@classes/sites/unauthenticated-site'; | import { CoreSitePublicConfigResponse } from '@classes/sites/unauthenticated-site'; | ||||||
|  | import { FORGOTTEN_PASSWORD_FEATURE_NAME } from '@features/login/constants'; | ||||||
| 
 | 
 | ||||||
| /** | /** | ||||||
|  * Page to enter the user password to reconnect to a site. |  * Page to enter the user password to reconnect to a site. | ||||||
| @ -171,7 +172,7 @@ export class CoreLoginReconnectPage implements OnInit, OnDestroy { | |||||||
|             return; |             return; | ||||||
|         } |         } | ||||||
| 
 | 
 | ||||||
|         this.showForgottenPassword = !this.site.isFeatureDisabled(CoreLoginHelperProvider.FORGOTTEN_PASSWORD_FEATURE_NAME); |         this.showForgottenPassword = !this.site.isFeatureDisabled(FORGOTTEN_PASSWORD_FEATURE_NAME); | ||||||
|         this.exceededAttemptsHTML = CoreLoginHelper.buildExceededAttemptsHTML( |         this.exceededAttemptsHTML = CoreLoginHelper.buildExceededAttemptsHTML( | ||||||
|             !!this.supportConfig?.canContactSupport(), |             !!this.supportConfig?.canContactSupport(), | ||||||
|             this.showForgottenPassword, |             this.showForgottenPassword, | ||||||
|  | |||||||
| @ -23,7 +23,6 @@ import { CoreUtils } from '@services/utils/utils'; | |||||||
| import { CoreDomUtils } from '@services/utils/dom'; | import { CoreDomUtils } from '@services/utils/dom'; | ||||||
| import { | import { | ||||||
|     CoreLoginHelper, |     CoreLoginHelper, | ||||||
|     CoreLoginHelperProvider, |  | ||||||
|     CoreLoginSiteFinderSettings, |     CoreLoginSiteFinderSettings, | ||||||
|     CoreLoginSiteSelectorListMethod, |     CoreLoginSiteSelectorListMethod, | ||||||
| } from '@features/login/services/login-helper'; | } from '@features/login/services/login-helper'; | ||||||
| @ -48,6 +47,7 @@ import { CoreLoginError } from '@classes/errors/loginerror'; | |||||||
| import { CorePlatform } from '@services/platform'; | import { CorePlatform } from '@services/platform'; | ||||||
| import { CoreReferrer } from '@services/referrer'; | import { CoreReferrer } from '@services/referrer'; | ||||||
| import { CoreSitesFactory } from '@services/sites-factory'; | import { CoreSitesFactory } from '@services/sites-factory'; | ||||||
|  | import { ONBOARDING_DONE } from '@features/login/constants'; | ||||||
| 
 | 
 | ||||||
| /** | /** | ||||||
|  * Site (url) chooser when adding a new site. |  * Site (url) chooser when adding a new site. | ||||||
| @ -110,7 +110,7 @@ export class CoreLoginSitePage implements OnInit { | |||||||
| 
 | 
 | ||||||
|                 if (showOnboarding) { |                 if (showOnboarding) { | ||||||
|                     // Don't display onboarding in this case, and don't display it again later.
 |                     // Don't display onboarding in this case, and don't display it again later.
 | ||||||
|                     CoreConfig.set(CoreLoginHelperProvider.ONBOARDING_DONE, 1); |                     CoreConfig.set(ONBOARDING_DONE, 1); | ||||||
|                 } |                 } | ||||||
|             } else if (showOnboarding) { |             } else if (showOnboarding) { | ||||||
|                 this.initOnboarding(); |                 this.initOnboarding(); | ||||||
| @ -191,7 +191,7 @@ export class CoreLoginSitePage implements OnInit { | |||||||
|      * @returns Promise resolved when done. |      * @returns Promise resolved when done. | ||||||
|      */ |      */ | ||||||
|     protected async initOnboarding(): Promise<void> { |     protected async initOnboarding(): Promise<void> { | ||||||
|         const onboardingDone = await CoreConfig.get(CoreLoginHelperProvider.ONBOARDING_DONE, false); |         const onboardingDone = await CoreConfig.get(ONBOARDING_DONE, false); | ||||||
| 
 | 
 | ||||||
|         if (!onboardingDone) { |         if (!onboardingDone) { | ||||||
|             // Check onboarding.
 |             // Check onboarding.
 | ||||||
|  | |||||||
| @ -48,10 +48,14 @@ import { | |||||||
|     CoreUnauthenticatedSite, |     CoreUnauthenticatedSite, | ||||||
|     TypeOfLogin, |     TypeOfLogin, | ||||||
| } from '@classes/sites/unauthenticated-site'; | } from '@classes/sites/unauthenticated-site'; | ||||||
| 
 | import { | ||||||
| const PASSWORD_RESETS_CONFIG_KEY = 'password-resets'; |     EMAIL_SIGNUP_FEATURE_NAME, | ||||||
| 
 |     FAQ_QRCODE_IMAGE_HTML, | ||||||
| export const GET_STARTED_URL = 'https://moodle.com'; |     FAQ_QRCODE_INFO_DONE, | ||||||
|  |     FORGOTTEN_PASSWORD_FEATURE_NAME, | ||||||
|  |     IDENTITY_PROVIDERS_FEATURE_NAME, | ||||||
|  |     IDENTITY_PROVIDER_FEATURE_NAME_PREFIX, | ||||||
|  | } from '../constants'; | ||||||
| 
 | 
 | ||||||
| /** | /** | ||||||
|  * Helper provider that provides some common features regarding authentication. |  * Helper provider that provides some common features regarding authentication. | ||||||
| @ -59,14 +63,7 @@ export const GET_STARTED_URL = 'https://moodle.com'; | |||||||
| @Injectable({ providedIn: 'root' }) | @Injectable({ providedIn: 'root' }) | ||||||
| export class CoreLoginHelperProvider { | export class CoreLoginHelperProvider { | ||||||
| 
 | 
 | ||||||
|     static readonly ONBOARDING_DONE = 'onboarding_done'; |     protected static readonly PASSWORD_RESETS_CONFIG_KEY = 'password-resets'; | ||||||
|     static readonly FAQ_QRCODE_INFO_DONE = 'qrcode_info_done'; |  | ||||||
|     static readonly FAQ_URL_IMAGE_HTML = '<img src="assets/img/login/faq_url.png" role="presentation" alt="">'; |  | ||||||
|     static readonly FAQ_QRCODE_IMAGE_HTML = '<img src="assets/img/login/faq_qrcode.png" role="presentation" alt="">'; |  | ||||||
|     static readonly EMAIL_SIGNUP_FEATURE_NAME = 'CoreLoginEmailSignup'; |  | ||||||
|     static readonly FORGOTTEN_PASSWORD_FEATURE_NAME = 'NoDelegate_ForgottenPassword'; |  | ||||||
|     static readonly IDENTITY_PROVIDERS_FEATURE_NAME = 'NoDelegate_IdentityProviders'; |  | ||||||
|     static readonly IDENTITY_PROVIDER_FEATURE_NAME_PREFIX = 'NoDelegate_IdentityProvider_'; |  | ||||||
| 
 | 
 | ||||||
|     protected logger: CoreLogger; |     protected logger: CoreLogger; | ||||||
|     protected sessionExpiredCheckingSite: Record<string, boolean> = {}; |     protected sessionExpiredCheckingSite: Record<string, boolean> = {}; | ||||||
| @ -418,7 +415,7 @@ export class CoreLoginHelperProvider { | |||||||
|             return []; |             return []; | ||||||
|         } |         } | ||||||
|         // eslint-disable-next-line deprecation/deprecation
 |         // eslint-disable-next-line deprecation/deprecation
 | ||||||
|         if (this.isFeatureDisabled(CoreLoginHelperProvider.IDENTITY_PROVIDERS_FEATURE_NAME, siteConfig)) { |         if (this.isFeatureDisabled(IDENTITY_PROVIDERS_FEATURE_NAME, siteConfig)) { | ||||||
|             // Identity providers are disabled, return an empty list.
 |             // Identity providers are disabled, return an empty list.
 | ||||||
|             return []; |             return []; | ||||||
|         } |         } | ||||||
| @ -435,7 +432,7 @@ export class CoreLoginHelperProvider { | |||||||
|                     provider.url && |                     provider.url && | ||||||
|                     (provider.url.indexOf(httpsUrl) != -1 || provider.url.indexOf(httpUrl) != -1) && |                     (provider.url.indexOf(httpsUrl) != -1 || provider.url.indexOf(httpUrl) != -1) && | ||||||
|                     !this.isFeatureDisabled( // eslint-disable-line deprecation/deprecation
 |                     !this.isFeatureDisabled( // eslint-disable-line deprecation/deprecation
 | ||||||
|                         CoreLoginHelperProvider.IDENTITY_PROVIDER_FEATURE_NAME_PREFIX + urlParams.id, |                         IDENTITY_PROVIDER_FEATURE_NAME_PREFIX + urlParams.id, | ||||||
|                         siteConfig, |                         siteConfig, | ||||||
|                     ) |                     ) | ||||||
|                 ) { |                 ) { | ||||||
| @ -459,7 +456,7 @@ export class CoreLoginHelperProvider { | |||||||
|             return []; |             return []; | ||||||
|         } |         } | ||||||
| 
 | 
 | ||||||
|         if (site.isFeatureDisabled(CoreLoginHelperProvider.IDENTITY_PROVIDERS_FEATURE_NAME)) { |         if (site.isFeatureDisabled(IDENTITY_PROVIDERS_FEATURE_NAME)) { | ||||||
|             // Identity providers are disabled, return an empty list.
 |             // Identity providers are disabled, return an empty list.
 | ||||||
|             return []; |             return []; | ||||||
|         } |         } | ||||||
| @ -473,7 +470,7 @@ export class CoreLoginHelperProvider { | |||||||
|                 const urlParams = CoreUrlUtils.extractUrlParams(provider.url); |                 const urlParams = CoreUrlUtils.extractUrlParams(provider.url); | ||||||
| 
 | 
 | ||||||
|                 if (provider.url && (provider.url.indexOf(httpsUrl) != -1 || provider.url.indexOf(httpUrl) != -1) && |                 if (provider.url && (provider.url.indexOf(httpsUrl) != -1 || provider.url.indexOf(httpUrl) != -1) && | ||||||
|                         !site.isFeatureDisabled(CoreLoginHelperProvider.IDENTITY_PROVIDER_FEATURE_NAME_PREFIX + urlParams.id)) { |                         !site.isFeatureDisabled(IDENTITY_PROVIDER_FEATURE_NAME_PREFIX + urlParams.id)) { | ||||||
|                     validProviders.push(provider); |                     validProviders.push(provider); | ||||||
|                 } |                 } | ||||||
|             }); |             }); | ||||||
| @ -571,7 +568,7 @@ export class CoreLoginHelperProvider { | |||||||
|      */ |      */ | ||||||
|     isEmailSignupDisabled(config?: CoreSitePublicConfigResponse): boolean { |     isEmailSignupDisabled(config?: CoreSitePublicConfigResponse): boolean { | ||||||
|         // eslint-disable-next-line deprecation/deprecation
 |         // eslint-disable-next-line deprecation/deprecation
 | ||||||
|         return this.isFeatureDisabled(CoreLoginHelperProvider.EMAIL_SIGNUP_FEATURE_NAME, config); |         return this.isFeatureDisabled(EMAIL_SIGNUP_FEATURE_NAME, config); | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     /** |     /** | ||||||
| @ -617,7 +614,7 @@ export class CoreLoginHelperProvider { | |||||||
|      */ |      */ | ||||||
|     isForgottenPasswordDisabled(config?: CoreSitePublicConfigResponse): boolean { |     isForgottenPasswordDisabled(config?: CoreSitePublicConfigResponse): boolean { | ||||||
|         // eslint-disable-next-line deprecation/deprecation
 |         // eslint-disable-next-line deprecation/deprecation
 | ||||||
|         return this.isFeatureDisabled(CoreLoginHelperProvider.FORGOTTEN_PASSWORD_FEATURE_NAME, config); |         return this.isFeatureDisabled(FORGOTTEN_PASSWORD_FEATURE_NAME, config); | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     /** |     /** | ||||||
| @ -1294,14 +1291,14 @@ export class CoreLoginHelperProvider { | |||||||
|      * @returns Promise resolved if the user accepts to scan QR. |      * @returns Promise resolved if the user accepts to scan QR. | ||||||
|      */ |      */ | ||||||
|     async showScanQRInstructions(): Promise<void> { |     async showScanQRInstructions(): Promise<void> { | ||||||
|         const dontShowWarning = await CoreConfig.get(CoreLoginHelperProvider.FAQ_QRCODE_INFO_DONE, 0); |         const dontShowWarning = await CoreConfig.get(FAQ_QRCODE_INFO_DONE, 0); | ||||||
|         if (dontShowWarning) { |         if (dontShowWarning) { | ||||||
|             return; |             return; | ||||||
|         } |         } | ||||||
| 
 | 
 | ||||||
|         const message = Translate.instant( |         const message = Translate.instant( | ||||||
|             'core.login.faqwhereisqrcodeanswer', |             'core.login.faqwhereisqrcodeanswer', | ||||||
|             { $image: '<div class="text-center">'+ CoreLoginHelperProvider.FAQ_QRCODE_IMAGE_HTML + '</div>' }, |             { $image: '<div class="text-center">'+ FAQ_QRCODE_IMAGE_HTML + '</div>' }, | ||||||
|         ); |         ); | ||||||
|         const header = Translate.instant('core.login.faqwhereisqrcode'); |         const header = Translate.instant('core.login.faqwhereisqrcode'); | ||||||
| 
 | 
 | ||||||
| @ -1315,7 +1312,7 @@ export class CoreLoginHelperProvider { | |||||||
|             ); |             ); | ||||||
| 
 | 
 | ||||||
|             if (dontShowAgain) { |             if (dontShowAgain) { | ||||||
|                 CoreConfig.set(CoreLoginHelperProvider.FAQ_QRCODE_INFO_DONE, 1); |                 CoreConfig.set(FAQ_QRCODE_INFO_DONE, 1); | ||||||
|             } |             } | ||||||
|         } catch { |         } catch { | ||||||
|             // User canceled.
 |             // User canceled.
 | ||||||
| @ -1484,7 +1481,7 @@ export class CoreLoginHelperProvider { | |||||||
| 
 | 
 | ||||||
|         passwordResets[siteUrl] = Date.now(); |         passwordResets[siteUrl] = Date.now(); | ||||||
| 
 | 
 | ||||||
|         await CoreConfig.set(PASSWORD_RESETS_CONFIG_KEY, JSON.stringify(passwordResets)); |         await CoreConfig.set(CoreLoginHelperProvider.PASSWORD_RESETS_CONFIG_KEY, JSON.stringify(passwordResets)); | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     /** |     /** | ||||||
| @ -1516,9 +1513,9 @@ export class CoreLoginHelperProvider { | |||||||
|         } |         } | ||||||
| 
 | 
 | ||||||
|         if (Object.values(passwordResets).length === 0) { |         if (Object.values(passwordResets).length === 0) { | ||||||
|             await CoreConfig.delete(PASSWORD_RESETS_CONFIG_KEY); |             await CoreConfig.delete(CoreLoginHelperProvider.PASSWORD_RESETS_CONFIG_KEY); | ||||||
|         } else { |         } else { | ||||||
|             await CoreConfig.set(PASSWORD_RESETS_CONFIG_KEY, JSON.stringify(passwordResets)); |             await CoreConfig.set(CoreLoginHelperProvider.PASSWORD_RESETS_CONFIG_KEY, JSON.stringify(passwordResets)); | ||||||
|         } |         } | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
| @ -1562,7 +1559,7 @@ export class CoreLoginHelperProvider { | |||||||
|      * @returns Password resets. |      * @returns Password resets. | ||||||
|      */ |      */ | ||||||
|     protected async getPasswordResets(): Promise<Record<string, number>> { |     protected async getPasswordResets(): Promise<Record<string, number>> { | ||||||
|         const passwordResetsJson = await CoreConfig.get(PASSWORD_RESETS_CONFIG_KEY, '{}'); |         const passwordResetsJson = await CoreConfig.get(CoreLoginHelperProvider.PASSWORD_RESETS_CONFIG_KEY, '{}'); | ||||||
| 
 | 
 | ||||||
|         return CoreTextUtils.parseJSON<Record<string, number>>(passwordResetsJson, {}); |         return CoreTextUtils.parseJSON<Record<string, number>>(passwordResetsJson, {}); | ||||||
|     } |     } | ||||||
|  | |||||||
| @ -14,7 +14,7 @@ | |||||||
| 
 | 
 | ||||||
| import { CoreConstants } from '@/core/constants'; | import { CoreConstants } from '@/core/constants'; | ||||||
| import { Component, OnInit } from '@angular/core'; | import { Component, OnInit } from '@angular/core'; | ||||||
| import { CoreLoginHelperProvider } from '@features/login/services/login-helper'; | import { FAQ_QRCODE_INFO_DONE, ONBOARDING_DONE } from '@features/login/constants'; | ||||||
| import { CoreSettingsHelper } from '@features/settings/services/settings-helper'; | import { CoreSettingsHelper } from '@features/settings/services/settings-helper'; | ||||||
| import { CoreSitePlugins } from '@features/siteplugins/services/siteplugins'; | import { CoreSitePlugins } from '@features/siteplugins/services/siteplugins'; | ||||||
| import { CoreUserTours } from '@features/usertours/services/user-tours'; | import { CoreUserTours } from '@features/usertours/services/user-tours'; | ||||||
| @ -174,8 +174,8 @@ export class CoreSettingsDevPage implements OnInit { | |||||||
|     async resetUserTours(): Promise<void> { |     async resetUserTours(): Promise<void> { | ||||||
|         await CoreUserTours.resetTours(); |         await CoreUserTours.resetTours(); | ||||||
| 
 | 
 | ||||||
|         await CoreConfig.delete(CoreLoginHelperProvider.ONBOARDING_DONE); |         await CoreConfig.delete(ONBOARDING_DONE); | ||||||
|         await CoreConfig.delete(CoreLoginHelperProvider.FAQ_QRCODE_INFO_DONE); |         await CoreConfig.delete(FAQ_QRCODE_INFO_DONE); | ||||||
| 
 | 
 | ||||||
|         CoreDomUtils.showToast('User tours have been reseted'); |         CoreDomUtils.showToast('User tours have been reseted'); | ||||||
|     } |     } | ||||||
|  | |||||||
| @ -15,7 +15,7 @@ | |||||||
| import { TestingBehatDomUtils } from './behat-dom'; | import { TestingBehatDomUtils } from './behat-dom'; | ||||||
| import { TestingBehatBlocking } from './behat-blocking'; | import { TestingBehatBlocking } from './behat-blocking'; | ||||||
| import { CoreCustomURLSchemes, CoreCustomURLSchemesProvider } from '@services/urlschemes'; | import { CoreCustomURLSchemes, CoreCustomURLSchemesProvider } from '@services/urlschemes'; | ||||||
| import { CoreLoginHelperProvider } from '@features/login/services/login-helper'; | import { ONBOARDING_DONE } from '@features/login/constants'; | ||||||
| import { CoreConfig } from '@services/config'; | import { CoreConfig } from '@services/config'; | ||||||
| import { EnvironmentConfig } from '@/types/config'; | import { EnvironmentConfig } from '@/types/config'; | ||||||
| import { LocalNotifications, makeSingleton, NgZone } from '@singletons'; | import { LocalNotifications, makeSingleton, NgZone } from '@singletons'; | ||||||
| @ -77,7 +77,7 @@ export class TestingBehatRuntimeService { | |||||||
|         TestingBehatBlocking.init(); |         TestingBehatBlocking.init(); | ||||||
| 
 | 
 | ||||||
|         if (options.skipOnBoarding) { |         if (options.skipOnBoarding) { | ||||||
|             CoreConfig.set(CoreLoginHelperProvider.ONBOARDING_DONE, 1); |             CoreConfig.set(ONBOARDING_DONE, 1); | ||||||
|         } |         } | ||||||
| 
 | 
 | ||||||
|         if (options.configOverrides) { |         if (options.configOverrides) { | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user