Merge pull request #5230 from solgenomics/topic/open_pollinated
[sgn.git] / mason / user / change_account.mas
blobbe0a7bb2f3173491f568e1d1d4fc8fc63cb6f716
2 <%args>
3   $logged_in_username
4   $private_email => ''
5 </%args>
7 <& /page/page_title.mas, title => "Update User Information" &>
9 Please verify your current password to make changes. Select changes desired by checking the appropriate checkbox and entering the new information. <br /><br />
11 <style>
13 .textlabel {
14   width: 200px;
15   white-space: nowrap;
16   max-width: 150px;
17   overflow: hidden;
18   text-overflow: ellipsis;
19   float:left;     
22 .input { 
23   width: 200px;
24   white-space:nowrap;
27 .checkboxes { 
28   width: 20px;
29   text-align: left;
32 .form-control { 
33   width: 200px;
36 </style>
38 <form id="change_account_form" name="change_account_form"> 
39 <div>
40   <label class="textlabel" for="current_password" id="current_password_label">Current password <font color="red">*</font></label>
41   <input type="password" class="form-control" id="current_password" name="current_password" />
42 </div>
44 <br />
45 <h4><input type="checkbox" id="change_password" name="change_password">Change password</input></h4>
47 <div>
48   <label class="textlabel" for="new_password" >New password</label>
49   <input class="form-control" id="new_password" name="new_password" type="password" />
50 </div>
52 <div>
53   <label class="textlabel" for="confirm_password" >Confirm password</label>
54   <input class="form-control" id="confirm_password" name="confirm_password" type="password" />
55 </div>
56 <br />
57 <br />
59 <h4><input type="checkbox" id="change_email" name="change_email">Change email</input></h4>
60 <div>Your private e-mail address is not publically displayed online. It is used only for SGN staff to contact you about changes to your record or for e-mailing your password to you. Changing your private e-mail address will trigger a confirmation message from SGN to verify the address is usable by SGN.</div><br />
61 <div>
62   <label class="textlabel" for="private_email" >New email</label>
63   <input class="form-control" id="private_email" name="private_email" value="<% $private_email %>" />
64 </div>
65 <div>
66   <label class="textlabel" for="confirm_email" >Confirm email</label>
67   <input class="form-control" id="confirm_email" name="confirm_email" value="<% $private_email %>" />
68 </div>
70 <br />
71 <br />
72 <h4><input class="checkboxes" type="checkbox" id="change_username" name="change_username">Change username</input></h4>
73 <div>
74   <label class="textlabel" for="new_username">New username</label>
75   <input class="form-control" id="new_username" name="new_username" value="<% $logged_in_username %>" />
76 </div>
78 <br />
80 <br />
81 <br />
82 <button class="btn btn-secondary" type="clear_form" id="clear_form">Reset form</button>
84 <button type="submit" class="btn btn-primary" id="submit_account_info">Change Account Information</button>
86 </form>
89 <script>
90   jQuery(document).ready( function() { 
91     jQuery('#change_account_form').submit( function(event) { 
92        event.preventDefault();
93        var form_data = jQuery('#change_account_form').serialize();
94        // alert(JSON.stringify(form_data));
95        jQuery.ajax( { 
96          url: '/ajax/user/update',
97          data: form_data,
98          error: function(r) { alert('An error occurred! Sorry!');  },
99          success: function(r) {
100            if (r.error) { alert(r.error); }
101            else { 
102              alert("Done! " +r.message);
103            }
104          }
105        });
106     });
107   });
109 </script>