}
}
- if (!S::logged() && Post::has('auth_type') && Post::v('auth_type') == 'xnet') {
+ if (!S::logged() && Post::has('auth_type') && Post::v('auth_type') == 'xnet' && !Post::has('wait')) {
$type = XDB::fetchOneCell('SELECT type
FROM accounts
WHERE hruid = {?}',
}
}
-function hashResponse(password1, password2, hasConfirmation) {
+function hashResponse(password1, password2, hasConfirmation, doAuth) {
var pw1 = $('[name=' + password1 + ']').val();
var pw2;
alert("Le mot de passe va être chiffré avant de nous parvenir par Internet ! Ainsi il ne circulera pas en clair.");
$('[name=' + password1 + ']').val('');
$('[name=pwhash]').val(hash_encrypt(pw1));
+
+ if (doAuth) {
+ $('[name=password]').val(pw1);
+ doChallengeResponse();
+ }
+
return true;
}
}
S::logger($uid)->log("passwd", "");
+
+ // Try to start a session (so the user don't have to log in); we will use
+ // the password available in Post:: to authenticate the user.
+ Platal::session()->start(AUTH_MDP);
+
$page->changeTpl('platal/tmpPWD.success.tpl');
} else {
+ $hruid = XDB::fetchOneCell('SELECT hruid
+ FROM accounts
+ WHERE uid = {?}',
+ $uid);
$page->changeTpl('platal/password.tpl');
+ $page->assign('hruid', $hruid);
}
}
$res['uid']);
S::logger($res['uid'])->log('passwd', '');
+
+ // Try to start a session (so the user don't have to log in); we will use
+ // the password available in Post:: to authenticate the user.
+ Post::kill('wait');
+ Platal::session()->startAvailableAuth();
+
$page->changeTpl('xnet/register.success.tpl');
$page->assign('hruid', $res['hruid']);
} else {
$page->changeTpl('platal/password.tpl');
$page->assign('xnet', true);
+ $page->assign('hruid', $res['hruid']);
}
}
<tr>
<td colspan="2" class="center">
<input type="submit" name="create_account" value="Créer le compte"
- onclick="return hashResponse('password', false, false);" />
+ onclick="return hashResponse('password', false, false, false);" />
</td>
</tr>
</table>
</tr>
<tr class="impair">
<td colspan="2" class="center">
- <input type="submit" name="update_account" value="Mettre à jour" onclick="return hashResponse('new_plain_password', false, false);" />
+ <input type="submit" name="update_account" value="Mettre à jour" onclick="return hashResponse('new_plain_password', false, false, false);" />
<input type="submit" name="su_account" value="Prendre l'identité" />
<input type="submit" name="log_account" value="Consulter les logs" />
{if $user->state neq 'pending'}
<input type="submit" value="Créer mon compte !" />
{else}
<input type="hidden" name="pwhash" value="" />
- <input type="submit" name="create_account" value="Créer mon compte !" onclick="return hashResponse('new1', 'new2', true);" />
+ <input type="submit" name="create_account" value="Créer mon compte !" onclick="return hashResponse('new1', 'new2', true, false);" />
{/if}
</td>
</tr>
<td></td>
<td>
<input type="hidden" name="pwhash" value="" />
- <input type="submit" name="create_account" value="Changer" onclick="return hashResponse('new1', 'new2', true);" />
+ <input type="submit" name="create_account" value="Changer" onclick="return hashResponse('new1', 'new2', true, false);" />
</td>
</tr>
</table>
<br />
<fieldset style="width: 70%; margin-left: 15%">
<legend>{icon name=lock} Saisie du {if !t($xnet)}nouveau {/if}mot de passe</legend>
- <form action="{$smarty.server.REQUEST_URI}" method="post">
+ <form action="{$smarty.server.REQUEST_URI}" method="post" id="login">
{xsrf_token_field}
<table style="width: 100%">
<tr>
</td>
</tr>
<tr>
+ <td>
+ <input type="hidden" name="username" value="{$hruid}" />
+ <input type="hidden" name="password" value="" />
+ <input type="hidden" name="domain" value="ax" />
+ </td>
+ <td {popup caption='Connexion permanente' width='300' text='Décocher cette case pour que le site oublie ce navigateur.<br />
+ Il est conseillé de décocher la case si cette machine n\'est pas <b>strictement</b> personnelle'} colspan="2">
+ <label><input type="checkbox" name="remember" checked="checked" />
+ Garder l'accès aux services après déconnexion.
+ </label>
+ </td>
+ </tr>
+ <tr>
<td colspan="2" class="center">
<input type="hidden" name="pwhash" value="" />
- <input type="submit" value="{if t($xnet)}Créer{else}Changer{/if}" name="submitn" onclick="return hashResponse('new1', 'new2', true);" />
+ <input type="submit" value="{if t($xnet)}Créer{else}Changer{/if}" name="submitn" onclick="return hashResponse('new1', 'new2', true, true);" />
</td>
</tr>
</table>
</form>
</fieldset>
+<form action="{$smarty.server.REQUEST_URI}" method="post" id="loginsub">
+ <div>
+ <input type="hidden" name="challenge" value="{$smarty.session.challenge}" />
+ <input type="hidden" name="username" value="" />
+ <input type="hidden" name="remember" value="" />
+ <input type="hidden" name="response" value="" />
+ <input type="hidden" name="xorpass" value="" />
+ <input type="hidden" name="domain" value="" />
+ <input type="hidden" name="auth_type" value="{if t($xnet)}xnet{/if}" />
+ <input type="hidden" name="pwhash" value="" />
+ {if t($xnet)}<input type="hidden" name="wait" />{/if}
+ </div>
+</form>
+
{if !t($xnet)}
<p>
Note bien qu'il s'agit là du mot de passe te permettant de t'authentifier sur le site {#globals.core.sitename#} ;
</tr>
<tr class="impair">
<td class="center">
- <input type="submit" name="submitn" value="Continuer" onclick="return hashResponse('password1', 'password2', true);" />
+ <input type="submit" name="submitn" value="Continuer" onclick="return hashResponse('password1', 'password2', true, false);" />
</td>
</tr>
</table>
<div class="center">
<br />
- <input type="submit" name='change' value="Valider ces changements" onclick="return hashResponse('password1', 'password2', true);" />
+ <input type="submit" name='change' value="Valider ces changements" onclick="return hashResponse('password1', 'password2', true, false);" />
<input type="reset" value="Annuler ces changements" />
</div>
<div class="center">
<br />
- <input type="submit" name='change' value="Valider ces changements" onclick="return hashResponse('new_plain_password', false, false);" />
+ <input type="submit" name='change' value="Valider ces changements" onclick="return hashResponse('new_plain_password', false, false, false);" />
<input type="reset" value="Annuler ces changements" />
</div>