Commit 3720bfb7 authored by Hugh Davenport's avatar Hugh Davenport
Browse files

Add option for an external login page (bug #885029)

This patch adds a new feature allowing an administrator to set
a new config option externallogin, which redirects any page view
requiring login to this external login page.

The config option allows some placeholders. For examples, see

Change-Id: I4a3277222c35bfed11e4af597fa54ef82ea866ae
Signed-off-by: default avatarHugh Davenport <>
parent 70971319
......@@ -976,6 +976,13 @@ function auth_draw_login_page($message=null, Pieform $form=null) {
$externallogin = get_config('externallogin');
if ($externallogin) {
$externallogin = preg_replace('/{shorturlencoded}/', urlencode(get_relative_script_path()), $externallogin);
$externallogin = preg_replace('/{wwwroot}/', get_config('wwwroot'), $externallogin);
if ($message) {
......@@ -240,3 +240,15 @@ $cfg->leapovermnetloglevel = 0;
// This needs to be true when forcing https with an ssl proxy such as nginx.
$cfg->sslproxy = false;
// External login page
// Use this config option when you want users to be redirected to another
// login page, for example a moodle instance that has mnet to this mahara
// You can use the following placeholders:
// {wwwroot} - Expands out to the wwwroot of this moodle
// {shorturlencoded} - Expands to the relative script path of the current page (and is urlencoded)
// A point to note about the example below. Moodle doesn't strip the trailing slash from wwwroot
// Bug MDL-30042 fixes this, if this patch isn't applied, just hard code the login url you want instead
// $cfg->externallogin = '{wwwroot}&wantsurl={shorturlencoded}';
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment