Alternate Login URL

Alternate Login URL

by Jean Poole -
Number of replies: 16
Hi,

I'd like to be able to have the log in fields on another web site as outlined in Users - Authentication.

Problem is I have absolutely no idea what code is required to achieve this....

Can anyone help?
Average of ratings: -
In reply to Jean Poole

Re: Alternate Login URL

by Chris Myers -
Sure, it's actually pretty simple:

<html>
<head>
<title>Moodle login</title>
</head>
<body>
<FORM action="https://www.school.edu/?subfolders?/login/index.php" method="POST">
Username: <input type=text name="username">
<br>
Password: <input type=password name="password">
<INPUT type="SUBMIT" value="Login">
</FORM>
</body>
</html>


Or if you want to embed it within a different page, all you need is from <form to </form> - just place that wherever on your site.
Average of ratings: Useful (1)
In reply to Chris Myers

Re: Alternate Login URL

by kishok ramachandran -
hi to All,

Under the " 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://lms.eduplus2u.com/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. "

........ I have lock my self... it is not going to the login any more..
can anyone help me... Please help me....
I am normal user. This is my URL http://kms.eduplus2u.com...
if u click on the login here, it show "The page isn't redirecting properly"
how can i change it back.... need HELP!!!!.....

Help ..

In reply to kishok ramachandran

Re: Alternate Login URL

by Pablo Castillo -
In the mysql database exist a record, this has the url type by you. Clean the register and this solve your problem.

I dont remember is the configuration table. or config dont remember check the configuration tables in the MySQL.

Solution 100% granted!

I have similar problem and this is a BIG STRESS......
In reply to Pablo Castillo

Re: Alternate Login URL

by Vadim Biryukov -
Hi Pablo, Now that's my turn to have the same problem! Could you tell me exactly where this record is located? I checked database and didn't find the url which I typed. Thanks in advance, Vadim
In reply to kishok ramachandran

Re: Alternate Login URL

by joseph pathickan -
you can
override the Alternate Login URL:
In your Moodle/config.php file, add this line:
$CFG->alternateloginurl = ' your url ';
Now you can log into Moodle directly
and change any authentication settings. Later, you can delete that line from the
config.php file.
Average of ratings: Useful (2)
In reply to joseph pathickan

Re: Alternate Login URL

by Vadim Biryukov -
Hi Joseph, I tried to follow your advise but didn't succeed. I can't log into Moodle directly. I type my url but then Moodle just uses it as another Alternate Login URL which doesn't exist. Could you help me to solve this problem somehow? Vadim
In reply to joseph pathickan

Re: Alternate Login URL

by Kaspar Thomann -
I am so glad having found your posting, because I fumbled around with this field and than, login was impossible!
Yes, I could enter that line in my confing (using FTP) and it looks now:
$CFG->alternateloginurl = '';
as I did not really wanted to have an alternative. SInce then, login works fine. As I remove this line again, then login will fail for whole moodle.

I wonder where in the DB this info is hidden. I would appriciate your help. MOODLE uses over 200 Tables and just by there names, I did not figure out anything.
In reply to Kaspar Thomann

Re: Alternate Login URL

by Kaspar Thomann -
Sorry having asked this Q, it's solved by now. A closer look to the DB-tables finaly brought my eyes to mdl_config TBL and in there I found the entry alternateloginurl. Many thanks. My case is solved by this.
Average of ratings: Useful (1)
In reply to Kaspar Thomann

Re: Alternate Login URL

by Tryphanna Rani -
I too got the same problem... When I tried as Kaspar said and It worked out properly...
I just have added $CFG->alternateloginurl = ''; line in config.php (using FTP)

Thanks a lot for this thread..
It was more useful to me and will also be very useful to the ones who will be facing this problem.
In reply to joseph pathickan

Re: Alternate Login URL

by Lonnie Erwin -

I have the same problem. Do I add the following to my config.php

$CFG->alternateloginurl = ' your url '; Do I change the "your url" or leave it like is?

In reply to Lonnie Erwin

Re: Alternate Login URL

by Ron Swartzendruber -
You must change the 'your url' to a valid URL that leads to a working alternate login page containing the form fields described above. The text 'your url' is not a valid URL and will break Moodle. smile

It is probably safer to put in the following line instead:

$CFG->alternateloginurl = '';

Note that it is two single quotes before the semicolon, not one double-quote. And you must include the semicolon at the end.

This line will stop Moodle from going to whatever non-working alternate login URL you entered by mistake, and return it to normal operation so you can go in and change the alternate login URL setting in Moodle. After deleting or fixing the alternate login URL, you should delete the line you added to the config.php file, unless you want the alternate login URL to be completely disabled.

NOTE: you should always create a backup of your config.php file before making any changes! Even if you know what you are doing, you are still human and mistakes can happen.

Also note that editing the mdl_config table in the database, as described elsewhere in this thread, is probably a better solution than editing your config.php file because it fixes the real problem immediately. But if you are not comfortable working directly with databases, editing the config.php file is a good workaround.
Average of ratings: Useful (1)
In reply to Ron Swartzendruber

Re: Alternate Login URL

by Carol Booth -
Thanks to all of you for this. I had a horrible 5 minutes when I accidentally pasted our forgotten password URL into the alternate login box (very easily done blush).

I've got back in by editing config.php and updated my database as suggested (using the phpmyadmin module, I simply deleted the content of the field but left the record intact - same result as the sql query) but I left the line in config.php as this will stop such a mistake from happening again (and when you look at the admin form, it shows that it is overridden in config.php). Would this be a good 'safety feature' for everyone?

Carol
In reply to joseph pathickan

Re: Alternate Login URL

by David Hernández -
Some extra information related to to Joseph's message
(Re: Alternate Login URL by joseph pathickan - Tuesday, 14 October 2008, 03:29 AM):

In Moodle 1.9.9 (and maybe lower versions), you have to include the following
in your "config.php":

$CFG->alternateloginurl = '';

Where '' are two single quotation marks (apostrophes)

Don't use the "double" quotation marks.

The difference with Joseph's suggestion is that he told us to include the
web address of the plataform.

It didn't work for me.

Hope this helps somebody.

In reply to David Hernández

Re: Alternate Login URL

by Judy Hsu -

Dear all, I have a quick question...

If I am to use the alternateloginurl (in either the site setting level or in the config.php level), for a 2-steps login process. Say, I created a static HTML page (e.g. requirement.html) with some web browser requirement info and so on, and then on the bottom of this static HTML page, I provide a link which would point to the real login page (e.g. /login/index.php)... would this work using the "alternateloginurl" for this purpose, or does the static HTML page really should contain a form which has the action property set to 'http://xx.xxx.xxx.xx/moodle/login/index.php' and return fields username and password??

If "alternate login URL" is not designed for this type of "2-step" login process, is my only option is to change the apache configuration file (/etc/httpd/conf/httpd.conf)?? Any other solutions to achieve this type of 2-steps login process? Many thanks!

In reply to kishok ramachandran

Re: Alternate Login URL

by Vadim Biryukov -
Hi Kishok, Did any of the suggestions that you received help? Because I have the same problem as you. Vadim
In reply to Vadim Biryukov

Re: Alternate Login URL

by Elvedin Trnjanin -
This setting is in the config table of your Moodle database. I assume the database prefix is "mdl_" as it is for most installations -

update mdl_config set value='' where name='alternateloginurl';

Run that on your SQL server and your access should be restored.
Average of ratings: Useful (1)