Improved password storage schema
[PHPCredLocker.git] / lib / db / authdb.class.php
blob:a/lib/db/authdb.class.php -> blob:b/lib/db/authdb.class.php
--- a/lib/db/authdb.class.php
+++ b/lib/db/authdb.class.php
@@ -213,6 +213,25 @@
 
 return $this->runQuery();
 }
+
+
+
+/** Update a user's password hash in the database
+*
+*/
+function updPass($user,$hash,$salt){
+  $crypt = new Crypto;
+  $user = $this->stringEscape($user);
+  $hash = $this->stringEscape($crypt->encrypt($hash.":".$salt,'auth'));
+
+  $sql = "UPDATE #__Users SET `pass`='$hash' WHERE `username`='$user'";
+  
+  $this->setQuery($sql);
+  $result = $this->runQuery();
+
+}
+
+
 
 
 /** Edit user