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
|
public function saveEmailAddress(DeletedUser $event): bool
|
||||||
{
|
{
|
||||||
|
Preferences::mark();
|
||||||
$email = hash('sha256', $event->email);
|
$email = hash('sha256', $event->email);
|
||||||
Log::debug(sprintf('Hash of email is %s', $email));
|
Log::debug(sprintf('Hash of email is %s', $email));
|
||||||
/** @var Configuration $configuration */
|
/** @var Configuration $configuration */
|
||||||
@ -94,7 +95,10 @@ class UserEventHandler
|
|||||||
}
|
}
|
||||||
$content[] = $email;
|
$content[] = $email;
|
||||||
$configuration->data = $content;
|
$configuration->data = $content;
|
||||||
$configuration->save();
|
Log::debug('New content of deleted_users is ', $content);
|
||||||
|
FireflyConfig::set('deleted_users', $content);
|
||||||
|
|
||||||
|
Preferences::mark();
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -100,6 +100,8 @@ class RegisterController extends Controller
|
|||||||
$hash = hash('sha256', $data['email']);
|
$hash = hash('sha256', $data['email']);
|
||||||
$configuration = FireflyConfig::get('deleted_users', []);
|
$configuration = FireflyConfig::get('deleted_users', []);
|
||||||
$set = $configuration->data;
|
$set = $configuration->data;
|
||||||
|
Log::debug(sprintf('Hash of email is %s', $hash));
|
||||||
|
Log::debug('Hashes of deleted users: ', $set);
|
||||||
if (in_array($hash, $set)) {
|
if (in_array($hash, $set)) {
|
||||||
// user already deleted, cannot re-register :(
|
// user already deleted, cannot re-register :(
|
||||||
$validator->getMessageBag()->add('email', (string)trans('validation.deleted_user'));
|
$validator->getMessageBag()->add('email', (string)trans('validation.deleted_user'));
|
||||||
@ -108,6 +110,7 @@ class RegisterController extends Controller
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
$user = $this->create($request->all());
|
$user = $this->create($request->all());
|
||||||
|
|
||||||
// trigger user registration event:
|
// trigger user registration event:
|
||||||
|
@ -91,12 +91,12 @@ class FireflyConfig
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param $name
|
* @param string $name
|
||||||
* @param string $value
|
* @param $value
|
||||||
*
|
*
|
||||||
* @return Configuration
|
* @return Configuration
|
||||||
*/
|
*/
|
||||||
public function set($name, $value): Configuration
|
public function set(string $name, $value): Configuration
|
||||||
{
|
{
|
||||||
Log::debug('Set new value for ', ['name' => $name]);
|
Log::debug('Set new value for ', ['name' => $name]);
|
||||||
$config = Configuration::whereName($name)->first();
|
$config = Configuration::whereName($name)->first();
|
||||||
|
Loading…
Reference in New Issue
Block a user