diff --git a/src/core/features/login/components/components.module.ts b/src/core/features/login/components/components.module.ts index 37d326e79..e2cdddf84 100644 --- a/src/core/features/login/components/components.module.ts +++ b/src/core/features/login/components/components.module.ts @@ -17,12 +17,14 @@ import { CoreSharedModule } from '@/core/shared.module'; import { CoreLoginSiteOnboardingComponent } from './site-onboarding/site-onboarding'; import { CoreLoginSiteHelpComponent } from './site-help/site-help'; import { CoreLoginSitesComponent } from './sites/sites'; +import { CoreLoginMethodsComponent } from './login-methods/login-methods'; @NgModule({ declarations: [ CoreLoginSiteOnboardingComponent, CoreLoginSiteHelpComponent, CoreLoginSitesComponent, + CoreLoginMethodsComponent, ], imports: [ CoreSharedModule, @@ -31,6 +33,7 @@ import { CoreLoginSitesComponent } from './sites/sites'; CoreLoginSiteOnboardingComponent, CoreLoginSiteHelpComponent, CoreLoginSitesComponent, + CoreLoginMethodsComponent, ], }) export class CoreLoginComponentsModule {} diff --git a/src/core/features/login/components/login-methods/login-methods.html b/src/core/features/login/components/login-methods/login-methods.html new file mode 100644 index 000000000..bccba83e1 --- /dev/null +++ b/src/core/features/login/components/login-methods/login-methods.html @@ -0,0 +1,8 @@ + + + + + {{ method.name }} + + diff --git a/src/core/features/login/components/login-methods/login-methods.scss b/src/core/features/login/components/login-methods/login-methods.scss new file mode 100644 index 000000000..e417fd95f --- /dev/null +++ b/src/core/features/login/components/login-methods/login-methods.scss @@ -0,0 +1,12 @@ +@import "~theme/globals"; + +ion-item-divider { + --item-divider-border-width: 4px; + margin: 0 1em; +} +.core-login-methods { + margin: .5em 0; + &__spacer { + margin: .5em 1em; + } +} diff --git a/src/core/features/login/components/login-methods/login-methods.ts b/src/core/features/login/components/login-methods/login-methods.ts new file mode 100644 index 000000000..08c85a47c --- /dev/null +++ b/src/core/features/login/components/login-methods/login-methods.ts @@ -0,0 +1,33 @@ +// (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. +import { Component, OnInit } from '@angular/core'; +import { CoreLoginHelper, CoreLoginMethod } from '@features/login/services/login-helper'; + +@Component({ + selector: 'core-login-methods', + templateUrl: 'login-methods.html', + styleUrls: ['../../login.scss', 'login-methods.scss'], +}) +export class CoreLoginMethodsComponent implements OnInit { + + loginMethods?: CoreLoginMethod[]; + + /** + * @inheritdoc + */ + async ngOnInit(): Promise { + this.loginMethods = await CoreLoginHelper.getLoginMethods(); + } + +} diff --git a/src/core/features/login/pages/reconnect/reconnect.html b/src/core/features/login/pages/reconnect/reconnect.html index 8c6b71f6e..6f3e5017e 100644 --- a/src/core/features/login/pages/reconnect/reconnect.html +++ b/src/core/features/login/pages/reconnect/reconnect.html @@ -76,17 +76,20 @@ {{ 'core.login.forgotten' | translate }} + + + - + diff --git a/src/core/features/login/pages/reconnect/reconnect.module.ts b/src/core/features/login/pages/reconnect/reconnect.module.ts index 47f284ca7..597d8f68b 100644 --- a/src/core/features/login/pages/reconnect/reconnect.module.ts +++ b/src/core/features/login/pages/reconnect/reconnect.module.ts @@ -17,6 +17,7 @@ import { RouterModule, Routes } from '@angular/router'; import { CoreSharedModule } from '@/core/shared.module'; import { CoreLoginReconnectPage } from './reconnect'; +import { CoreLoginComponentsModule } from '@features/login/components/components.module'; const routes: Routes = [ { @@ -29,6 +30,7 @@ const routes: Routes = [ imports: [ RouterModule.forChild(routes), CoreSharedModule, + CoreLoginComponentsModule, ], declarations: [ CoreLoginReconnectPage, diff --git a/src/core/features/login/services/login-helper.ts b/src/core/features/login/services/login-helper.ts index d56be6fb1..688b82138 100644 --- a/src/core/features/login/services/login-helper.ts +++ b/src/core/features/login/services/login-helper.ts @@ -1448,6 +1448,15 @@ export class CoreLoginHelperProvider { return import('@features/login/pages/credentials/credentials.module').then(m => m.CoreLoginCredentialsPageModule); } + /** + * Retrieve login methods. + * + * @returns Login methods found. + */ + async getLoginMethods(): Promise { + return []; + } + } export const CoreLoginHelper = makeSingleton(CoreLoginHelperProvider); @@ -1562,3 +1571,9 @@ export type CoreLoginSiteSelectorListMethod = 'sitefinder'| 'list'| ''; + +export type CoreLoginMethod = { + name: string; // Name of the login method. + icon: string; // Icon of the provider. + action: () => unknown; // Action to execute on button click. +};