Move login() to Login module

- Move nuke_session to include/security
- Remove mod/login
This commit is contained in:
Hypolite Petovan
2017-12-17 11:40:59 -05:00
parent d328345815
commit 2dc598ed5b
14 changed files with 33 additions and 122 deletions

View File

@@ -29,6 +29,7 @@ use Friendica\Core\Worker;
use Friendica\Database\DBM;
use Friendica\Model\Contact;
use Friendica\Database\DBStructure;
use Friendica\Module\Login;
require_once 'include/network.php';
require_once 'include/plugin.php';
@@ -835,83 +836,6 @@ function get_guid($size = 16, $prefix = "")
}
}
/**
* @brief Wrapper for adding a login box.
*
* @param bool $register If $register == true provide a registration link.
* This will most always depend on the value of $a->config['register_policy'].
* @param bool $hiddens optional
*
* @return string Returns the complete html for inserting into the page
*
* @hooks 'login_hook'
* string $o
*/
function login($register = false, $hiddens = false)
{
$a = get_app();
$o = "";
$reg = false;
if ($register) {
$reg = array(
'title' => t('Create a New Account'),
'desc' => t('Register')
);
}
$noid = Config::get('system', 'no_openid');
$dest_url = $a->query_string;
if (local_user()) {
$tpl = get_markup_template("logout.tpl");
} else {
$a->page['htmlhead'] .= replace_macros(
get_markup_template("login_head.tpl"),
array(
'$baseurl' => $a->get_baseurl(true)
)
);
$tpl = get_markup_template("login.tpl");
$_SESSION['return_url'] = $a->query_string;
$a->module = 'login';
}
$o .= replace_macros(
$tpl,
array(
'$dest_url' => $dest_url,
'$logout' => t('Logout'),
'$login' => t('Login'),
'$lname' => array('username', t('Nickname or Email: ') , '', ''),
'$lpassword' => array('password', t('Password: '), '', ''),
'$lremember' => array('remember', t('Remember me'), 0, ''),
'$openid' => !$noid,
'$lopenid' => array('openid_url', t('Or login using OpenID: '),'',''),
'$hiddens' => $hiddens,
'$register' => $reg,
'$lostpass' => t('Forgot your password?'),
'$lostlink' => t('Password Reset'),
'$tostitle' => t('Website Terms of Service'),
'$toslink' => t('terms of service'),
'$privacytitle' => t('Website Privacy Policy'),
'$privacylink' => t('privacy policy'),
)
);
call_hooks('login_hook', $o);
return $o;
}
/**
* @brief Used to end the current process, after saving session state.
*/