Browse code

E-Mail-Adresse verifizieren in das neue Modul integriert

Bernd Wurst authored on12/01/2018 11:49:16
Showing6 changed files
... ...
@@ -39,3 +39,16 @@ function get_kundenhandles() {
39 39
     return $ret;
40 40
 }
41 41
 
42
+
43
+function update_pending($handleid) {
44
+    $handleid = (int) $handleid;
45
+    $result = db_query("SELECT email FROM kundendaten.mailaddress_token WHERE handle=?", array($handleid));
46
+    if ($result->rowCount() == 0) {
47
+        return NULL;
48
+    }
49
+    $res = $result->fetch();
50
+    return $res['email'];
51
+}
52
+
53
+
54
+
... ...
@@ -33,7 +33,7 @@ function verify_mail_token($token)
33 33
 
34 34
 function update_mailaddress($daten)
35 35
 {
36
-    $kunde = $daten['handle'];
36
+    $handle = $daten['handle'];
37 37
     $email = $daten['email'];
38 38
 
39 39
     if (! check_emailaddr($email)) {
... ...
@@ -44,8 +44,12 @@ foreach ($handles as $id => $handle) {
44 44
     if ($id == $kundenhandles['rechnung']) {
45 45
         $usage .= 'Rechnungs-Adresse';
46 46
     }
47
-    
48
-    output("<tr><td>{$handle['id']}</td><td><strong>{$handle['name']}</strong></td><td>$adresse</td><td>{$handle['email']}</td><td>$usage</td><td>...</td></tr>");
47
+    $email = $handle['email'];
48
+    $new_email = update_pending($id);
49
+    if ($new_email) {
50
+        $email = $new_email.footnote('Die E-Mail-Adresse wurde noch nicht bestätigt');
51
+    }
52
+    output("<tr><td>{$handle['id']}</td><td><strong>{$handle['name']}</strong></td><td>$adresse</td><td>$email</td><td>$usage</td><td>...</td></tr>");
49 53
 }
50 54
 output('</table>');
51 55
 output("<br />");
... ...
@@ -19,7 +19,7 @@ $role = $_SESSION['role'];
19 19
 
20 20
 if (($role & ROLE_CUSTOMER))
21 21
 {
22
-  $menu["index_handles"] = array("label" => "Adressen verwalten", "file" => "list", "weight" => 1, "submenu" => "index_index");
22
+  $menu["handles_list"] = array("label" => "Adressen verwalten", "file" => "list", "weight" => 1, "submenu" => "index_index");
23 23
 }
24 24
 
25 25
 ?>
... ...
@@ -14,11 +14,11 @@ https://creativecommons.org/publicdomain/zero/1.0/
14 14
 Nevertheless, in case you use a significant part of this code, we ask (but not require, see the license) that you keep the authors' names in place and return your changes to the public. We would be especially happy if you tell us what you're going to do with this code.
15 15
 */
16 16
 
17
-require_once('kundendaten.php');
17
+require_once('verify.php');
18 18
 require_once('inc/security.php');
19 19
 
20 20
 title("E-Mail-Adresse bestätigen");
21
-$show = 'token';
21
+$section = 'handles_list';
22 22
 
23 23
 if (isset($_REQUEST['token']))
24 24
 {
... ...
@@ -25,9 +25,6 @@ if ($role == ROLE_ANONYMOUS) {
25 25
   if ($role & (ROLE_SYSTEMUSER | ROLE_CUSTOMER)) {
26 26
     $menu["index_chpass"] = array("label" => "Passwort ändern", "file" => "chpass", "weight" => 98);
27 27
   }
28
-  if ($role & ROLE_CUSTOMER) {
29
-    $menu["index_chdetails"] = array("label" => "Adressen ändern", "file" => "chdetails", "weight" => 1, "submenu" => "index_index");
30
-  }
31 28
 
32 29
   $menu["index_logout"] = array("label" => "Logout", "file" => "logout", "weight" => 99);
33 30
   $menu["index_index"] = array("label" => "Übersicht", "file" => "index", "weight" => 0);