Overview
Comment:Connexion double facteur avec OTP
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | dev
Files: files | file ages | folders
SHA1: 243ffc229a4116ee71f7f3b3419bd2b41def954b
User & Date: bohwaz on 2017-01-26 23:50:55
Other Links: branch diff | manifest | tags
Context
2017-01-26
23:58
OTP : utilisation du temps NTP si le code ne marche pas, c'est ptet que le serveur n'est pas à l'heure check-in: 5fe5ad7b22 user: bohwaz tags: dev
23:50
Connexion double facteur avec OTP check-in: 243ffc229a user: bohwaz tags: dev
00:19
Ajout authentification à double facteur (OTP) check-in: 633bea8e4a user: bohwaz tags: dev
Changes

Added src/templates/admin/login_otp.tpl version [5a44d9c852].

































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
{include file="admin/_head.tpl" title="Connexion — double facteur"}

{if $error}
    <p class="error">
        {if $error == 'OTHER'}
            Une erreur est survenue, merci de réessayer.
        {else}
            Code incorrect. L'heure du serveur est {$time|date_fr:"d/m/Y H:i:s"}. Vérifiez que votre téléphone est à l'heure.
        {/if}
    </p>
{/if}


<form method="post" action="{$self_url}">

    <fieldset>
        <legend>Authentification à double facteur</legend>
        <dl>
            <dt><label for="f_code">Code TOTP</label></dt>
            <dd class="help">Entrez ici le code donné par l'application d'authentification double facteur.</dd>
            <dd><input type="text" name="code" id="f_code" value="{form_field name=code}" /></dd>
        </dl>
    </fieldset>

    <p class="submit">
        {csrf_field key="otp"}
        <input type="submit" name="login" value="Se connecter &rarr;" />
    </p>

</form>

{include file="admin/_foot.tpl"}

Added src/www/admin/login_otp.php version [a263b860c3].









































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
<?php
namespace Garradin;

const LOGIN_PROCESS = true;

require_once __DIR__ . '/_inc.php';

if ($membres->isLogged() && !$membres->isOTPRequired())
{
    Utils::redirect('/admin/');
}

$error = false;

if (Utils::post('code'))
{
    if (!Utils::CSRF_check('otp'))
    {
        $error = 'OTHER';
    }
    else
    {
        if ($membres->loginOTP(Utils::post('code')))
        {
            Utils::redirect('/admin/');
        }

        $error = 'LOGIN';
    }
}

$tpl->assign('error', $error);

$tpl->assign('time', time());

$tpl->display('admin/login_otp.tpl');