MOBILE-4081 login-methods: Execute the first login method

main
Alfonso Salces 2022-12-15 11:37:04 +01:00
parent 58aeadb6b7
commit fc4d97d0e7
2 changed files with 16 additions and 0 deletions

View File

@ -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();
}
}
}

View File

@ -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.
*