From d64a57f4f55e994670746bfba9f00aa4f590a480 Mon Sep 17 00:00:00 2001 From: =?utf8?q?St=C3=A9phane=20Jacob?= Date: Thu, 5 Aug 2010 17:21:02 +0200 Subject: [PATCH] Adds possibility for an Xnet animator to give a password to a xnet account. MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Signed-off-by: Stéphane Jacob --- classes/xnetpage.php | 2 ++ modules/xnetgrp.php | 8 ++++++++ templates/xnetgrp/membres-edit.tpl | 17 +++++++++++++++-- 3 files changed, 25 insertions(+), 2 deletions(-) diff --git a/classes/xnetpage.php b/classes/xnetpage.php index 2a63e16..a50e1d7 100644 --- a/classes/xnetpage.php +++ b/classes/xnetpage.php @@ -43,6 +43,8 @@ class XnetPage extends PlPage } $this->addJsLink('jquery.js'); $this->addJsLink('overlib.js'); + $this->addJsLink('secure_hash.js'); + $this->addJsLink('sha1.js'); $this->addJsLink('wiki.js'); $this->addJsLink('xorg.js'); $this->setTitle('Les associations polytechniciennes'); diff --git a/modules/xnetgrp.php b/modules/xnetgrp.php index 12585a6..7c7afc3 100644 --- a/modules/xnetgrp.php +++ b/modules/xnetgrp.php @@ -894,6 +894,13 @@ class XnetGrpModule extends PLModule Post::t('full_name'), Post::t('directory_name'), Post::t('display_name'), (Post::t('sex') == 'male') ? 'male' : 'female', Post::t('email'), (Post::t('type') == 'xnet') ? 'xnet' : 'virtual', $user->id()); + // If user is of type xnet and new password is given. + if (!Post::blank('pwhash') && Post::t('type') == 'xnet') { + XDB::query('UPDATE accounts + SET password = {?} + WHERE uid = {?}', + Post::t('pwhash'), $user->id()); + } } else if (!$user->perms) { XDB::query('UPDATE accounts SET email = {?} @@ -980,6 +987,7 @@ class XnetGrpModule extends PLModule } } + $page->addJsLink('password.js'); $page->assign('user', $user); $page->assign('listes', $mmlist->get_lists($user->forlifeEmail())); $page->assign('alias', $user->emailAliases($globals->asso('mail_domain'), 'user', true)); diff --git a/templates/xnetgrp/membres-edit.tpl b/templates/xnetgrp/membres-edit.tpl index aafe431..6a4192a 100644 --- a/templates/xnetgrp/membres-edit.tpl +++ b/templates/xnetgrp/membres-edit.tpl @@ -28,6 +28,7 @@ document.getElementById('prenom').style.display = state; document.getElementById('sexe').style.display = state; document.getElementById('make_X').style.display = state; + document.getElementById('password').style.display = state; } function showXInput(box) @@ -133,6 +134,18 @@ {if $user->type eq 'xnet'} + + Mot de passe : + +
+ + +
+
+ {checkpasswd prompt="new_plain_password" submit="dummy_none"} +
+ + @@ -199,10 +212,10 @@

- +   -
+ -- 2.1.4