Refactor login / ban authentication steps

Relates to https://github.com/shaarli/Shaarli/issues/324

Added:
- Add the `LoginManager` class to manage logins and bans

Changed:
- Refactor IP ban management
- Simplify logic
- Avoid using globals, inject dependencies

Fixed:
- Use `ban_duration` instead of `ban_after` when setting a new ban

Signed-off-by: VirtualTam <virtualtam@flibidi.net>
This commit is contained in:
VirtualTam 2017-10-25 23:03:31 +02:00
parent a381c373b3
commit 44acf70681
6 changed files with 385 additions and 103 deletions

View file

@ -5,7 +5,7 @@
</head>
<body>
{include="page.header"}
{if="!ban_canLogin($conf)"}
{if="!$user_can_login"}
<div class="pure-g pure-alert pure-alert-error pure-alert-closable center">
<div class="pure-u-2-24"></div>
<div class="pure-u-20-24">

View file

@ -2,7 +2,7 @@
<html>
<head>{include="includes"}</head>
<body
{if="ban_canLogin($conf)"}
{if="$user_can_login"}
{if="empty($username)"}
onload="document.loginform.login.focus();"
{else}