General developer forum

Custom Login 3.4

 
Picture of begum karat
Custom Login 3.4
 

Hi,

Desperately need help. We have implemented SSO using Oauth2 and "Log in with Google" button is displayed on the index.php page and works fine. However, we only want the admin to go to the index page to login. For our users we want them to see the  "Log in with Google" button on the front page (currently shown as 'You are not logged in. (Log in)' on the upper left hand of the screenshot. 

Can someone please tell me the steps (as I'm not very familiar with the backend) so I can replace 'You are not logged in. (Log in)' with "Log in with Google" button on the front page

Thank you.



 
Average of ratings: -
Picture of Dorel Manolescu
Re: Custom Login 3.4
 
Average of ratings: -
Picture of begum karat
Re: Custom Login 3.4
 

Hi Dorel, thank you for responding. However, that is not what I am trying to do. I'm probably not very clear. I need to have the "Log in with Google' button on the front page and upon clicking the button the users gets authenticated with their Google credentials. 




We have successfully implemented SSO with Oauth2 and it is currently working on login/index.php and what we really want to do is to have the Google button (only) available on the front page instead of redirecting the users to /login/index.php



 
Average of ratings: -
Picture of Jun Pataleta
Re: Custom Login 3.4
Core developersMoodle HQPlugin developersTesters

Hi Begum,

I would probably create an alternate login page which only renders the Google authentication button and set the URL to this page as the value of the "Alternate login URL" ($CFG->alternateloginurl) setting in the "Common settings" section of the "Site administration / Plugins / Authentication / Manage authentication" administration page.

I think this would be the simplest solution to your needs.

Hope this helps.

 
Average of ratings: -
Picture of Jun Pataleta
Re: Custom Login 3.4
Core developersMoodle HQPlugin developersTesters

As proof of concept, please check out this gist

Hope this helps.

P.S. Since this approach of using an alternate login URL overrides the original login form and disables manual login, please keep in mind that your admin account should be able to log into the site via the Google OAuth service as well. Otherwise, you might get locked out of the site.

 
Average of ratings: -