/** * Checks if a user's token is expired and send a new one if so. * Otherwise, return the human readable diff between creation * timestamp of the token and now. * * @param $user * * @return bool|string False if token expired */ public function checkToken($user) { $activation = $this->repo->findById($user->id); if ($this->resendAfter != 0) { if ($this->shouldResend($activation)) { $this->recreateActivation($activation, $user); return false; } } return $this->getDiffTime($activation->created_at); }
/** * Send a new token, just in case our user is a clumsy one. * * @param $user */ public function sendNewTokenByUserRequest($user) { $activation = $this->repository->findById($user->id); $this->activationService->recreateActivation($activation, $user); }