Archived
1
0
Fork 0

app/models/Data/PasswordLink.php: rename to UserActivation

+ Confirm to the database changes.
This commit is contained in:
Henrik Hautakoski 2018-09-20 23:16:56 +02:00
parent bdf16e6fbb
commit a52fc99ded
2 changed files with 34 additions and 24 deletions

View file

@ -4,9 +4,9 @@ namespace App\Controller;
use App\Controller\ControllerBase,
App\Form\UserSettings as UserSettingsForm,
App\Model\Data\ActivityLog,
App\Model\Data\PasswordLink,
App\Model\Data\User;
App\Model\Data\User,
App\Model\Data\UserActivation,
App\Model\Data\ActivityLog;
class UserController extends ControllerBase
{
@ -39,15 +39,15 @@ class UserController extends ControllerBase
}
// Else we create a password link and email.
else {
$link = new PasswordLink();
$link->setUserId($user->getId())
$activation = new UserActivation();
$activation->setUserId($user->getId())
->setPassword($hash)
->save();
// Render the email content.
$tpl = $this->di->get('template');
$content = $tpl->render('mail/password_activation', [
'link' => $link->getPublicId()
'link' => $activation->getActivationKey()
]);
// Send the email.
@ -113,7 +113,7 @@ class UserController extends ControllerBase
*/
public function activationLinkAction($id)
{
$link = PasswordLink::findFirst(['public_id = ?0', 'bind' => [ $id ]]);
$link = UserActivation::findFirst(['activation_key = ?0', 'bind' => [ $id ]]);
if ($link) {
if ($link->isValid()) {