Overview
Comment:Add change_user_password shell script
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk | stable
Files: files | file ages | folders
SHA3-256: 0b6b00c3f0809b7f27fa53f302774323f5c001717c1badfc5cfcd5f7300c4030
User & Date: bohwaz on 2022-03-03 11:49:14
Other Links: manifest | tags
Context
2022-03-03
13:43
Fix import when line reference is missing check-in: 53c084ef61 user: bohwaz tags: trunk, stable
11:49
Add change_user_password shell script check-in: 0b6b00c3f0 user: bohwaz tags: trunk, stable
11:30
Fix install after reset when organization name is NULL (how?) check-in: c6889f11c6 user: bohwaz tags: trunk, stable
Changes

Modified src/include/lib/Garradin/Install.php from [48ef093bd4] to [2ce081e755].

24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47






48
49
50
51
52
53
54
		$user = $session->getUser();

		if (!$session->checkPassword($password, $user->passe))
		{
			throw new UserException('Le mot de passe ne correspond pas.');
		}

		(new Sauvegarde)->create(date('Y-m-d-His-') . 'avant-remise-a-zero');

		Config::deleteInstance();
		DB::getInstance()->close();
		DB::deleteInstance();

		if (!trim($config->nom_asso)) {
			throw new UserException('Le nom de l\'association est vide, merci de le renseigner dans la configuration.');
		}

		if (!trim($user->identite)) {
			throw new UserException('L\'utilisateur connecté ne dispose pas de nom, merci de le renseigner.');
		}

		if (!trim($user->email)) {
			throw new UserException('L\'utilisateur connecté ne dispose pas d\'adresse e-mail, merci de la renseigner.');
		}







		file_put_contents(CACHE_ROOT . '/reset', json_encode([
			'password'     => $session::hashPassword($password),
			'name'         => $user->identite,
			'email'        => $user->email,
			'organization' => $config->nom_asso,
		]));







<
<
<
<
<
<











>
>
>
>
>
>







24
25
26
27
28
29
30






31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
		$user = $session->getUser();

		if (!$session->checkPassword($password, $user->passe))
		{
			throw new UserException('Le mot de passe ne correspond pas.');
		}







		if (!trim($config->nom_asso)) {
			throw new UserException('Le nom de l\'association est vide, merci de le renseigner dans la configuration.');
		}

		if (!trim($user->identite)) {
			throw new UserException('L\'utilisateur connecté ne dispose pas de nom, merci de le renseigner.');
		}

		if (!trim($user->email)) {
			throw new UserException('L\'utilisateur connecté ne dispose pas d\'adresse e-mail, merci de la renseigner.');
		}

		(new Sauvegarde)->create(date('Y-m-d-His-') . 'avant-remise-a-zero');

		Config::deleteInstance();
		DB::getInstance()->close();
		DB::deleteInstance();

		file_put_contents(CACHE_ROOT . '/reset', json_encode([
			'password'     => $session::hashPassword($password),
			'name'         => $user->identite,
			'email'        => $user->email,
			'organization' => $config->nom_asso,
		]));

Added src/scripts/change_user_password.php version [782584c2b0].



















































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
<?php

namespace Garradin;

use Garradin\Membres\Session;

if (PHP_SAPI != 'cli') {
	die("Wrong call");
}

require_once __DIR__ . '/../include/init.php';

$id = readline('User ID: ');
$pw = readline('Password: ');

if (!$id || !$pw) {
	exit;
}

$id = (int) $id;
$pw = trim($pw);
$pw = Session::hashPassword($pw);

DB::getInstance()->preparedQuery('UPDATE membres SET passe = ? WHERE id = ?;', $pw, $id);
echo "OK\n";

Modified src/scripts/cron.php from [f852009f8f] to [dbd2c4e5c7].

1
2
3
4
5




6
7
8
9
10
11
12
<?php

namespace Garradin;

use Garradin\Services\Reminders;





require_once __DIR__ . '/../include/init.php';

// Exécution des tâches automatiques

$config = Config::getInstance();






>
>
>
>







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
<?php

namespace Garradin;

use Garradin\Services\Reminders;

if (PHP_SAPI != 'cli') {
	die("Wrong call");
}

require_once __DIR__ . '/../include/init.php';

// Exécution des tâches automatiques

$config = Config::getInstance();

Modified src/scripts/upgrade.php from [63ad14ab52] to [f8b2f46a4c].

1
2
3
4
5




6
7
8
9
10
11
12
<?php

namespace Garradin;

const UPGRADE_PROCESS = true;





require_once __DIR__ . '/../include/init.php';

try {
	if (Upgrade::preCheck()) {
		Upgrade::upgrade();
		exit(2);





>
>
>
>







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
<?php

namespace Garradin;

const UPGRADE_PROCESS = true;

if (PHP_SAPI != 'cli') {
	die("Wrong call");
}

require_once __DIR__ . '/../include/init.php';

try {
	if (Upgrade::preCheck()) {
		Upgrade::upgrade();
		exit(2);