erlaube Jabber-Passwörter mit Sonderzeichen und gib Fehlermeldung wenn ein Fehler auftritt
bernd

bernd commited on 2007-11-16 16:04:25
Zeige 1 geänderte Dateien mit 14 Einfügungen und 4 Löschungen.


git-svn-id: https://svn.schokokeks.org/repos/tools/webinterface/trunk@781 87cf0b9e-d624-0410-a070-f6ee81989793
... ...
@@ -41,6 +41,12 @@ function get_jabberaccount_details($id)
41 41
 }
42 42
 
43 43
 
44
+function valid_jabber_password($pass)
45
+{
46
+  $new = filter_input_general($pass);
47
+  return ($new == $pass);
48
+}
49
+
44 50
 
45 51
 function create_jabber_account($local, $domain, $password)
46 52
 {
... ...
@@ -49,7 +55,9 @@ function create_jabber_account($local, $domain, $password)
49 55
 
50 56
   $local = mysql_real_escape_string( filter_input_username($local) );
51 57
   $domain = (int) $domain;
52
-  $password = mysql_real_escape_string( filter_shell( $password ) );
58
+  if (! valid_jabber_password($password))
59
+    input_error('Das Passwort enthält Zeichen, die aufgrund technischer Beschränkungen momentan nicht benutzt werden können.');
60
+  $password = mysql_real_escape_string( filter_input_general( $password ) );
53 61
   
54 62
   if ($domain > 0)
55 63
   {
... ...
@@ -80,14 +88,16 @@ function create_jabber_account($local, $domain, $password)
80 88
 
81 89
 
82 90
 
83
-function change_jabber_password($id, $newpass)
91
+function change_jabber_password($id, $password)
84 92
 {
85 93
   require_role(ROLE_CUSTOMER);
86 94
   $customerno = (int) $_SESSION['customerinfo']['customerno'];
87 95
   $id = (int) $id;
88
-  $newpass = mysql_real_escape_string( filter_shell( $newpass ) );
96
+  if (! valid_jabber_password($password))
97
+    input_error('Das Passwort enthält Zeichen, die aufgrund technischer Beschränkungen momentan nicht benutzt werden können.');
98
+  $password = mysql_real_escape_string( filter_input_general( $password ) );
89 99
   
90
-  db_query("UPDATE jabber.accounts SET password='{$newpass}' WHERE customerno={$customerno} AND id={$id} LIMIT 1");
100
+  db_query("UPDATE jabber.accounts SET password='{$password}' WHERE customerno={$customerno} AND id={$id} LIMIT 1");
91 101
   logger("modules/jabber/include/jabberaccounts.php", "jabber", "changed password for account  »{$id}«");
92 102
 }
93 103
 
94 104