[gnome-web-www] Rework how alias checkbox is handled



commit f3123e92221d1576e87b52eef549c6332a896fd1
Author: Bartłomiej Piotrowski <bpiotrowski gnome org>
Date:   Thu Jun 6 14:50:36 2019 +0200

    Rework how alias checkbox is handled

 theme/page-apply.php | 11 +++++------
 1 file changed, 5 insertions(+), 6 deletions(-)
---
diff --git a/theme/page-apply.php b/theme/page-apply.php
index bb47331..16c0596 100644
--- a/theme/page-apply.php
+++ b/theme/page-apply.php
@@ -2,7 +2,6 @@
 
 $full_name = $email = $ssh_key = "";
 $summary = $references = $gnome_username = "";
-$gnome_mail_alias = "";
 
 if (array_key_exists('submit', $_POST)) {
 
@@ -16,7 +15,7 @@ if (array_key_exists('submit', $_POST)) {
     $ssh_key = trim($_POST['sshkey']);
     $not_spam = $_POST['not_spam'];
     $summary = trim(stripslashes($_POST['summary']));
-    $gnome_mail_alias = trim(stripslashes($_POST['gnome_mail_alias']));
+    $gnome_mail_alias = $_POST['gnome_mail_alias'];
     $gnome_username= trim(stripslashes($_POST['gnome_username']));
     $gnome_jabber = trim(stripslashes($_POST['gnome_jabber']));
     $references = trim(stripslashes($_POST['references']));
@@ -29,7 +28,7 @@ if (array_key_exists('submit', $_POST)) {
         $errors = true;
     }
 
-    if ($gnome_mail_alias != '' && $gnome_username == "") {
+    if (isset($gnome_mail_alias) && $gnome_username == "") {
         $errors = true;
     }
 
@@ -43,8 +42,8 @@ if (array_key_exists('submit', $_POST)) {
         "SSH key:     " . $ssh_key . "\n\n" .
 
         "Benefits\n" .
-        "Mail alias: " . ($gnome_mail_alias == 'on' ? "Yes" : "No") . "\n".
-        "Mail alias username: " . $gnome_username . "\n".
+        "Mail alias: " . (isset($gnome_mail_alias) ? "Yes" : "No") . "\n".
+        "Mail alias username: " . (isset($gnome_mail_alias) ? $gnome_username : "Not applicable") . "\n".
         "Jabber Account: " . ($gnome_jabber == 'on' ? "Yes" : "No") . "\n\n" .
         
         "Contributions Summary:\n" .
@@ -139,7 +138,7 @@ if (array_key_exists('submit', $_POST)) {
 </p>
 
 <div class="item benefits">
-    <input name="gnome_mail_alias" id="gnome_mail_alias" type="checkbox" onClick="toggleBenefitsFields()" 
value="<?php echo $gnome_mail_alias ;?>" /> @gnome.org mail alias
+    <input name="gnome_mail_alias" id="gnome_mail_alias" type="checkbox" onClick="toggleBenefitsFields()" 
<?php isset($gnome_mail_alias)? 'checked="checked"' : '' ;?> /> @gnome.org mail alias
     <input name="gnome_username" id="gnome_username" type="text" placeholder="What do you want your username 
to be?" value="<?php echo htmlspecialchars($gnome_username);?>" disabled />
 </div>
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]