Compare commits
7
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
fbf9bc871c | ||
|
|
ad802fc35d | ||
|
|
4664a8779a | ||
|
|
cef536caa5 | ||
|
|
10ad77d607 | ||
|
|
015f0c70b1 | ||
|
|
267fe5cadd |
No files matched your search
+7
-1
@@ -10,8 +10,14 @@
|
||||
}
|
||||
],
|
||||
"require": {
|
||||
"mcnd/notes": "master-dev"
|
||||
"mcnd/ulmus": "dev-master"
|
||||
},
|
||||
"repositories": [
|
||||
{
|
||||
"type": "vcs",
|
||||
"url": "https://git.mcnd.ca/mcNdave/ulmus.git"
|
||||
}
|
||||
],
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"Ulmus\\User\\": "src/"
|
||||
|
||||
+4
-4
@@ -57,7 +57,7 @@ class User {
|
||||
|
||||
public function __toString() : string
|
||||
{
|
||||
return $this->fullname();
|
||||
return "{$this->firstName} {$this->lastName}";
|
||||
}
|
||||
|
||||
public function setPassword($password) : self
|
||||
@@ -67,16 +67,16 @@ class User {
|
||||
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;
|
||||
}
|
||||
|
||||
public function verifyPassword(string $password) : bool
|
||||
{
|
||||
return password_verify($password, $this->password );
|
||||
return password_verify($password, $this->password);
|
||||
}
|
||||
|
||||
public function fullname() : string
|
||||
|
||||
@@ -35,8 +35,8 @@ class Authenticate {
|
||||
|
||||
public function rememberMe(\Ulmus\Repository $repository) : ? User
|
||||
{
|
||||
$logUser = function(int $id) use ($repository) {
|
||||
if ( null === ( $user = $repository->loadFromPk($id) ) ) {
|
||||
$logUser = function(? int $id) use ($repository) {
|
||||
if ( $id === null || null === ( $user = $repository->loadFromPk($id) ) ) {
|
||||
throw new \Exception("User not found.");
|
||||
}
|
||||
|
||||
@@ -123,7 +123,9 @@ class Authenticate {
|
||||
$this->cookie->delete('user.id');
|
||||
}
|
||||
|
||||
$this->user->logged = false;
|
||||
if (isset($this->user)) {
|
||||
$this->user->logged = false;
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user