Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 0 additions & 12 deletions phpstan-baseline.neon
Original file line number Diff line number Diff line change
Expand Up @@ -60,24 +60,12 @@ parameters:
count: 1
path: src/Model/Behavior/LinkSocialBehavior.php

-
message: '#^Access to an undefined property Cake\\Datasource\\EntityInterface\:\:\$activation_date\.$#'
identifier: property.notFound
count: 1
path: src/Model/Behavior/RegisterBehavior.php

-
message: '#^Access to an undefined property Cake\\Datasource\\EntityInterface\:\:\$active\.$#'
identifier: property.notFound
count: 1
path: src/Model/Behavior/RegisterBehavior.php

-
message: '#^Access to an undefined property Cake\\Datasource\\EntityInterface\:\:\$token_expires\.$#'
identifier: property.notFound
count: 1
path: src/Model/Behavior/RegisterBehavior.php

-
message: '#^Access to an undefined property Cake\\Datasource\\EntityInterface\:\:\$validated\.$#'
identifier: property.notFound
Expand Down
7 changes: 4 additions & 3 deletions src/Model/Behavior/RegisterBehavior.php
Original file line number Diff line number Diff line change
Expand Up @@ -128,9 +128,10 @@ public function activateUser(EntityInterface $user)
if ($user->active) {
throw new UserAlreadyActiveException(__d('cake_d_c/users', 'User account already validated'));
}
$user->activation_date = new \DateTime();
$user->token_expires = null;
$user->active = true;
$user->set('token', null);
$user->set('token_expires', null);
$user->set('activation_date', new \DateTime());
$user->set('active', true);

return $this->_table->save($user);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ public function testRegisterPostOkay()
//If access again get error
$this->get($url);
$this->assertRedirect('/login');
$this->assertFlashMessage('Token already expired');
$this->assertFlashMessage('Invalid token or user account already validated');
}

/**
Expand Down
1 change: 1 addition & 0 deletions tests/TestCase/Model/Behavior/RegisterBehaviorTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -304,6 +304,7 @@ public function testActiveUserRemoveValidationToken()

$result = $this->Behavior->activateUser($user);
$this->assertSame($result, $user);
$this->assertNull($user->token);
$this->assertNull($user->token_expires);
$this->assertTrue($user->active);
$this->assertInstanceOf(\DateTime::class, $user->activation_date);
Expand Down
Loading