X-Git-Url: http://git.polytechnique.org/?a=blobdiff_plain;f=modules%2Fplatal.php;h=c558b49137ccd5dbfde01712995a10c8b6f6de12;hb=a81ee98706ff11231e6d708270e2fb1c97775650;hp=197728eb4ec855442a268eb2608f2501a241654b;hpb=fe13bc1d7ba9f72d452ec07baf8538a74b7c67b8;p=platal.git diff --git a/modules/platal.php b/modules/platal.php index 197728e..c558b49 100644 --- a/modules/platal.php +++ b/modules/platal.php @@ -45,13 +45,13 @@ class PlatalModule extends PLModule // Preferences thingies 'prefs' => $this->make_hook('prefs', AUTH_COOKIE), 'prefs/rss' => $this->make_hook('prefs_rss', AUTH_COOKIE), - 'prefs/webredirect' => $this->make_hook('webredir', AUTH_MDP), + 'prefs/webredirect' => $this->make_hook('webredir', AUTH_MDP, 'mail'), 'prefs/skin' => $this->make_hook('skin', AUTH_COOKIE), // password related thingies 'password' => $this->make_hook('password', AUTH_MDP), 'tmpPWD' => $this->make_hook('tmpPWD', AUTH_PUBLIC), - 'password/smtp' => $this->make_hook('smtppass', AUTH_MDP), + 'password/smtp' => $this->make_hook('smtppass', AUTH_MDP, 'mail'), 'recovery' => $this->make_hook('recovery', AUTH_PUBLIC), 'exit' => $this->make_hook('exit', AUTH_PUBLIC), 'review' => $this->make_hook('review', AUTH_PUBLIC), @@ -113,10 +113,10 @@ class PlatalModule extends PLModule function __set_rss_state($state) { if ($state) { - S::set('token', rand_url_id(16)); + S::user()->token = rand_url_id(16); XDB::execute('UPDATE accounts SET token = {?} - WHERE uid = {?}', S::s('token'), S::i('uid')); + WHERE uid = {?}', S::user()->token, S::i('uid')); } else { S::kill('token'); XDB::execute('UPDATE accounts @@ -132,11 +132,7 @@ class PlatalModule extends PLModule if (Post::has('email_format')) { $fmt = Post::s('email_format'); - XDB::execute("UPDATE accounts - SET email_format = {?} - WHERE uid = {?}", - $fmt, S::v('uid')); - S::set('email_format', $fmt); + S::user()->setEmailFormat($fmt); } if (Post::has('rss')) { @@ -206,10 +202,10 @@ class PlatalModule extends PLModule { global $globals; - if (Post::has('response2')) { + if (Post::has('pwhash') && Post::t('pwhash')) { S::assert_xsrf_token(); - S::set('password', $password = Post::v('response2')); + S::set('password', $password = Post::t('pwhash')); XDB::execute('UPDATE accounts SET password = {?} WHERE uid={?}', $password, @@ -228,12 +224,12 @@ class PlatalModule extends PLModule S::logger()->log('passwd'); Platal::session()->setAccessCookie(true); - $page->changeTpl('platal/motdepasse.success.tpl'); + $page->changeTpl('platal/password.success.tpl'); $page->run(); } - $page->changeTpl('platal/motdepasse.tpl'); - $page->addJsLink('motdepasse.js'); + $page->changeTpl('platal/password.tpl'); + $page->addJsLink('password.js'); $page->setTitle('Mon mot de passe'); } @@ -369,8 +365,8 @@ Adresse de secours : " . Post::v('email') : "")); } $uid = $ligne["uid"]; - if (Post::has('response2')) { - $password = Post::v('response2'); + if (Post::has('pwhash') && Post::t('pwhash')) { + $password = Post::t('pwhash'); XDB::query('UPDATE accounts SET password={?} WHERE uid = {?} AND state = \'active\'', @@ -391,8 +387,8 @@ Adresse de secours : " . Post::v('email') : "")); S::logger($uid)->log("passwd", ""); $page->changeTpl('platal/tmpPWD.success.tpl'); } else { - $page->changeTpl('platal/motdepasse.tpl'); - $page->addJsLink('motdepasse.js'); + $page->changeTpl('platal/password.tpl'); + $page->addJsLink('password.js'); } } @@ -453,7 +449,7 @@ Adresse de secours : " . Post::v('email') : "")); } } - function handler_review(&$page, $action = null, $mode = null) + function handler_review(&$page, $action = null, $mode = null) { // Include X-XRDS-Location response-header for Yadis discovery global $globals;