From 80bb7715823673e62ba155e7a984c6fa1d8a443d Mon Sep 17 00:00:00 2001 From: marcus Date: Wed, 7 Jan 2009 12:14:50 +0000 Subject: Closes #662: https on login. git-svn-id: https://code.elgg.org/elgg/trunk@2535 36083f99-b078-4883-b0ff-0f9b5a30f544 --- actions/admin/site/update_basic.php | 6 ++++++ actions/systemsettings/install.php | 7 ++++++- languages/en.php | 2 ++ views/default/account/forms/login.php | 10 ++++++++-- views/default/settings/system.php | 5 ++++- 5 files changed, 26 insertions(+), 4 deletions(-) diff --git a/actions/admin/site/update_basic.php b/actions/admin/site/update_basic.php index 5710e63b9..c29fdd044 100644 --- a/actions/admin/site/update_basic.php +++ b/actions/admin/site/update_basic.php @@ -45,6 +45,12 @@ else unset_config('debug', $site->getGUID()); + $https_login = get_input('https_login'); + if ($https_login) + set_config('https_login', 1, $site->getGUID()); + else + unset_config('https_login', $site->getGUID()); + $usage = get_input('usage'); if ($usage) unset_config('ping_home', $site->getGUID()); diff --git a/actions/systemsettings/install.php b/actions/systemsettings/install.php index 25846d6f1..3ea4e117e 100644 --- a/actions/systemsettings/install.php +++ b/actions/systemsettings/install.php @@ -78,7 +78,12 @@ unset_config('disable_api', $site->getGUID()); else set_config('disable_api', 'disabled', $site->getGUID()); - + + $https_login = get_input('https_login'); + if ($https_login) + set_config('https_login', 1, $site->getGUID()); + else + unset_config('https_login', $site->getGUID()); // activate some plugins by default if (isset($CONFIG->default_plugins)) diff --git a/languages/en.php b/languages/en.php index fd9119e53..62e48f38c 100644 --- a/languages/en.php +++ b/languages/en.php @@ -711,6 +711,8 @@ Alternatively, you can enter your database settings below and we will try and do 'installation:language' => "The default language for your site:", 'installation:debug' => "Debug mode provides extra information which can be used to diagnose faults, however it can slow your system down so should only be used if you are having problems:", 'installation:debug:label' => "Turn on debug mode", + 'installation:httpslogin' => "Enable this to have user logins performed over HTTPS. You will need to have https enabled on your server for this to work.", + 'installation:httpslogin:label' => "Enable HTTPS logins", 'installation:usage' => "This option lets Elgg send anonymous usage statistics back to Curverider.", 'installation:usage:label' => "Send anonymous usage statistics", 'installation:view' => "Enter the view which will be used as the default for your site or leave this blank for the default view (if in doubt, leave as default):", diff --git a/views/default/account/forms/login.php b/views/default/account/forms/login.php index 17b44cc78..95eef7790 100644 --- a/views/default/account/forms/login.php +++ b/views/default/account/forms/login.php @@ -21,11 +21,17 @@ $form_body .= (!isset($CONFIG->disable_registration) || !($CONFIG->disable_registration)) ? "" . elgg_echo('register') . " | " : ""; $form_body .= "" . elgg_echo('user:password:lost') . "

"; - // + // + + $login_url = $vars['url']; + if ((isset($CONFIG->https_login)) && ($CONFIG->https_login)) + $login_url = str_replace("http", "https", $vars['url']); ?>

- $form_body, 'action' => "{$vars['url']}action/login")); ?> + $form_body, 'action' => "{$login_url}action/login")); + ?>
\ No newline at end of file diff --git a/views/default/settings/system.php b/views/default/settings/system.php index 2ddd8ac7b..be9b00dee 100644 --- a/views/default/settings/system.php +++ b/views/default/settings/system.php @@ -35,7 +35,10 @@ $languages = get_installed_translations(); $form_body .= "

" . elgg_echo('installation:language') . elgg_view("input/pulldown", array('internalname' => 'language', 'value' => $vars['config']->language, 'options_values' => $languages)) . "

"; - $form_body .= "

" . elgg_echo('installation:debug') . "
" .elgg_view("input/checkboxes", array('options' => array(elgg_echo('installation:debug:label')), 'internalname' => 'debug', 'value' => ($vars['config']->debug ? elgg_echo('installation:debug:label') : "") )) . "

"; + $form_body .= "

" . elgg_echo('installation:debug') . "
" .elgg_view("input/checkboxes", array('options' => array(elgg_echo('installation:debug:label')), 'internalname' => 'debug', 'value' => ($vars['config']->debug ? elgg_echo('installation:debug:label') : "") )) . "

"; + + $form_body .= "

" . elgg_echo('installation:httpslogin') . "
" .elgg_view("input/checkboxes", array('options' => array(elgg_echo('installation:httpslogin:label')), 'internalname' => 'https_login', 'value' => ($vars['config']->https_login ? elgg_echo('installation:httpslogin:label') : "") )) . "

"; + $form_body .= "

" . elgg_echo('installation:disableapi') . "
"; $on = elgg_echo('installation:disableapi:label'); -- cgit v1.2.3