git.ucc.asn.au
/
matches
/
MCTX3420.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
| inline |
side by side
Begin modifying UserCake
[matches/MCTX3420.git]
/
testing
/
MCTXWeb
/
public_html
/
users
/
models
/
funcs.php
diff --git
a/testing/MCTXWeb/public_html/users/models/funcs.php
b/testing/MCTXWeb/public_html/users/models/funcs.php
index
021f3a0
..
b1afc72
100644
(file)
--- a/
testing/MCTXWeb/public_html/users/models/funcs.php
+++ b/
testing/MCTXWeb/public_html/users/models/funcs.php
@@
-71,14
+71,23
@@
function generateHash($plainText, $salt = null)
{
\r
if ($salt === null)
\r
{
\r
- $salt = substr(md5(uniqid(rand(), true)), 0, 25);
\r
+ //$salt = substr(md5(uniqid(rand(), true)), 0, 25); // Original UserCake
\r
+ $random = file_get_contents("/dev/urandom", false, null, 0, 25); // Get random number
\r
+ $salt = '$6$'.bin2hex($random).'$'; // Make hex salt
\r
+
\r
}
\r
- 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
}
\r
\r
//Checks if an email is valid
\r
UCC
git Repository :: git.ucc.asn.au