Replace isAdministrator with power
This commit is contained in:
parent
3dd6c276b4
commit
5de69128fb
2 changed files with 5 additions and 5 deletions
|
@ -20,8 +20,8 @@ if (isset($_POST['email'], $_POST['password'])) {
|
||||||
;');
|
;');
|
||||||
} else {
|
} else {
|
||||||
$database->query('INSERT INTO `users`
|
$database->query('INSERT INTO `users`
|
||||||
(`email`, `password`, `isAdministrator`) VALUES
|
(`email`, `password`, `power`) VALUES
|
||||||
("' . $_POST['email'] . '", "' . sha1($_POST['password']) . '", ' . true . ')
|
("' . $_POST['email'] . '", "' . sha1($_POST['password']) . '", 100)
|
||||||
;');
|
;');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -21,11 +21,11 @@ if ('POST' === $_SERVER['REQUEST_METHOD']) {
|
||||||
/** Current version is below 0.2.0 */
|
/** Current version is below 0.2.0 */
|
||||||
if (-1 === version_compare($options->version, '0.2.0')) {
|
if (-1 === version_compare($options->version, '0.2.0')) {
|
||||||
$database->query('ALTER TABLE `users`
|
$database->query('ALTER TABLE `users`
|
||||||
ADD `last_login` DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP AFTER `password`,
|
ADD `last_login` DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP AFTER `password`,
|
||||||
ADD `isAdministrator` BOOLEAN NOT NULL AFTER `last_login`
|
ADD `power` BOOLEAN NOT NULL DEFAULT 0 AFTER `last_login`
|
||||||
;');
|
;');
|
||||||
$database->query('UPDATE `users`
|
$database->query('UPDATE `users`
|
||||||
SET `isAdministrator` = ' . true . '
|
SET `power` = 100
|
||||||
WHERE `id` = ' . $user->id .
|
WHERE `id` = ' . $user->id .
|
||||||
';');
|
';');
|
||||||
$database->query('ALTER TABLE `users` ADD INDEX(`password`);');
|
$database->query('ALTER TABLE `users` ADD INDEX(`password`);');
|
||||||
|
|
Loading…
Reference in a new issue