Skip to content

Commit e542afc

Browse files
committed
[UPDATE] Hide e-mail address on account screen
1 parent 0c227cb commit e542afc

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

include/classes/user.class.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -496,7 +496,7 @@ public function updateAccount($userID, $address, $threshold, $donate, $email, $t
496496
$this->setErrorMessage('Donation above allowed 100% limit');
497497
return false;
498498
}
499-
if (!filter_var($email, FILTER_VALIDATE_EMAIL)) {
499+
if ($email != 'hidden' && $email != NULL && !filter_var($email, FILTER_VALIDATE_EMAIL)) {
500500
$this->setErrorMessage('Invalid email address');
501501
return false;
502502
}
@@ -540,6 +540,9 @@ public function updateAccount($userID, $address, $threshold, $donate, $email, $t
540540
}
541541
}
542542

543+
// If we hide our email or it's not set, fetch current one to update
544+
if ($email == 'hidden' || $email == NULL)
545+
$email = $this->getUserEmailById($userID);
543546
// We passed all validation checks so update the account
544547
$stmt = $this->mysqli->prepare("UPDATE $this->table SET ap_threshold = ?, donate_percent = ?, email = ?, timezone = ?, is_anonymous = ? WHERE id = ?");
545548
if ($this->checkStmt($stmt) && $stmt->bind_param('ddssii', $threshold, $donate, $email, $timezone, $is_anonymous, $userID) && $stmt->execute()) {

templates/bootstrap/account/edit/detail.tpl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
{/if}
2929
<div class="form-group">
3030
<label>E-Mail</label>
31-
{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}
31+
{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}
3232
</div>
3333
<div class="form-group">
3434
<label>Timezone</label>

0 commit comments

Comments
 (0)