diff --git a/pool/base.php b/pool/base.php
index 0fb36c46..496ded31 100644
--- a/pool/base.php
+++ b/pool/base.php
@@ -354,7 +354,7 @@ function logout()
#
function requestRegister()
{
- $reg = getparam('Register', false);
+ $reg = getparam('Register', true);
$reg2 = getparam('Reset', false);
if ($reg !== NULL || $reg2 !== NULL)
{
diff --git a/pool/email.php b/pool/email.php
index dbc5a506..9dd57ced 100644
--- a/pool/email.php
+++ b/pool/email.php
@@ -106,6 +106,72 @@ function passReset($to, $code, $whoip, $emailinfo)
return sendnoheader($to, "Password Reset", $message, $emailinfo);
}
#
+function payoutAddressChanged($to, $whoip, $emailinfo)
+{
+ global $eol;
+
+ if (!isset($emailinfo['KWebURL']))
+ return false;
+
+ $web = $emailinfo['KWebURL'];
+
+ $ret = emailEnd('payout address change', $whoip, $emailinfo);
+ if ($ret === false)
+ return false;
+
+ $message = "Your payout address has been changed.$eol$eol";
+ $message .= $ret;
+
+ return sendnoheader($to, "Payout Address Change", $message, $emailinfo);
+}
+#
+function emailAddressChanged($to, $whoip, $emailinfo, $old)
+{
+ global $eol;
+
+ if (!isset($emailinfo['KWebURL']))
+ return false;
+
+ $web = $emailinfo['KWebURL'];
+
+ $ret = emailEnd('email address change', $whoip, $emailinfo);
+ if ($ret === false)
+ return false;
+
+ $message = "Your email address has been changed to:$eol <$to>$eol$eol";
+ if ($old != null && $old != '')
+ {
+ $message .= "You will no longer receive notifications at the address:$eol <$old>$eol$eol";
+ $send = "$to,$old";
+ }
+ else
+ $send = $to;
+ $message .= $ret;
+
+ return sendnoheader($send, "EMail Address Change", $message, $emailinfo);
+}
+#
+function passChanged($to, $whoip, $emailinfo)
+{
+ global $eol;
+
+ if (!isset($emailinfo['KWebURL']))
+ return false;
+
+ $web = $emailinfo['KWebURL'];
+
+ $ret = emailEnd('password change', $whoip, $emailinfo);
+ if ($ret === false)
+ return false;
+
+ $message = "Your password was changed.$eol$eol";
+ $message .= "If you didn't change it, then you need to urgently use$eol";
+ $message .= "the password reset at the pool to change it again.$eol$eol";
+ $message .= $ret;
+
+ return sendnoheader($to, "Password Change", $message, $emailinfo);
+}
+#
# getOpts required for email
# If they aren't all setup in the DB then email functions will return false
function emailOptList()
diff --git a/pool/page_settings.php b/pool/page_settings.php
index c6d30757..aa06ebcf 100644
--- a/pool/page_settings.php
+++ b/pool/page_settings.php
@@ -1,5 +1,7 @@
Account Settings';
@@ -10,6 +12,8 @@ function settings($data, $user, $email, $addr, $err)
$pg .= '
';
$pg .= '';
+ $_SESSION['old_set_email'] = $email;
+
$pg .= makeForm('settings');
$pg .= '';
$pg .= '';
@@ -101,6 +105,7 @@ function dosettings($data, $user)
$email = getparam('email', false);
$pass = getparam('pass', false);
$ans = userSettings($user, $email, null, $pass);
+ $err = 'EMail changed';
$check = true;
break;
case 'Address':
@@ -110,6 +115,7 @@ function dosettings($data, $user)
$addrarr = array(array('addr' => $addr));
$pass = getparam('pass', false);
$ans = userSettings($user, null, $addrarr, $pass);
+ $err = 'Payout address changed';
$check = true;
}
break;
@@ -132,13 +138,18 @@ function dosettings($data, $user)
}
break;
}
+ $doemail = false;
if ($check === true)
+ {
if ($ans['STATUS'] != 'ok')
{
$err = $ans['STATUS'];
if ($ans['ERROR'] != '')
$err .= ': '.$ans['ERROR'];
}
+ else
+ $doemail = true;
+ }
$ans = userSettings($user);
if ($ans['STATUS'] != 'ok')
dbdown(); // Should be no other reason?
@@ -151,6 +162,44 @@ function dosettings($data, $user)
$addr = $ans['addr:0'];
else
$addr = '';
+
+ if ($doemail)
+ {
+ if ($email == '')
+ {
+ if ($err != '')
+ $err .= ' ';
+ $err .= 'An error occurred, check your details below';
+ goto iroiroattanoyo;
+ }
+
+ $emailinfo = getOpts($user, emailOptList());
+ if ($emailinfo['STATUS'] != 'ok')
+ {
+ if ($err != '')
+ $err .= ' ';
+ $err .= 'An error occurred, check your details below';
+ goto iroiroattanoyo;
+ }
+
+ switch ($chg)
+ {
+ case 'EMail':
+ if (isset($_SESSION['old_set_email']))
+ $old = $_SESSION['old_set_email'];
+ else
+ $old = null;
+ emailAddressChanged($email, zeip(), $emailinfo, $old);
+ break;
+ case 'Address':
+ payoutAddressChanged($email, zeip(), $emailinfo);
+ break;
+ case 'Password':
+ passChanged($email, zeip(), $emailinfo);
+ break;
+ }
+ }
+iroiroattanoyo:
$pg = settings($data, $user, $email, $addr, $err);
return $pg;
}
| |