General developer forum

Custom "two-step" login on Moodle 2.7

 
Picture of Rosa Muñoz
Custom "two-step" login on Moodle 2.7
 

Hi, I'm working on a project for adding accessibility options for visually impaired people on our Moodle plattform. For reasons beyond my control, I have to work on Moodle 2.7.

I'm currently working on the authentication process for visually impaired Moodle users. My goal is to reduce on-screen elements so screen readers don't take forever to tell the user to input their username and password. My solution is to use a google-style two-step login where a first view asks the user for their username ONLY, and then they're redirected to a second view asking for their password ONLY. After the user introduces its password, THEN the authentication process validates the user and either redirects them to Moodle if the user credentials are valid, o to the first "username-only" view with an error message otherwise.

I'm planning to create a plugin that works in tandem with two views to handle the user credentials before submitting them on the second view, but I don't know if this is the correct way to do this. Has anyone done something like this before? I understand this is far beyond just cosmetics, so where should I start?

 
Average of ratings: -
Picture of Darko Miletić
Re: Custom "two-step" login on Moodle 2.7
Core developersParticularly helpful Moodlers

Take a look here:

https://docs.moodle.org/34/en/Managing_authentication#Alternate_login_URL

In theory you should be able to implement custom local plugin that would host your custom design and logic.

https://docs.moodle.org/dev/Local_plugins

Than you would configure the Moodle to point to your script in that local plugin.

If you visit the settings page on your site - http://mymoodle.url/admin/settings.php?section=manageauths

You will see the settings and following explanation:

If you enter a URL here, it will be used as the login page for this site. The page should contain a form which has the action property set to 'http://mymoodle.url/login/index.php' and return fields username and password.

Be careful not to enter an incorrect URL as you may lock yourself out of this site.

Leave this setting blank to use the default login page.



 
Average of ratings: -
Picture of Michael Milette
Re: Custom "two-step" login on Moodle 2.7
Core developersParticularly helpful MoodlersPlugin developers

Hi Rosa,

Ever notice that terrible ideas can sometimes be seeds for the best ones? Consider this...

What if you just used a little CSS and JavaScript convert the existing Moodle login form into two overlaying DIV panels, one for password and one for password? A little JavaScript code could be used to add a Next button to the first panel and Back button to the second in addition to the existing login button. The Next button would simply hide it's own top  "username" panel, revealing the underlying one and the Back button would make the top one re-appear.

If I am right, I believe that a big advantage of this approach might be that password managers would still be able to fill in the fields in the form... and you could do it without modifying Moodle core at all.

Whether I have accessibility issues or not, it is really convenient to use a password manager to fill a form for you at the click of a button or the swipe of a finger print. I don't think this would be possible if you had a page re-load in between the two.

I haven't actually though this all the way through or tested it. It's just an idea I've been toying with lately because I find it a pain to have to use a password manager twice to login once. And, if the client doesn't support JavaScript (who turns it off anymore these days?), the original unmodified form would simply appear.

Let us know how your project works out or if you just want to do some brainstorming.

Best regards,

Michael


 
Average of ratings: Useful (1)