- else\r
- {\r
- $salt = substr($salt, 0, 25);\r
- }\r
- \r
- return $salt . sha1($salt . $plainText);\r
+ //return $salt . sha1($salt . $plainText); // Original UserCake\r
+ return crypt($plainText, $salt);\r
+}\r
+\r
+/**\r
+ * Generates a random password for emailing to new users.\r
+ * User should be asked to change the password.\r
+ */\r
+function generatePassword()\r
+{\r
+ $random = file_get_contents("/dev/urandom", false, null, 0, 25);\r
+ return bin2hex($random);\r