MOBILE-4081 login-methods: Execute the first login method
This commit is contained in:
		
							parent
							
								
									58aeadb6b7
								
							
						
					
					
						commit
						fc4d97d0e7
					
				| @ -13,6 +13,7 @@ | ||||
| // limitations under the License.
 | ||||
| import { Component, OnInit } from '@angular/core'; | ||||
| import { CoreLoginHelper, CoreLoginMethod } from '@features/login/services/login-helper'; | ||||
| import { CoreSites } from '@services/sites'; | ||||
| 
 | ||||
| @Component({ | ||||
|     selector: 'core-login-methods', | ||||
| @ -28,6 +29,12 @@ export class CoreLoginMethodsComponent implements OnInit { | ||||
|      */ | ||||
|     async ngOnInit(): Promise<void> { | ||||
|         this.loginMethods = await CoreLoginHelper.getLoginMethods(); | ||||
|         const currentSite = CoreSites.getCurrentSite(); | ||||
|         const defaultMethod = await CoreLoginHelper.getDefaultLoginMethod(); | ||||
| 
 | ||||
|         if (currentSite?.isLoggedOut() && defaultMethod) { | ||||
|             await defaultMethod.action(); | ||||
|         } | ||||
|     } | ||||
| 
 | ||||
| } | ||||
|  | ||||
| @ -1486,6 +1486,15 @@ export class CoreLoginHelperProvider { | ||||
|         return []; | ||||
|     } | ||||
| 
 | ||||
|     /** | ||||
|      * Retrieve default login method. | ||||
|      * | ||||
|      * @returns Default login method. | ||||
|      */ | ||||
|     async getDefaultLoginMethod(): Promise<CoreLoginMethod | null> { | ||||
|         return null; | ||||
|     } | ||||
| 
 | ||||
|     /** | ||||
|      * Record that a password reset has been requested for a given site. | ||||
|      * | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user