From: Stéphane Jacob Date: Thu, 17 Mar 2011 23:04:59 +0000 (+0100) Subject: Logs in after password recovery and xnet account activation. X-Git-Tag: xorg/1.1.0~26^2~17 X-Git-Url: http://git.polytechnique.org/?a=commitdiff_plain;h=30439e345867f0ba5535ad37744301fc021983bd;p=platal.git Logs in after password recovery and xnet account activation. Signed-off-by: Stéphane Jacob --- diff --git a/classes/xnetsession.php b/classes/xnetsession.php index 90cf11c..765ad5e 100644 --- a/classes/xnetsession.php +++ b/classes/xnetsession.php @@ -34,7 +34,7 @@ class XnetSession extends XorgSession } } - 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 = {?}', diff --git a/htdocs/javascript/xorg.js b/htdocs/javascript/xorg.js index b262759..0a1a478 100644 --- a/htdocs/javascript/xorg.js +++ b/htdocs/javascript/xorg.js @@ -566,7 +566,7 @@ function checkPassword(box, okLabel) { } } -function hashResponse(password1, password2, hasConfirmation) { +function hashResponse(password1, password2, hasConfirmation, doAuth) { var pw1 = $('[name=' + password1 + ']').val(); var pw2; @@ -593,6 +593,12 @@ function hashResponse(password1, password2, hasConfirmation) { 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; } diff --git a/modules/platal.php b/modules/platal.php index 3be5bc1..29821a6 100644 --- a/modules/platal.php +++ b/modules/platal.php @@ -383,9 +383,19 @@ Adresse de secours : " . Post::v('email') : "")); } 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); } } diff --git a/modules/xnet.php b/modules/xnet.php index 607b30c..e0fada4 100644 --- a/modules/xnet.php +++ b/modules/xnet.php @@ -259,11 +259,18 @@ class XnetModule extends PLModule $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']); } } diff --git a/templates/admin/accounts.tpl b/templates/admin/accounts.tpl index fece962..a6dad0d 100644 --- a/templates/admin/accounts.tpl +++ b/templates/admin/accounts.tpl @@ -119,7 +119,7 @@ function add_user_to_url(f) { + onclick="return hashResponse('password', false, false, false);" /> diff --git a/templates/admin/user.tpl b/templates/admin/user.tpl index 1d478a3..d9f35b1 100644 --- a/templates/admin/user.tpl +++ b/templates/admin/user.tpl @@ -252,7 +252,7 @@ $(function() { - + {if $user->state neq 'pending'} diff --git a/templates/googleapps/index.tpl b/templates/googleapps/index.tpl index 54d8391..70bb0fc 100644 --- a/templates/googleapps/index.tpl +++ b/templates/googleapps/index.tpl @@ -174,7 +174,7 @@ {else} - + {/if} @@ -379,7 +379,7 @@ - + diff --git a/templates/platal/password.tpl b/templates/platal/password.tpl index a0632cd..02cdee2 100644 --- a/templates/platal/password.tpl +++ b/templates/platal/password.tpl @@ -37,7 +37,7 @@
{icon name=lock} Saisie du {if !t($xnet)}nouveau {/if}mot de passe -
+ {xsrf_token_field} @@ -65,15 +65,42 @@ + + + +
+ + + + strictement personnelle'} colspan="2"> + +
- +
+
+
+ + + + + + + + + {if t($xnet)}{/if} +
+
+ {if !t($xnet)}

Note bien qu'il s'agit là du mot de passe te permettant de t'authentifier sur le site {#globals.core.sitename#} ; diff --git a/templates/register/step3.tpl b/templates/register/step3.tpl index ae9cf64..e6e9385 100644 --- a/templates/register/step3.tpl +++ b/templates/register/step3.tpl @@ -132,7 +132,7 @@ - + diff --git a/templates/xnet/edit.tpl b/templates/xnet/edit.tpl index f00c1e7..71ae196 100644 --- a/templates/xnet/edit.tpl +++ b/templates/xnet/edit.tpl @@ -109,7 +109,7 @@


- +  
diff --git a/templates/xnetgrp/membres-edit.tpl b/templates/xnetgrp/membres-edit.tpl index 12e1da1..0df7c6a 100644 --- a/templates/xnetgrp/membres-edit.tpl +++ b/templates/xnetgrp/membres-edit.tpl @@ -243,7 +243,7 @@

- +