a78147ca1cd80c5bf11b3ed6a19e73c9b4c5e218
bernd webinterface => /webinterface

bernd authored 17 years ago

1) <?php
2) require_once('inc/debug.php');
bernd * Passwörter mit cracklib p...

bernd authored 16 years ago

3) require_once('inc/security.php');
bernd webinterface => /webinterface

bernd authored 17 years ago

4) 
5) $title = "Passwort &auml;ndern";
6) $error = '';
7) 
8) require_role(array(ROLE_SYSTEMUSER, ROLE_CUSTOMER));
9) 
10) 
11) if ($_POST['password1'] != '')
12) {
bernd XSRF-kram fixed

bernd authored 16 years ago

13)   check_form_token('index_chpass');
bernd webinterface => /webinterface

bernd authored 17 years ago

14)   $result = NULL;
15)   switch ($_SESSION['role'])
16)   {
17)     case ROLE_SYSTEMUSER:
18)       $result = find_role($_SESSION['userinfo']['uid'], $_POST['old_password']);
19)       break;
20)     case ROLE_CUSTOMER:
21)       $result = find_role($_SESSION['customerinfo']['customerno'], $_POST['old_password']);
22)       break;
23)   }
24)   if ($result == NULL)
25)     input_error('Das bisherige Passwort ist nicht korrekt!');
26)   elseif ($_POST['password2'] != $_POST['password1'])
27)     input_error('Die Best&auml;tigung ist nicht identisch mit dem neuen Passwort!');
28)   elseif ($_POST['password2'] == '')
29)     input_error('Sie m&uuml;ssen das neue Passwort zweimal eingeben!');
30)   elseif ($_POST['old_password'] == '')
31)     input_error('Altes Passwort nicht angegeben!');
bernd * Passwörter mit cracklib p...

bernd authored 16 years ago

32)   elseif (($check = strong_password($_POST['password1'])) !== true)
33)     input_error("Das Passwort ist zu einfach (cracklib sagt: {$check})!");
bernd webinterface => /webinterface

bernd authored 17 years ago

34)   else
35)   {
bernd * Passwörter mit cracklib p...

bernd authored 16 years ago

36)     if ($result === ROLE_SYSTEMUSER)
bernd webinterface => /webinterface

bernd authored 17 years ago

37)       set_systemuser_password($_SESSION['userinfo']['uid'], $_POST['password1']);
bernd * Passwörter mit cracklib p...

bernd authored 16 years ago

38)     elseif ($result === ROLE_CUSTOMER)
bernd webinterface => /webinterface

bernd authored 17 years ago

39)       set_customer_password($_SESSION['customerinfo']['customerno'], $_POST['password1']);
40)     else
41)       system_failure("WTF?!");
42)     
43)     if (! $debugmode)
44)       header('Location: index.php');
45)     else
46)       output('');
47)   }
48) }
49) 
50) 
51) 
52) if ($_SESSION['role'] == ROLE_SYSTEMUSER)
53)   warning('Beachten Sie: Wenn Sie hier Ihr Passwort ändern, betrifft dies auch Ihr Anmelde-Passwort am Server (SSH).');
54) 
55) output('<h3>Passwort &auml;ndern</h3>
56) <p>Hier k&ouml;nnen Sie Ihr Passwort &auml;ndern.</p>
57) <form method="post" action="'.($debugmode ? '?debug' : '').'">
bernd XSRF-kram fixed

bernd authored 16 years ago

58) '.generate_form_token('index_chpass').'