Ermögliche das Rücksetzen des Passworts im Webinterface
Bernd Wurst

Bernd Wurst commited on 2017-06-02 11:16:40
Zeige 3 geänderte Dateien mit 34 Einfügungen und 3 Löschungen.

... ...
@@ -52,6 +52,12 @@ function delete_list($id)
52 52
   db_query("UPDATE mail.mailman_lists SET status='delete' WHERE owner=:uid AND id=:id", $args);
53 53
 }
54 54
 
55
+function request_new_password($id)
56
+{
57
+  $args = array(":id" => $id,
58
+                ":uid" => $_SESSION['userinfo']['uid']);
59
+  db_query("UPDATE mail.mailman_lists SET status='newpw' WHERE owner=:uid AND id=:id", $args);
60
+}
55 61
 
56 62
 function create_list($listname, $maildomain, $admin)
57 63
 {
... ...
@@ -55,15 +55,21 @@ if (! empty($lists))
55 55
       $style = ' style="text-decoration: underline;" ';
56 56
       $status = 'Wird angelegt';
57 57
     }
58
+    elseif ($list['status'] == 'newpw')
59
+    {
60
+      $style = ' style="font-style: italic;" ';
61
+      $status = 'Neues Passwort angefordert';
62
+    }
58 63
     elseif ($list['status'] == 'failure')
59 64
     {
60 65
       $style = ' style="font-style: italic;" ';
61 66
       $status = 'Fehler bei der Erstellung';
62 67
     }
63 68
     
69
+
64 70
     output("<tr><td{$style}><strong>{$list['listname']}</strong>@{$list['fqdn']}</td><td{$style}>{$list['admin']}</td><td>{$status}</td><td style=\"text-align: right;\">{$sizestr}</td>");
65 71
     if ($list['status'] == 'running')
66
-      output("<td>".internal_link('save', icon_delete("Mailingliste löschen"), "action=delete&id={$list['id']}")." <a href=\"https://".config('mailman_host')."/mailman/admin.cgi/{$list['listname']}\">".other_icon("database_go.png", "Listen-Verwaltung aufrufen")."</a></td></tr>\n");
72
+      output("<td>".internal_link('save', icon_edit("Neues Passwort anfordern"), "action=newpw&id={$list['id']}").internal_link('save', icon_delete("Mailingliste löschen"), "action=delete&id={$list['id']}")." <a href=\"https://".config('mailman_host')."/mailman/admin.cgi/{$list['listname']}\">".other_icon("database_go.png", "Listen-Verwaltung aufrufen")."</a></td></tr>\n");
67 73
     else
68 74
       output("<td>&#160;</td></tr>\n");
69 75
   }
... ...
@@ -41,7 +41,26 @@ if ($_GET['action'] == 'new')
41 41
     header('Location: lists');
42 42
 }
43 43
 
44
-elseif ($_GET['action'] == 'delete')
44
+elseif ($_GET['action'] == 'newpw') {
45
+  $list = get_list($_GET['id']);
46
+  $sure = user_is_sure();
47
+  if ($sure === NULL)
48
+  {
49
+    are_you_sure('action=newpw&id='.$list['id'], 'Möchten Sie für die Mailingliste »<strong>'.$list['listname'].'</strong>@'.$list['fqdn'].'« ein neues Passwort anfordern?');
50
+  }
51
+  elseif ($sure === true)
52
+  {
53
+    request_new_password($list['id']);
54
+    if (! $debugmode)
55
+      header('Location: lists');
56
+  }
57
+  elseif ($sure === false)
58
+  {
59
+    if (! $debugmode)
60
+      header('Location: lists');
61
+  }
62
+}
63
+elseif ($_GET['action'] == 'delete') {
45 64
   $list = get_list($_GET['id']);
46 65
   $sure = user_is_sure();
47 66
   if ($sure === NULL)
... ...
@@ -59,7 +78,7 @@ elseif ($_GET['action'] == 'delete')
59 78
     if (! $debugmode)
60 79
       header('Location: lists');
61 80
   }
62
-
81
+}
63 82
 else
64 83
 {
65 84
   system_failure('Function not implemented');
66 85