@@ -61,8 +61,8 @@ export default class LoginPageComponent implements OnInit {
6161
6262 private subscriptions : Subscription = new Subscription ( ) ;
6363
64- disabledSocialLogin $ = this . featureService . isFeatureEnabled ( 'disableSocialLogin ' ) ;
65-
64+ enableSocialLogin $ = this . featureService . isFeatureEnabled ( 'enableSocialLogin ' ) ;
65+
6666 constructor (
6767 private fb : FormBuilder ,
6868 private supabaseService : SupabaseService ,
@@ -117,7 +117,7 @@ export default class LoginPageComponent implements OnInit {
117117 this . requireMFA = true ;
118118 this . factorId = factors . totp [ 0 ] . id ;
119119 this . form . get ( 'mfaCode' ) ?. setValidators ( [
120- Validators . required ,
120+ Validators . required ,
121121 Validators . pattern ( / ^ \d { 6 } $ / )
122122 ] ) ;
123123 this . form . get ( 'mfaCode' ) ?. updateValueAndValidity ( ) ;
@@ -127,7 +127,7 @@ export default class LoginPageComponent implements OnInit {
127127 }
128128 } ) ;
129129 }
130-
130+
131131 ngOnDestroy ( ) {
132132 this . subscriptions . unsubscribe ( ) ;
133133 }
@@ -151,7 +151,7 @@ export default class LoginPageComponent implements OnInit {
151151 this . factorId = null ;
152152 this . challengeId = null ;
153153 this . form . get ( 'mfaCode' ) ?. reset ( ) ;
154-
154+
155155 // Reset form validators based on mode
156156 if ( this . isLogin ) {
157157 this . form . get ( 'confirmPassword' ) ?. clearValidators ( ) ;
@@ -166,7 +166,7 @@ export default class LoginPageComponent implements OnInit {
166166 }
167167
168168 async checkIfSignupDisabled ( ) {
169- if ( ( await this . featureService . isFeatureEnabledPromise ( 'disableSignUp ' ) ) ) {
169+ if ( ! ( await this . featureService . isFeatureEnabledPromise ( 'enableSignUp ' ) ) ) {
170170 this . messagingService . showWarn (
171171 'Sign Up Disabled' ,
172172 'It\'s not possible to create new accounts on the demo instance.' ,
@@ -198,7 +198,7 @@ export default class LoginPageComponent implements OnInit {
198198 signOut ( ) {
199199 this . supabaseService . signOut ( ) ;
200200 }
201-
201+
202202 private resetMessages ( ) {
203203 this . errorMessage = '' ;
204204 this . successMessage = '' ;
@@ -215,34 +215,34 @@ export default class LoginPageComponent implements OnInit {
215215 try {
216216 await this . supabaseService . signInWithGoogle ( ) ;
217217 } catch ( error : any ) {
218- this . errorHandlerService . handleError ( {
219- error,
220- message : 'Failed to sign in with Google' ,
221- showToast : true ,
222- location : 'loginWithGoogle'
218+ this . errorHandlerService . handleError ( {
219+ error,
220+ message : 'Failed to sign in with Google' ,
221+ showToast : true ,
222+ location : 'loginWithGoogle'
223223 } ) ;
224224 }
225- }
225+ }
226226
227227 async loginWithFacebook ( ) : Promise < void > {
228228 try {
229229 await this . supabaseService . signInWithFacebook ( ) ;
230230 } catch ( error : any ) {
231- this . errorHandlerService . handleError ( {
232- error,
233- message : 'Failed to sign in with Facebook' ,
234- showToast : true ,
235- location : 'loginWithFacebook'
231+ this . errorHandlerService . handleError ( {
232+ error,
233+ message : 'Failed to sign in with Facebook' ,
234+ showToast : true ,
235+ location : 'loginWithFacebook'
236236 } ) ;
237237 }
238238 }
239-
239+
240240 async onSubmit ( ) {
241241 if ( ! this . form . valid || ( this . requireMFA && this . form . get ( 'mfaCode' ) ?. invalid ) ) return ;
242-
242+
243243 this . resetMessages ( ) ;
244244 this . showLoader = true ;
245-
245+
246246 try {
247247 const credentials = {
248248 email : this . form . get ( 'email' ) ?. value ,
@@ -309,13 +309,13 @@ export default class LoginPageComponent implements OnInit {
309309 private async setupMFAVerification ( factorId : string ) : Promise < void > {
310310 this . requireMFA = true ;
311311 this . factorId = factorId ;
312-
312+
313313 this . form . get ( 'mfaCode' ) ?. setValidators ( [
314314 Validators . required ,
315315 Validators . pattern ( / ^ \d { 6 } $ / )
316316 ] ) ;
317317 this . form . get ( 'mfaCode' ) ?. updateValueAndValidity ( ) ;
318-
318+
319319 this . successMessage = 'Please enter your 2FA code to continue' ;
320320 this . cdr . detectChanges ( ) ;
321321 }
@@ -331,21 +331,21 @@ export default class LoginPageComponent implements OnInit {
331331 this . turnstileResponse ,
332332 ) ;
333333 const timeoutPromise = this . createTimeout ( delayTimeout ) ;
334-
334+
335335 const result = await Promise . race ( [ authPromise , timeoutPromise ] ) ;
336336 if ( result instanceof Error ) {
337337 throw result ;
338338 }
339339
340340 this . handleSuccess ( ) ;
341341 }
342-
342+
343343 private createTimeout ( ms : number ) : Promise < never > {
344344 return new Promise ( ( _ , reject ) => {
345345 setTimeout ( ( ) => reject ( new Error ( 'Request timed out' ) ) , ms ) ;
346346 } ) ;
347347 }
348-
348+
349349 private handleSuccess ( ) {
350350 if ( this . requireMFA ) {
351351 this . successMessage = '2FA verification is enabled. Please enter your code when prompted' ;
@@ -359,7 +359,7 @@ export default class LoginPageComponent implements OnInit {
359359 }
360360 this . cdr . detectChanges ( ) ;
361361 }
362-
362+
363363 private handleError ( error : unknown ) {
364364 if ( error instanceof Error ) {
365365 this . errorMessage = error . message ;
@@ -371,7 +371,7 @@ export default class LoginPageComponent implements OnInit {
371371 }
372372 this . cdr . detectChanges ( ) ;
373373 }
374-
374+
375375 public resendVerificationEmail ( ) {
376376 this . showLoader = true ;
377377 try {
@@ -385,5 +385,5 @@ export default class LoginPageComponent implements OnInit {
385385 this . showLoader = false ;
386386 }
387387 }
388-
388+
389389}
0 commit comments