74a5d99205ca17ae3903126bc7d7f2b15ac7bcb3
bernd webinterface => /webinterface

bernd authored 17 years ago

1) <?php
2) require_once('inc/debug.php');
3) 
4) $title = "Passwort &auml;ndern";
5) $error = '';
6) 
7) require_role(array(ROLE_SYSTEMUSER, ROLE_CUSTOMER));
8) 
9) 
10) if ($_POST['password1'] != '')
11) {
bernd XSRF-kram fixed

bernd authored 16 years ago

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

bernd authored 17 years ago

13)   $result = NULL;
14)   switch ($_SESSION['role'])
15)   {
16)     case ROLE_SYSTEMUSER:
17)       $result = find_role($_SESSION['userinfo']['uid'], $_POST['old_password']);
18)       break;
19)     case ROLE_CUSTOMER:
20)       $result = find_role($_SESSION['customerinfo']['customerno'], $_POST['old_password']);
21)       break;
22)   }
23)   if ($result == NULL)
24)     input_error('Das bisherige Passwort ist nicht korrekt!');
25)   elseif ($_POST['password2'] != $_POST['password1'])
26)     input_error('Die Best&auml;tigung ist nicht identisch mit dem neuen Passwort!');
27)   elseif ($_POST['password2'] == '')
28)     input_error('Sie m&uuml;ssen das neue Passwort zweimal eingeben!');
29)   elseif ($_POST['old_password'] == '')
30)     input_error('Altes Passwort nicht angegeben!');
31)   else
32)   {
33)     if ($result == ROLE_SYSTEMUSER)
34)       set_systemuser_password($_SESSION['userinfo']['uid'], $_POST['password1']);
35)     elseif ($result == ROLE_CUSTOMER)
36)       set_customer_password($_SESSION['customerinfo']['customerno'], $_POST['password1']);
37)     else
38)       system_failure("WTF?!");
39)     
40)     if (! $debugmode)
41)       header('Location: index.php');
42)     else
43)       output('');
44)   }
45) }
46) 
47) 
48) 
49) if ($_SESSION['role'] == ROLE_SYSTEMUSER)
50)   warning('Beachten Sie: Wenn Sie hier Ihr Passwort ändern, betrifft dies auch Ihr Anmelde-Passwort am Server (SSH).');
51) 
52) output('<h3>Passwort &auml;ndern</h3>
53) <p>Hier k&ouml;nnen Sie Ihr Passwort &auml;ndern.</p>
54) <form method="post" action="'.($debugmode ? '?debug' : '').'">
bernd XSRF-kram fixed

bernd authored 16 years ago

55) '.generate_form_token('index_chpass').'