fix shell linebreaks, ignore empty names
This commit is contained in:
parent
2ab458f044
commit
8743fd12a5
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -1 +1,2 @@
|
|||
config.ini
|
||||
local/
|
||||
|
|
|
@ -22,8 +22,10 @@ class AbstimmIDd {
|
|||
return ["error" => "event not found"];
|
||||
}
|
||||
foreach($body->user_names as $name) {
|
||||
$hash = $this->get_hash($event_id, $vote_round, $name);
|
||||
$result[] = ["round" => $vote_round, "user_name" => $name, "hash" => $hash];
|
||||
if (strlen($name) > 0) {
|
||||
$hash = $this->get_hash($event_id, $vote_round, $name);
|
||||
$result[] = ["round" => $vote_round, "user_name" => $name, "hash" => $hash];
|
||||
}
|
||||
}
|
||||
return $result;
|
||||
}
|
||||
|
@ -57,10 +59,10 @@ class AbstimmIDd {
|
|||
$name = addslashes($name);
|
||||
|
||||
// generate the hash (the PHP password_hash function does not provide the required options)
|
||||
$hash = shell_exec("echo -n '$name' | argon2 'Abstimmung $vote_round'
|
||||
-p {$this->cfg["argon2"]["threads"]}
|
||||
-m {$this->cfg["argon2"]["memory"]}
|
||||
-t {$this->cfg["argon2"]["iterations"]}
|
||||
$hash = shell_exec("echo -n '$name' | argon2 'Abstimmung $vote_round' \
|
||||
-p {$this->cfg["argon2"]["threads"]} \
|
||||
-m {$this->cfg["argon2"]["memory"]} \
|
||||
-t {$this->cfg["argon2"]["iterations"]} \
|
||||
-l {$this->cfg["argon2"]["length"]} -id -r");
|
||||
$hash = str_replace(array("\n", "\r"), '', $hash);
|
||||
|
||||
|
|
Loading…
Reference in a new issue