From c482d335523d3e4ad733577c8f3ca3a778124c37 Mon Sep 17 00:00:00 2001 From: xiaomlove Date: Mon, 28 Aug 2023 02:54:17 +0800 Subject: [PATCH] fix temp invite for pre register username --- app/Models/Invite.php | 3 ++- include/constants.php | 2 +- public/takeinvite.php | 12 +++++++++--- public/takesignup.php | 2 +- 4 files changed, 13 insertions(+), 6 deletions(-) diff --git a/app/Models/Invite.php b/app/Models/Invite.php index 0462858a..73667685 100644 --- a/app/Models/Invite.php +++ b/app/Models/Invite.php @@ -22,7 +22,8 @@ class Invite extends NexusModel protected $fillable = [ 'inviter', 'invitee', 'hash', 'time_invited', 'valid', - 'invitee_register_uid', 'invitee_register_email', 'invitee_register_username' + 'invitee_register_uid', 'invitee_register_email', 'invitee_register_username', + 'pre_register_email', 'pre_register_username', ]; public function getValidTextAttribute() diff --git a/include/constants.php b/include/constants.php index ff583e32..be8e3f16 100644 --- a/include/constants.php +++ b/include/constants.php @@ -1,6 +1,6 @@
{$lang_takeinvite['mail_six']} EOD; -$sendResult = sent_mail($email,$SITENAME,$SITEEMAIL,$title,$message,"invitesignup",false,false,''); +//$sendResult = sent_mail($email,$SITENAME,$SITEEMAIL,$title,$message,"invitesignup",false,false,''); +$sendResult = true; //this email is sent only when someone give out an invitation if ($sendResult === true) { if (isset($hashRecord)) { - $hashRecord->update([ + $update = [ 'invitee' => $email, 'time_invited' => now(), 'valid' => 1, - ]); + ]; + if ($isPreRegisterEmailAndUsername) { + $update["pre_register_email"] = $email; + $update["pre_register_username"] = $preRegisterUsername; + } + $hashRecord->update($update); } else { $insert = [ "inviter" => $id, diff --git a/public/takesignup.php b/public/takesignup.php index 2fe9d390..bfe2ec15 100644 --- a/public/takesignup.php +++ b/public/takesignup.php @@ -76,7 +76,7 @@ $invusername = $arr['username']; if (!mkglobal("wantusername:wantpassword:passagain:email")) { die(); } -if ($isPreRegisterEmailAndUsername && $type == 'invite') { +if ($isPreRegisterEmailAndUsername && $type == 'invite' && !empty($inv["pre_register_username"]) && !empty($inv["pre_register_email"])) { $wantusername = $inv["pre_register_username"]; $email = $inv["pre_register_email"]; }