added signup_timestamp to accounts table
added getSignupTime() method to user class added 014_accounts_update.sql and updated 000_base_structure.sql incremented db version
This commit is contained in:
parent
15eca659b9
commit
9ecd8d4d3e
@ -58,6 +58,9 @@ class User extends Base {
|
|||||||
public function isAdmin($id) {
|
public function isAdmin($id) {
|
||||||
return $this->getUserAdmin($id);
|
return $this->getUserAdmin($id);
|
||||||
}
|
}
|
||||||
|
public function getSignupTime($id) {
|
||||||
|
return $this->getSingle($id, 'signup_timestamp', 'id');
|
||||||
|
}
|
||||||
public function changeNoFee($id) {
|
public function changeNoFee($id) {
|
||||||
$field = array('name' => 'no_fees', 'type' => 'i', 'value' => !$this->isNoFee($id));
|
$field = array('name' => 'no_fees', 'type' => 'i', 'value' => !$this->isNoFee($id));
|
||||||
return $this->updateSingle($id, $field);
|
return $this->updateSingle($id, $field);
|
||||||
@ -657,15 +660,15 @@ class User extends Base {
|
|||||||
! $this->setting->getValue('accounts_confirm_email_disabled') ? $is_locked = 1 : $is_locked = 0;
|
! $this->setting->getValue('accounts_confirm_email_disabled') ? $is_locked = 1 : $is_locked = 0;
|
||||||
$is_admin = 0;
|
$is_admin = 0;
|
||||||
$stmt = $this->mysqli->prepare("
|
$stmt = $this->mysqli->prepare("
|
||||||
INSERT INTO $this->table (username, pass, email, pin, api_key, is_locked)
|
INSERT INTO $this->table (username, pass, email, signup_timestamp, pin, api_key, is_locked)
|
||||||
VALUES (?, ?, ?, ?, ?, ?)
|
VALUES (?, ?, ?, ?, ?, ?, ?)
|
||||||
");
|
");
|
||||||
} else {
|
} else {
|
||||||
$is_locked = 0;
|
$is_locked = 0;
|
||||||
$is_admin = 1;
|
$is_admin = 1;
|
||||||
$stmt = $this->mysqli->prepare("
|
$stmt = $this->mysqli->prepare("
|
||||||
INSERT INTO $this->table (username, pass, email, pin, api_key, is_admin, is_locked)
|
INSERT INTO $this->table (username, pass, email, signup_timestamp, pin, api_key, is_admin, is_locked)
|
||||||
VALUES (?, ?, ?, ?, ?, 1, ?)
|
VALUES (?, ?, ?, ?, ?, ?, 1, ?)
|
||||||
");
|
");
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -674,8 +677,9 @@ class User extends Base {
|
|||||||
$pin_hash = $this->getHash($pin);
|
$pin_hash = $this->getHash($pin);
|
||||||
$apikey_hash = $this->getHash($username);
|
$apikey_hash = $this->getHash($username);
|
||||||
$username_clean = strip_tags($username);
|
$username_clean = strip_tags($username);
|
||||||
|
$signup_time = time();
|
||||||
|
|
||||||
if ($this->checkStmt($stmt) && $stmt->bind_param('sssssi', $username_clean, $password_hash, $email1, $pin_hash, $apikey_hash, $is_locked) && $stmt->execute()) {
|
if ($this->checkStmt($stmt) && $stmt->bind_param('sssissi', $username_clean, $password_hash, $email1, $signup_time, $pin_hash, $apikey_hash, $is_locked) && $stmt->execute()) {
|
||||||
if (! $this->setting->getValue('accounts_confirm_email_disabled') && $is_admin != 1) {
|
if (! $this->setting->getValue('accounts_confirm_email_disabled') && $is_admin != 1) {
|
||||||
if ($token = $this->token->createToken('confirm_email', $stmt->insert_id)) {
|
if ($token = $this->token->createToken('confirm_email', $stmt->insert_id)) {
|
||||||
$aData['username'] = $username_clean;
|
$aData['username'] = $username_clean;
|
||||||
|
|||||||
@ -19,6 +19,7 @@ CREATE TABLE IF NOT EXISTS `accounts` (
|
|||||||
`is_locked` tinyint(1) NOT NULL DEFAULT '0',
|
`is_locked` tinyint(1) NOT NULL DEFAULT '0',
|
||||||
`failed_logins` int(5) unsigned DEFAULT '0',
|
`failed_logins` int(5) unsigned DEFAULT '0',
|
||||||
`failed_pins` int(5) unsigned DEFAULT '0',
|
`failed_pins` int(5) unsigned DEFAULT '0',
|
||||||
|
`signup_timestamp` int(10) DEFAULT '0',
|
||||||
`last_login` int(10) DEFAULT NULL,
|
`last_login` int(10) DEFAULT NULL,
|
||||||
`pin` varchar(255) NOT NULL COMMENT 'four digit pin to allow account changes',
|
`pin` varchar(255) NOT NULL COMMENT 'four digit pin to allow account changes',
|
||||||
`api_key` varchar(255) DEFAULT NULL,
|
`api_key` varchar(255) DEFAULT NULL,
|
||||||
@ -130,7 +131,7 @@ CREATE TABLE IF NOT EXISTS `settings` (
|
|||||||
UNIQUE KEY `setting` (`name`)
|
UNIQUE KEY `setting` (`name`)
|
||||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||||
|
|
||||||
INSERT INTO `settings` (`name`, `value`) VALUES ('DB_VERSION', '0.0.3');
|
INSERT INTO `settings` (`name`, `value`) VALUES ('DB_VERSION', '0.0.4');
|
||||||
|
|
||||||
CREATE TABLE IF NOT EXISTS `shares` (
|
CREATE TABLE IF NOT EXISTS `shares` (
|
||||||
`id` bigint(30) NOT NULL AUTO_INCREMENT,
|
`id` bigint(30) NOT NULL AUTO_INCREMENT,
|
||||||
|
|||||||
2
sql/014_accounts_update.sql
Normal file
2
sql/014_accounts_update.sql
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
ALTER TABLE `accounts` ADD COLUMN `signup_timestamp` INT( 10 ) NOT NULL DEFAULT '0' AFTER `failed_pins`;
|
||||||
|
INSERT INTO `settings` (`name`, `value`) VALUES ('DB_VERSION', '0.0.4') ON DUPLICATE KEY UPDATE `value` = '0.0.4';
|
||||||
Loading…
Reference in New Issue
Block a user