| <?php |
| /******************************************************************************* |
| * Copyright (c) 2012-2013 Eclipse Foundation and others. |
| * All rights reserved. This program and the accompanying materials |
| * are made available under the terms of the Eclipse Public License v1.0 |
| * which accompanies this distribution, and is available at |
| * http://www.eclipse.org/legal/epl-v10.html |
| * |
| * Contributors: |
| * Denis Roy (Eclipse Foundation)- initial API and implementation |
| *******************************************************************************/ |
| |
| $showAccountDetailsView = "none"; |
| $showAccountDetailsToggle = "Change my name, email, password."; |
| $hideAccountDetailsToggle = "Hide account details."; |
| $accountDetails = $showAccountDetailsToggle; |
| |
| # Expand by default if you've just updated your data |
| if(isset($stage)) { |
| if($stage == "save") { |
| $showAccountDetailsView = "inline"; |
| $accountDetails = $hideAccountDetailsToggle; |
| } |
| } |
| ?> |
| <br /> |
| <div class="section"> |
| <p><a href="#" onclick="fnToggleChangeAccount();"><img class="section_icon" src="//dev.eclipse.org/large_icons/categories/preferences-system.png" alt="Icon_show_acct" /><label id="changeaccountlabel" class='visibility_toggle'><?= $accountDetails ?></label></a></p> |
| <div id="changeaccount" style="display:<?= $showAccountDetailsView ?>;"> |
| <form name="login" method="post" action="myaccount.php"> |
| <table cellspacing="4"> |
| <tr><td></td><td colspan="2" style="color:#900;"><?= $error ?></td></tr> |
| <tr> |
| <td>Current password<font color="red">*</font>:</td><td><input type="password" name="oldpassword" value="" size="32" maxlength="255" onBlur="fnCheckForm(this.name);" /><br/></td> |
| <td id="msg_oldpassword" style='width:250px; color:red;'></td> |
| </tr> |
| <tr><td colspan="3"><i>Your current password is required to change your account details.</i></td></tr> |
| <tr><td colspan="3"> </td></tr> |
| <tr> |
| <td>E-mail address<font color="red">*</font>:</td><td><input type="text" name="username" value="<?= $username ?>" size="40" maxlength="255" onBlur="fnCheckForm(this.name);" /></td> |
| <td id="msg_email" style='width:250px; color:red;'></td> |
| </tr> |
| <tr> |
| <td>First name<font color="red">*</font>:</td><td><input type="text" name="fname" value="<?= $fname ?>" size="40" maxlength="255" onBlur="fnCheckForm(this.name);" /><br/></td> |
| <td id="msg_fname" style='width:250px; color:red;'></td> |
| </tr> |
| <tr> |
| <td>Last name<font color="red">*</font>:</td><td><input type="text" name="lname" value="<?= $lname ?>" size="40" maxlength="255" onBlur="fnCheckForm(this.name);" /><br/></td> |
| <td id="msg_lname" style='width:250px; color:red;'></td> |
| </tr> |
| <tr> |
| <td>New Password<font color="red">*</font>:</td><td><input type="password" name="password1" value="<?= $password1 ?>" size="32" maxlength="255" onBlur="fnCheckForm(this.name);" /><br/></td> |
| <td id="msg_password1" style='width:250px; color:red;'></td> |
| </tr> |
| <tr> |
| <td>New Password (again)<font color="red">*</font>:</td><td><input type="password" name="password2" value="<?= $password2 ?>" size="32" maxlength="255" onBlur="fnCheckForm(this.name);" /><br/></td> |
| <td id="msg_password2" style='width:250px; color:red;'></td> |
| </tr><br /> |
| <tr> |
| <tr><td coldpan="2"> </td></tr> |
| <td><a href="https://github.com/" target="_blank">GitHub</a> ID (optional):</td><td> |
| <?= $githubid == "" ? '<input type="text" name="githubid" value="' . $githubid . '" size="32" maxlength="255" />' : $githubid ?> <br/></td> |
| </tr> |
| <tr><td colspan="3"><i><?= $githubid == "" ? "Your GitHub ID makes it easier for you to participate on Eclipse projects hosted on GitHub." : "Your GitHub ID is already set and cannot be changed. Please contact webmaster@eclipse.org to update it." ?></i></td></tr> |
| <tr><td colspan="3"> </td></tr> |
| <tr> |
| <td></td><td><input id="btn_submit" type="submit" name="submit" value="Update account!" /></td></tr> |
| </table> |
| <input type="hidden" name="stage" value="save" /> |
| </form> |
| <p><b style="font-size:150%;">Please note:</font></b> the Eclipse Foundation communities operate in an open and transparent fashion. Most of what you submit on our site(s) will be visible to everyone, |
| and your email address may be visible to users who use Bugzilla, Gerrit, Git, and our mailing lists. You may prefer to use an email account specifically for this purpose.</p> |
| </div> |
| </div> |
| <script language="javascript"> |
| function fnToggleChangeAccount() { |
| if(document.getElementById('changeaccount').style.display == "none") { |
| document.getElementById('changeaccount').style.display = "inline"; |
| document.getElementById('changeaccountlabel').innerHTML = '<?= $hideAccountDetailsToggle ?>'; |
| } |
| else { |
| document.getElementById('changeaccount').style.display = "none"; |
| document.getElementById('changeaccountlabel').innerHTML = '<?= $showAccountDetailsToggle ?>'; |
| } |
| } |
| |
| function fnCheckEmail(field) { |
| var rValue = false; |
| var re = /^(([^<>()[\]\\.,;:\s@\"]+(\.[^<>()[\]\\.,;:\s@\"]+)*)|(\".+\"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/; |
| if(!re.test(document.forms['login'].username.value)) { |
| if(field == "username") { |
| document.getElementById('msg_email').innerHTML = "<b>Your email address doesn't appear valid!</b>"; |
| } |
| document.getElementById('btn_submit').disabled="disabled"; |
| } |
| else { |
| document.getElementById('msg_email').innerHTML = ""; |
| rValue = true; |
| } |
| return rValue; |
| } |
| |
| function fnCheckFName(field) { |
| var rValue = true; |
| if(document.forms['login'].fname.value == "") { |
| rValue = false; |
| if(field == "fname") { |
| document.getElementById('msg_fname').innerHTML = "<b>Please enter your name.</b>"; |
| } |
| } |
| else { |
| document.getElementById('msg_fname').innerHTML = ""; |
| } |
| return rValue; |
| } |
| function fnCheckLName(field) { |
| var rValue = true; |
| if(document.forms['login'].lname.value == "") { |
| rValue = false; |
| if(field == "lname") { |
| document.getElementById('msg_lname').innerHTML = "<b>Please enter your name.</b>"; |
| } |
| } |
| else { |
| document.getElementById('msg_lname').innerHTML = ""; |
| } |
| return rValue; |
| } |
| function fnCheckPasswords(field) { |
| var rValue = true; |
| if(document.forms['login'].password1.value == "" || document.forms['login'].password1.value != document.forms['login'].password2.value) { |
| rValue = false; |
| if(field == "password1") { |
| document.getElementById('msg_password1').innerHTML = "<b>Your passwords do not match!</b>"; |
| } |
| } |
| else { |
| if (!document.forms['login'].password1.value.match(/(?=^.{6,}$)(?=.*[\d|\W])(?=.*[A-Za-z]).*$/)) { |
| rValue = false; |
| document.getElementById('msg_password1').innerHTML = "<b>Your password is too simple. It must be at least 6 characters, contain one character and one number.</b>"; |
| } |
| } |
| if(rValue) { |
| document.getElementById('msg_password1').innerHTML = ""; |
| } |
| return rValue; |
| } |
| function fnCheckForm(field) { |
| if(fnCheckEmail(field) && fnCheckFName(field) && fnCheckLName(field) && fnCheckPasswords(field)) { |
| document.getElementById('btn_submit').disabled=""; |
| } |
| } |
| </script> |