Compare commits
4
Commits
attributes
...
cef536caa5
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
cef536caa5 | ||
|
|
10ad77d607 | ||
|
|
015f0c70b1 | ||
|
|
267fe5cadd |
No files matched your search
+14
-14
@@ -12,57 +12,57 @@ class User {
|
|||||||
public int $id;
|
public int $id;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @Field("size" => 35, "name" => "first_name")
|
* @Field("length" => 35, "name" => "first_name")
|
||||||
*/
|
*/
|
||||||
public ? string $firstName;
|
public ? string $firstName;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @Field("size" => 35, "name" => "last_name")
|
* @Field("length" => 35, "name" => "last_name")
|
||||||
*/
|
*/
|
||||||
public ? string $lastName;
|
public ? string $lastName;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @Field("size" => 150)
|
* @Field("length" => 255)
|
||||||
*/
|
*/
|
||||||
public string $email;
|
public string $email;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @Field("size" => 150)
|
* @Field("length" => 150)
|
||||||
*/
|
*/
|
||||||
public ? string $address;
|
public ? string $address;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @Field("size" => 15, 'name' => "zip_code")
|
* @Field("length" => 15, 'name' => "zip_code")
|
||||||
*/
|
*/
|
||||||
public ? string $zipCode;
|
public ? string $zipCode;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @Field("size" => 45)
|
* @Field("length" => 45)
|
||||||
*/
|
*/
|
||||||
public ? string $province;
|
public ? string $province;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @Field("size" => 3)
|
* @Field("length" => 3)
|
||||||
*/
|
*/
|
||||||
public ? string $country;
|
public ? string $country;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @Field("size" => 15)
|
* @Field("length" => 15)
|
||||||
*/
|
*/
|
||||||
public ? string $phone;
|
public ? string $phone;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @Field("size" => 15)
|
* @Field("length" => 15)
|
||||||
*/
|
*/
|
||||||
public ? string $ext;
|
public ? string $ext;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @Field("size" => 15)
|
* @Field("length" => 15)
|
||||||
*/
|
*/
|
||||||
public ? string $mobile;
|
public ? string $mobile;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @Field("size" => 255)
|
* @Field("length" => 255)
|
||||||
*/
|
*/
|
||||||
public ? string $username;
|
public ? string $username;
|
||||||
|
|
||||||
@@ -85,7 +85,7 @@ class User {
|
|||||||
|
|
||||||
public function __toString() : string
|
public function __toString() : string
|
||||||
{
|
{
|
||||||
return $this->fullname();
|
return "{$this->firstName} {$this->lastName}";
|
||||||
}
|
}
|
||||||
|
|
||||||
public function setPassword($password) : self
|
public function setPassword($password) : self
|
||||||
@@ -95,9 +95,9 @@ class User {
|
|||||||
return $this->hashPassword();
|
return $this->hashPassword();
|
||||||
}
|
}
|
||||||
|
|
||||||
public function hashPassword() : self
|
public function hashPassword(? string $password = null) : self
|
||||||
{
|
{
|
||||||
$this->password = password_hash($this->password, PASSWORD_DEFAULT);
|
$this->password = password_hash($password ?: $this->password, PASSWORD_DEFAULT);
|
||||||
|
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -35,8 +35,8 @@ class Authenticate {
|
|||||||
|
|
||||||
public function rememberMe(\Ulmus\Repository $repository) : ? User
|
public function rememberMe(\Ulmus\Repository $repository) : ? User
|
||||||
{
|
{
|
||||||
$logUser = function(int $id) use ($repository) {
|
$logUser = function(? int $id) use ($repository) {
|
||||||
if ( null === ( $user = $repository->loadFromPk($id) ) ) {
|
if ( $id === null || null === ( $user = $repository->loadFromPk($id) ) ) {
|
||||||
throw new \Exception("User not found.");
|
throw new \Exception("User not found.");
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -123,7 +123,9 @@ class Authenticate {
|
|||||||
$this->cookie->delete('user.id');
|
$this->cookie->delete('user.id');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (isset($this->user)) {
|
||||||
$this->user->logged = false;
|
$this->user->logged = false;
|
||||||
|
}
|
||||||
|
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in new issue
Block a user