mirror of
https://github.com/Bubka/2FAuth.git
synced 2025-06-20 11:47:53 +02:00
Remove useless encryption of the Service field if empty
This commit is contained in:
parent
30125e6658
commit
cd64f10a3c
@ -319,7 +319,7 @@ class TwoFAccount extends Model implements Sortable
|
|||||||
public function setServiceAttribute($value)
|
public function setServiceAttribute($value)
|
||||||
{
|
{
|
||||||
// Encrypt when needed
|
// Encrypt when needed
|
||||||
$this->attributes['service'] = $this->encryptOrReturn($value);
|
$this->attributes['service'] = $value ? $this->encryptOrReturn($value) : $value;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -210,7 +210,12 @@ class SettingService
|
|||||||
|
|
||||||
$twofaccounts->each(function ($item, $key) use (&$success, $encrypted) {
|
$twofaccounts->each(function ($item, $key) use (&$success, $encrypted) {
|
||||||
try {
|
try {
|
||||||
|
// encrypting a null value generate a hash which once decrypted gives an empty string.
|
||||||
|
// As Service is nullable, we handle it only if the fiel contains a value
|
||||||
|
if ($item->service) {
|
||||||
$item->service = $encrypted ? Crypt::encryptString($item->service) : Crypt::decryptString($item->service);
|
$item->service = $encrypted ? Crypt::encryptString($item->service) : Crypt::decryptString($item->service);
|
||||||
|
}
|
||||||
|
|
||||||
$item->legacy_uri = $encrypted ? Crypt::encryptString($item->legacy_uri) : Crypt::decryptString($item->legacy_uri);
|
$item->legacy_uri = $encrypted ? Crypt::encryptString($item->legacy_uri) : Crypt::decryptString($item->legacy_uri);
|
||||||
$item->account = $encrypted ? Crypt::encryptString($item->account) : Crypt::decryptString($item->account);
|
$item->account = $encrypted ? Crypt::encryptString($item->account) : Crypt::decryptString($item->account);
|
||||||
$item->secret = $encrypted ? Crypt::encryptString($item->secret) : Crypt::decryptString($item->secret);
|
$item->secret = $encrypted ? Crypt::encryptString($item->secret) : Crypt::decryptString($item->secret);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user