namespace Friendica\Module\Security;
use Friendica\BaseModule;
-use Friendica\App\Authentication;
use Friendica\Core\Config;
use Friendica\Core\Hook;
use Friendica\Core\L10n;
use Friendica\Core\Renderer;
use Friendica\Core\Session;
+use Friendica\DI;
use Friendica\Module\Register;
use Friendica\Util\Strings;
{
public static function content(array $parameters = [])
{
- $a = self::getApp();
-
if (local_user()) {
- $a->internalRedirect();
+ DI::baseUrl()->redirect();
}
return self::form(Session::get('return_path'), intval(Config::get('config', 'register_policy')) !== \Friendica\Module\Register::CLOSED);
) {
$openid_url = trim(($_POST['openid_url'] ?? '') ?: $_POST['username']);
- /** @var Authentication $authentication */
- $authentication = self::getClass(Authentication::class);
- $authentication->withOpenId($openid_url, !empty($_POST['remember']));
+ DI::auth()->withOpenId($openid_url, !empty($_POST['remember']));
}
if (!empty($_POST['auth-params']) && $_POST['auth-params'] === 'login') {
- /** @var Authentication $authentication */
- $authentication = self::getClass(Authentication::class);
- $authentication->withPassword(
- self::getApp(),
+ DI::auth()->withPassword(
+ DI::app(),
trim($_POST['username']),
trim($_POST['password']),
!empty($_POST['remember'])
*/
public static function form($return_path = null, $register = false, $hiddens = [])
{
- $a = self::getApp();
$o = '';
$noid = Config::get('system', 'no_openid');
}
$reg = false;
- if ($register && intval($a->getConfig()->get('config', 'register_policy')) !== Register::CLOSED) {
+ if ($register && intval(DI::config()->get('config', 'register_policy')) !== Register::CLOSED) {
$reg = [
'title' => L10n::t('Create a New Account'),
'desc' => L10n::t('Register'),
}
if (is_null($return_path)) {
- $return_path = $a->query_string;
+ $return_path = DI::args()->getQueryString();
}
if (local_user()) {
$tpl = Renderer::getMarkupTemplate('logout.tpl');
} else {
- $a->page['htmlhead'] .= Renderer::replaceMacros(
+ DI::page()['htmlhead'] .= Renderer::replaceMacros(
Renderer::getMarkupTemplate('login_head.tpl'),
[
- '$baseurl' => $a->getBaseURL(true)
+ '$baseurl' => DI::baseUrl()->get(true)
]
);
$o .= Renderer::replaceMacros(
$tpl,
[
- '$dest_url' => self::getApp()->getBaseURL(true) . '/login',
+ '$dest_url' => DI::baseUrl()->get(true) . '/login',
'$logout' => L10n::t('Logout'),
'$login' => L10n::t('Login'),