From 8970322808c0403db626aee2411e3bb12acf321f Mon Sep 17 00:00:00 2001 From: Phyks Date: Fri, 9 Aug 2013 23:43:56 +0200 Subject: [PATCH] Edit password almost working --- TODO | 8 +++ index.php | 16 +++++ ....af3906cfde643ae7f290cfdc51cc9342.rtpl.php | 8 +-- ....36ba0f7e771a8681573a91518b54b424.rtpl.php | 31 ++++++++- ....af3906cfde643ae7f290cfdc51cc9342.rtpl.php | 69 ++++++++++--------- tpl/css/style.css | 2 +- tpl/edit_users.html | 4 ++ 7 files changed, 99 insertions(+), 39 deletions(-) diff --git a/TODO b/TODO index c91d51c..f304309 100755 --- a/TODO +++ b/TODO @@ -2,3 +2,11 @@ * Vérification des variables dans les classes + throw exception * tokens + ban system * TRUNCATE before CREATE TABLE in install.php + +install.php : +============= +* Link beside password field to toggle visible / not visible + +index.php : +=========== +* Edit password doesn't work diff --git a/index.php b/index.php index f4cccf9..e296ab3 100644 --- a/index.php +++ b/index.php @@ -10,6 +10,7 @@ $tpl->assign('instance_title', INSTANCE_TITLE); $tpl->assign('connection', false); $tpl->assign('notice', ''); + $tpl->assign('error', ''); session_start(); $current_user = (isset($_SESSION['current_user']) ? unserialize($_SESSION['current_user']) : false); @@ -52,7 +53,22 @@ break; case 'password': + if(!empty($_POST['password']) && !empty($_POST['password_confirm'])) { + if($_POST['password'] == $_POST['password_confirm']) { + $user = new User(); + $user->setLogin($current_user['login']); + $user->setPassword($user->encrypt($_POST['password'])); + $user->setAdmin($current_user['admin']); + $user->setId($current_user['id']); + $user->save(); + header('location: index.php'); + exit(); + } + else { + $tpl->assign('error', 'The content of the two password fields doesn\'t match.'); + } + } $tpl->draw('edit_users'); break; diff --git a/tmp/connexion.af3906cfde643ae7f290cfdc51cc9342.rtpl.php b/tmp/connexion.af3906cfde643ae7f290cfdc51cc9342.rtpl.php index 004f015..59e152d 100644 --- a/tmp/connexion.af3906cfde643ae7f290cfdc51cc9342.rtpl.php +++ b/tmp/connexion.af3906cfde643ae7f290cfdc51cc9342.rtpl.php @@ -1,10 +1,10 @@ assign( $this->var );$tpl->draw( dirname("header") . ( substr("header",-1,1) != "/" ? "/" : "" ) . basename("header") );?> -

- Connexion

+

- Connexion

-
-

-

+ +

+

diff --git a/tmp/header.36ba0f7e771a8681573a91518b54b424.rtpl.php b/tmp/header.36ba0f7e771a8681573a91518b54b424.rtpl.php index f1b7c5a..de64d30 100644 --- a/tmp/header.36ba0f7e771a8681573a91518b54b424.rtpl.php +++ b/tmp/header.36ba0f7e771a8681573a91518b54b424.rtpl.php @@ -3,7 +3,36 @@ <?php echo $instance_title;?> - + + + +

+ + + +

+ + + + + + diff --git a/tmp/index.af3906cfde643ae7f290cfdc51cc9342.rtpl.php b/tmp/index.af3906cfde643ae7f290cfdc51cc9342.rtpl.php index 3e9187a..ddedea3 100644 --- a/tmp/index.af3906cfde643ae7f290cfdc51cc9342.rtpl.php +++ b/tmp/index.af3906cfde643ae7f290cfdc51cc9342.rtpl.php @@ -1,49 +1,52 @@ assign( $this->var );$tpl->draw( dirname("header") . ( substr("header",-1,1) != "/" ? "/" : "" ) . basename("header") );?> -

- - - - -
-

Qui doit quoi ?

-

Lire ligne doit case€ à colonne. Les liens permettent de confirmer le paiement des dettes.

- +

Balance

+

Read line owes case€ to column. You can click on links to confirm the payback. +

- + + $value1 ){ $counter1++; ?> + + + + + $value1 ){ $counter1++; ?> + + + + + +
Doit\ÀOwes\To
-

Dépenses détaillées du mois actuel

+

Detailed list of bills for last month

- - - - - - + + + + + + + $value1 ){ $counter1++; ?> + + + + + + + + + + + +
DatePayé parParticipantsMontantMenuModifierSupprimerPaid byUsers inAmountWhat ?EditDelete
EditDelete
diff --git a/tpl/css/style.css b/tpl/css/style.css index f153f9d..0dfcb94 100644 --- a/tpl/css/style.css +++ b/tpl/css/style.css @@ -94,7 +94,7 @@ input[type=submit] { margin: 0; } -#install .error { +.error { font-size: 1.5em; color: red; font-weight: bold; diff --git a/tpl/edit_users.html b/tpl/edit_users.html index b868bdc..6955660 100644 --- a/tpl/edit_users.html +++ b/tpl/edit_users.html @@ -1,5 +1,9 @@ {include="header"} +{if condition="$error != ''"} +

{$error}

+{/if} +

Edit your password