summaryrefslogtreecommitdiff
path: root/html/app/controllers
diff options
context:
space:
mode:
authorGeo Xalkis <gx23100@gmail.com>2023-04-02 06:16:40 +0300
committerGeo Xalkis <gx23100@gmail.com>2023-04-02 06:16:40 +0300
commit0d317dc0cfe6ae2b6b62d711b7ae67e63555235f (patch)
treeca02d2af6a7b17fe6100e57d784f0bb4c07ebf9b /html/app/controllers
parentc95daba5206cb4bd55b5685e8141311f23606e1a (diff)
downloadclassroom-0d317dc0cfe6ae2b6b62d711b7ae67e63555235f.tar.gz
classroom-0d317dc0cfe6ae2b6b62d711b7ae67e63555235f.tar.bz2
classroom-0d317dc0cfe6ae2b6b62d711b7ae67e63555235f.zip
several updates on user registration
Diffstat (limited to 'html/app/controllers')
-rw-r--r--html/app/controllers/Auth.php67
1 files changed, 8 insertions, 59 deletions
diff --git a/html/app/controllers/Auth.php b/html/app/controllers/Auth.php
index 6c3eadc..de850fe 100644
--- a/html/app/controllers/Auth.php
+++ b/html/app/controllers/Auth.php
@@ -8,10 +8,7 @@ use app\extends\Classroom_user;
use app\extends\Classroom_manager;
use app\models\admin\User_model;
-// mailer
-use PHPMailer\PHPMailer\PHPMailer;
-use PHPMailer\PHPMailer\SMTP;
-use PHPMailer\PHPMailer\Exception;
+use app\extends\Send_mail;
/** class Auth
@@ -59,9 +56,12 @@ class Auth {
- public static function confirm_account()
+ public static function activate()
{
+ $req = Registry::get('REQUEST');
+ // get the record of the target user
+ $record = User_model::activate($req->GET['ticket']);
}
/** register
@@ -99,14 +99,14 @@ class Auth {
// ];
// }
- $activation_sent = self::mail_activationCode([
+ $send_mail = Send_mail::send_activation_code([
'email' => $req->POST['email'],
'name' => $req->POST['name'] .' '. $req->POST['surname'],
'code' => $activation_code['activation']
]);
// Send replies
- if ($activation_sent) {
+ if ($send_mail) {
return [
'success' => true,
'message' => REGISTRATION_SUCCESS
@@ -124,58 +124,7 @@ class Auth {
}
- private static function mail_activationCode($letter)
- {
- $mail = new PHPMailer();
-
- // setup smpt
- $mail->SMTPDebug = 2;
- $mail->IsSMTP();
- $mail->Host = MAIL_HOST;
- $mail->SMPTAuth = true;
- $mail->SMTPSecure = MAIL_ENCRYPTION;
- $mail->Protocol = 'mail';
-
- $mail->Mailer = MAIL_MAILER;
- $mail->Port = MAIL_PORT;
- $mail->Username = MAIL_USERNAME;
- $mail->Password = MAIL_PASSWORD;
-
- // setup format
- $mail->CharSet = 'utf-8';
- $mail->IsHTML(true);
-
- // setup THE mail
- // --- -- -- - - -
- // It's important not to use the submitter's address as the from address as it's forgery,
- // which will cause your messages to fail SPF checks.
- // Use an address in your own domain as the from address, put the submitter's address in a reply-to
- $mail->setFrom(NO_REPLY_EMAIL, SITE_TITLE);
- $mail->addAddress($letter['email'], $letter['name']);
- $mail->addReplyTo(REPLY_TO_EMAIL, SITE_TITLE);
- $mail->AddBCC("piipiis@gmail.com", "tester"); // notifiation email while testing
- $mail->Subject = 'Εγγραφή στο Classroom';
- $mail->Body = "Χαίρετε,<br>
- το παρόν αυτοποιημένο email σάς έχει σταλεί γιατί έχει γίνει αίτημα εγγραφής σας στο Classroom.<br>
- <br>
- Όνομα επαφής: <b>". $letter['name'] ."</b><br>
- Email : <b>". $letter['email'] ."</b><br>
- <br>
- Για να ενεργοποιήσετε την πρόσβασή σας στο site θα πρέπει να παρακαλώ πατήστε στον
- παρακάτω σύνδεσμο url
- <a href=\"https://eaadhsy.roptron.gr/activate?id=". $letter['code'] ."\">.
- <br>
- <br>
- Μετά την ενεργοποίηση θα έχετε πρόσσβαση στο περιεχόμενο του site.<br>
- <br>
- Μην απαντήσετε στο email γιατί δεν υπάρχει φυσική επαφή η οποία να λαμβάνει τυχόν replies.<br>";
- if (!$mail->send()) {
- return false;
- } else {
- return true;
- }
-
- }
+