demo mode (you can't update password in demo mode

This commit is contained in:
Nicolas Lœuillet 2013-06-01 08:29:37 +02:00
parent da368cc84f
commit 6499b26ae8
8 changed files with 15 additions and 4 deletions

0
img/messages/close.png Executable file → Normal file
View file

Before

Width:  |  Height:  |  Size: 662 B

After

Width:  |  Height:  |  Size: 662 B

0
img/messages/cross.png Executable file → Normal file
View file

Before

Width:  |  Height:  |  Size: 655 B

After

Width:  |  Height:  |  Size: 655 B

0
img/messages/help.png Executable file → Normal file
View file

Before

Width:  |  Height:  |  Size: 786 B

After

Width:  |  Height:  |  Size: 786 B

0
img/messages/tick.png Executable file → Normal file
View file

Before

Width:  |  Height:  |  Size: 537 B

After

Width:  |  Height:  |  Size: 537 B

0
img/messages/warning.png Executable file → Normal file
View file

Before

Width:  |  Height:  |  Size: 666 B

After

Width:  |  Height:  |  Size: 666 B

View file

@ -14,6 +14,7 @@ if (!is_dir('db/')) {
@mkdir('db/',0705);
}
define ('MODE_DEMO', FALSE);
define ('ABS_PATH', 'assets/');
define ('CONVERT_LINKS_FOOTNOTES', TRUE);
define ('REVERT_FORCED_PARAGRAPH_ELEMENTS',FALSE);

View file

@ -74,6 +74,13 @@ class Sqlite extends Store {
return isset($pass[0]['value']) ? $pass[0]['value'] : FALSE;
}
public function updatePassword($password)
{
$sql_update = "UPDATE config SET value=? WHERE name='password'";
$params_update = array($password);
$query = $this->executeQuery($sql_update, $params_update);
}
private function executeQuery($sql, $params) {
try
{

View file

@ -54,14 +54,17 @@ elseif (isset($_GET['config'])) {
if (isset($_POST['password']) && isset($_POST['password_repeat'])) {
if ($_POST['password'] == $_POST['password_repeat'] && $_POST['password'] != "") {
logm('password updated');
$store->updatePassword(encode_string($_POST['password'] . $_SESSION['login']));
$msg->add('s', 'your password has been updated');
if (!DEMO) {
$store->updatePassword(encode_string($_POST['password'] . $_SESSION['login']));
$msg->add('s', 'your password has been updated');
}
else {
$msg->add('i', 'in demo mode, you can\'t update password');
}
}
else
$msg->add('e', 'your password can\'t be empty and you have to repeat it in the second field');
}
else
$msg->add('e', 'error in your password update');
}
# Traitement des paramètres et déclenchement des actions