forked from GNUsocial/gnu-social
[DATABASE][TOOLS] Update local_user to return the proper PhoneNumber type
This commit is contained in:
parent
22e292276c
commit
59eba851f7
@ -20,7 +20,7 @@ const types = [
|
|||||||
'serial' => 'int',
|
'serial' => 'int',
|
||||||
'text' => 'string',
|
'text' => 'string',
|
||||||
'varchar' => 'string',
|
'varchar' => 'string',
|
||||||
'phone_number' => 'PhoneNumberType',
|
'phone_number' => 'PhoneNumber',
|
||||||
];
|
];
|
||||||
|
|
||||||
$path = Yaml::parseFile(ROOT . '/config/services.yaml')['services']['app.core.schemadef_driver']['arguments'][0];
|
$path = Yaml::parseFile(ROOT . '/config/services.yaml')['services']['app.core.schemadef_driver']['arguments'][0];
|
||||||
|
@ -25,6 +25,7 @@ use App\Util\Common;
|
|||||||
use DateTime;
|
use DateTime;
|
||||||
use DateTimeInterface;
|
use DateTimeInterface;
|
||||||
use Exception;
|
use Exception;
|
||||||
|
use libphonenumber\PhoneNumber;
|
||||||
use Symfony\Component\Security\Core\User\UserInterface;
|
use Symfony\Component\Security\Core\User\UserInterface;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -52,7 +53,7 @@ class LocalUser implements UserInterface
|
|||||||
private ?bool $is_email_verified;
|
private ?bool $is_email_verified;
|
||||||
private ?string $language;
|
private ?string $language;
|
||||||
private ?string $timezone;
|
private ?string $timezone;
|
||||||
private ?PhoneNumberType $phone_number;
|
private ?PhoneNumber $phone_number;
|
||||||
private ?int $sms_carrier;
|
private ?int $sms_carrier;
|
||||||
private ?string $sms_email;
|
private ?string $sms_email;
|
||||||
private ?string $uri;
|
private ?string $uri;
|
||||||
@ -132,12 +133,12 @@ class LocalUser implements UserInterface
|
|||||||
return $this->timezone;
|
return $this->timezone;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function setPhoneNumber(?PhoneNumberType $phone_number): self
|
public function setPhoneNumber(?PhoneNumber $phone_number): self
|
||||||
{
|
{
|
||||||
$this->phone_number = $phone_number;
|
$this->phone_number = $phone_number;
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
public function getPhoneNumber(): ?PhoneNumberType
|
public function getPhoneNumber(): ?PhoneNumber
|
||||||
{
|
{
|
||||||
return $this->phone_number;
|
return $this->phone_number;
|
||||||
}
|
}
|
||||||
@ -329,8 +330,8 @@ class LocalUser implements UserInterface
|
|||||||
if (password_verify($new_password, $this->password)) {
|
if (password_verify($new_password, $this->password)) {
|
||||||
// Update old formats
|
// Update old formats
|
||||||
if (password_needs_rehash($this->password,
|
if (password_needs_rehash($this->password,
|
||||||
self::algoNameToConstant(Common::config('security', 'algorithm')),
|
self::algoNameToConstant(Common::config('security', 'algorithm')),
|
||||||
Common::config('security', 'options'))
|
Common::config('security', 'options'))
|
||||||
) {
|
) {
|
||||||
$this->changePassword($new_password, true);
|
$this->changePassword($new_password, true);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user