public function activateUser($token)
{
$user = User::find(['token = :token: AND activated = :activated:', 'bind' => ['token' => $token, 'activated' => false]])->getFirst();
if (!$user) {
flash()->session()->warning('We cant find your request, please ' . 'try again, or contact us.');
return view('errors.404');
}
$user->setActivated(true);
if ($user->save() === false) {
foreach ($user->getMessages() as $message) {
flash()->session()->error($message);
}
} else {
flash()->session()->success('You have successfully activated your account, ' . 'you are now allowed to login.');
}
return redirect()->to(route('showLoginForm'));
}