private function tryChangePassword($email, $newPassword, $resetCode) { $response = array(); $response["success"] = 0; $tryChange = new TryChangePassword($email, $resetCode, $newPassword); $changed = $tryChange->update(); if ($changed) { $response["success"] = 1; $response["message"] = "password as be changed, new password sent to you"; $message = "You password as be successfully changed" . "\n" . "Username = {$email}\n" . "New Password = {$newPassword}\n" . "" . "\n" . "Change Date = " . date("jS /M, Y", Validator::Now()); $from = "*****@*****.**"; $user = $this->getUser($email); //send the email if the user exists which suppose to if ($user != null) { $subject = " Success changed password"; $trySend = new TrySendEmail($message, $from, $user->Email, $user->Fullname, $subject); $trySend->update(); } } else { $response["error_message"] = "invalid authentication details\n"; } $jsonView = new JsonViewer(); $jsonView->setContent($response); return $jsonView; }
private function sendUserResetCode(User $user) { $fullname = $user->getFullname(); $email = $user->getEmail(); $code = $user->getVerificationCode(); $message = "Dear {$fullname}, <br> " . "\t The account verification code requested by you as be sent , please if this is you continue with the process. " . "<br>Account email : {$email}<br><br> " . "<br>Reset code : {$code}<br><br>" . "Copy and paste the reset code on the field provided in your application screen "; // send the code to the user throw email or text message $mailer = new TrySendEmail($message, ADMINISTRATOR_EMAIL, $email, $fullname); return $mailer->update(); }
private function sendWelcomeMessage($json) { $user = new User($json); if ($user != null) { $fullname = $user->getFullname(); $code = $user->getVerificationCode(); $email = $user->getEmail(); $message = "Dear {$fullname}, \n\t Thanks for register with DFinder , we intend to bring you new events around the world to you.\n" . "The DEvents is a social application that search events around in your location with just a clicked.\n" . "\n <br> " . "Below is your username and password" . "<br>" . "Username = {$email}<br>" . "Verification code: = {$code}" . "\n<br>" . "To verify your account you need to copy the above given code below and paste it on the field at your screen\n<br>"; $from = "*****@*****.**"; $to = $email; $name = $fullname; $subject = "DFinder account creation confirmation details"; $trysent = new TrySendEmail($message, $from, $to, $name, $subject); $trysent->update(); } }