Skip to content

Commit

Permalink
fix temp invite for pre register username
Browse files Browse the repository at this point in the history
  • Loading branch information
xiaomlove committed Aug 27, 2023
1 parent b41a08f commit c482d33
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 6 deletions.
3 changes: 2 additions & 1 deletion app/Models/Invite.php
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
2 changes: 1 addition & 1 deletion include/constants.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php
defined('VERSION_NUMBER') || define('VERSION_NUMBER', '1.8.7');
defined('RELEASE_DATE') || define('RELEASE_DATE', '2023-08-24');
defined('RELEASE_DATE') || define('RELEASE_DATE', '2023-08-28');
defined('IN_TRACKER') || define('IN_TRACKER', false);
defined('PROJECTNAME') || define("PROJECTNAME","NexusPHP");
defined('NEXUSPHPURL') || define("NEXUSPHPURL","https://nexusphp.org");
Expand Down
12 changes: 9 additions & 3 deletions public/takeinvite.php
Original file line number Diff line number Diff line change
Expand Up @@ -88,15 +88,21 @@ function bark($msg) {
<br /><br />{$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,
Expand Down
2 changes: 1 addition & 1 deletion public/takesignup.php
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ function isproxy()
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"];
}
Expand Down

0 comments on commit c482d33

Please sign in to comment.