Changed variables.
This commit is contained in:
@@ -6,10 +6,10 @@ use Nickyeoman\Validation;
|
||||
|
||||
$validate = new Validation\Validate();
|
||||
$valid = true;
|
||||
$p = $post->all();
|
||||
$p = $ctx->post->all();
|
||||
|
||||
// Check secure key
|
||||
if (empty($p['secure_key']) || $p['secure_key'] !== $config['secure_key']) {
|
||||
if (empty($p['secure_key']) || $p['secure_key'] !== $ctx->config['secure_key']) {
|
||||
$valid = false;
|
||||
}
|
||||
|
||||
@@ -31,7 +31,7 @@ if (empty($p['password'])) {
|
||||
$valid = false;
|
||||
} else {
|
||||
// Use pepper + Argon2id
|
||||
$peppered = hash_hmac('sha3-512', $p['password'], $config['secure_key']);
|
||||
$peppered = hash_hmac('sha3-512', $p['password'], $ctx->config['secure_key']);
|
||||
$hashed_password = password_hash($peppered, PASSWORD_ARGON2ID);
|
||||
}
|
||||
|
||||
@@ -45,16 +45,16 @@ if ($valid) {
|
||||
EOSQL;
|
||||
|
||||
$params = [$name, $hashed_password, $p['email']];
|
||||
$db->query($query, $params);
|
||||
$userid = $db->lastid();
|
||||
$ctx->db->query($query, $params);
|
||||
$userid = $ctx->db->lastid();
|
||||
|
||||
// Assign admin group
|
||||
$groupInsertQuery = <<<EOSQL
|
||||
INSERT INTO `user_groups` (`user_id`, `groupName`) VALUES (?, ?);
|
||||
EOSQL;
|
||||
|
||||
$db->query($groupInsertQuery, [$userid, 'admin']);
|
||||
$ctx->db->query($groupInsertQuery, [$userid, 'admin']);
|
||||
}
|
||||
|
||||
// Always redirect at end
|
||||
$redirect->url('/novaconium');
|
||||
$ctx->redirect->url('/novaconium');
|
||||
|
||||
Reference in New Issue
Block a user