Implement DB query
This commit is contained in:
parent
4b9a97cb08
commit
b1b06947bf
|
|
@ -2,6 +2,7 @@
|
||||||
namespace OCA\Registration\Db;
|
namespace OCA\Registration\Db;
|
||||||
|
|
||||||
use \OCP\IDb;
|
use \OCP\IDb;
|
||||||
|
use \OCP\Util;
|
||||||
|
|
||||||
class PendingRegist {
|
class PendingRegist {
|
||||||
|
|
||||||
|
|
@ -11,7 +12,16 @@ class PendingRegist {
|
||||||
$this->db = $db;
|
$this->db = $db;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function find($id) {
|
public function savePendingRegistration($email) {
|
||||||
|
$query = $this->db->prepareQuery( 'INSERT INTO `*PREFIX*registration`'
|
||||||
|
.' ( `email`, `token`, `requested` ) VALUES( ?, ?, ? )' );
|
||||||
|
$token = hash('sha256', generateRandomBytes(30).OC_Config::getValue('passwordsalt', ''));
|
||||||
|
$query->execute(array( $email, $token, time() ));
|
||||||
|
return $token;
|
||||||
|
}
|
||||||
|
public function find($email) {
|
||||||
|
$query = $this->db->prepareQuery('SELECT `email` FROM `*PREFIX*registration` WHERE `email` = ? ');
|
||||||
|
return $query->execute(array($email))->fetchAll();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue