mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-02-25 18:45:27 -06:00
Properly check hashes, issue #456
This commit is contained in:
parent
ffca4b0543
commit
4dccf7b7b5
@ -84,6 +84,7 @@ class UserEventHandler
|
||||
*/
|
||||
public function saveEmailAddress(DeletedUser $event): bool
|
||||
{
|
||||
Preferences::mark();
|
||||
$email = hash('sha256', $event->email);
|
||||
Log::debug(sprintf('Hash of email is %s', $email));
|
||||
/** @var Configuration $configuration */
|
||||
@ -94,7 +95,10 @@ class UserEventHandler
|
||||
}
|
||||
$content[] = $email;
|
||||
$configuration->data = $content;
|
||||
$configuration->save();
|
||||
Log::debug('New content of deleted_users is ', $content);
|
||||
FireflyConfig::set('deleted_users', $content);
|
||||
|
||||
Preferences::mark();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -100,6 +100,8 @@ class RegisterController extends Controller
|
||||
$hash = hash('sha256', $data['email']);
|
||||
$configuration = FireflyConfig::get('deleted_users', []);
|
||||
$set = $configuration->data;
|
||||
Log::debug(sprintf('Hash of email is %s', $hash));
|
||||
Log::debug('Hashes of deleted users: ', $set);
|
||||
if (in_array($hash, $set)) {
|
||||
// user already deleted, cannot re-register :(
|
||||
$validator->getMessageBag()->add('email', (string)trans('validation.deleted_user'));
|
||||
@ -108,6 +110,7 @@ class RegisterController extends Controller
|
||||
}
|
||||
|
||||
|
||||
|
||||
$user = $this->create($request->all());
|
||||
|
||||
// trigger user registration event:
|
||||
|
@ -91,12 +91,12 @@ class FireflyConfig
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $name
|
||||
* @param string $value
|
||||
* @param string $name
|
||||
* @param $value
|
||||
*
|
||||
* @return Configuration
|
||||
*/
|
||||
public function set($name, $value): Configuration
|
||||
public function set(string $name, $value): Configuration
|
||||
{
|
||||
Log::debug('Set new value for ', ['name' => $name]);
|
||||
$config = Configuration::whereName($name)->first();
|
||||
|
Loading…
Reference in New Issue
Block a user