[UPDATE] Hide e-mail address on account screen

This commit is contained in:
Sebastian Grewe 2014-07-13 12:16:57 +02:00
parent 0c227cb741
commit e542afc952
2 changed files with 5 additions and 2 deletions

View File

@ -496,7 +496,7 @@ class User extends Base {
$this->setErrorMessage('Donation above allowed 100% limit');
return false;
}
if (!filter_var($email, FILTER_VALIDATE_EMAIL)) {
if ($email != 'hidden' && $email != NULL && !filter_var($email, FILTER_VALIDATE_EMAIL)) {
$this->setErrorMessage('Invalid email address');
return false;
}
@ -540,6 +540,9 @@ class User extends Base {
}
}
// If we hide our email or it's not set, fetch current one to update
if ($email == 'hidden' || $email == NULL)
$email = $this->getUserEmailById($userID);
// We passed all validation checks so update the account
$stmt = $this->mysqli->prepare("UPDATE $this->table SET ap_threshold = ?, donate_percent = ?, email = ?, timezone = ?, is_anonymous = ? WHERE id = ?");
if ($this->checkStmt($stmt) && $stmt->bind_param('ddssii', $threshold, $donate, $email, $timezone, $is_anonymous, $userID) && $stmt->execute()) {

View File

@ -28,7 +28,7 @@
{/if}
<div class="form-group">
<label>E-Mail</label>
{nocache}<input class="form-control" type="text" name="email" value="{$GLOBAL.userdata.email|escape}" size="20" {if $GLOBAL.twofactor.enabled && $GLOBAL.twofactor.options.details && !$DETAILSUNLOCKED}id="disabledInput" disabled{/if}/>{/nocache}
{nocache}<input class="form-control" type="text" name="email" value="hidden" size="20" {if $GLOBAL.twofactor.enabled && $GLOBAL.twofactor.options.details && !$DETAILSUNLOCKED}id="disabledInput" disabled{/if}/>{/nocache}
</div>
<div class="form-group">
<label>Timezone</label>