add smid dump script.
[SMMID.git] / mason / site / new_user.mas
blob77cff3dbbae679c2a561509d0845b688a08bd53b
2 <div class="modal fade" id="site_login_new_user_dialog" name="site_login_new_user_dialog" tabindex="-1" role="dialog" aria-labelledby="site_login_new_user_dialog_title">
3     <div class="modal-dialog modal-lg" role="document">
4         <div class="modal-content">
5             <div class="modal-header" style="text-align:center">
6                 <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
7                 <h3 class="modal-title" id="site_login_new_user_dialog_title">Create New User</h3>
8             </div>
9             <div class="modal-body">
10                 <div class="row">
11                     <div class="col-sm-10 col-sm-offset-1">
13                         <form id="new_account_form">
14                             <div class="container-fluid">
15                                 <div class="panel panel-danger">
16                                     <div class="panel-heading">Notice</div>
17                                     <div class="panel-body">
18                                         <ul>
19                                             <li><b>Before</b> creating a new account, please check if you <b>already have an account</b> using the <a href="/search/direct_search.pl?search=directory">directory search</a>. </li>
20                                             <li>A link will be emailed to you. Please click on it to activate the account.</li>
21                                             <li><b>All fields are required.</b></li>
22                                         </ul>
23                                     </div>
24                                 </div>
26                                 <div class="form-horizontal">
27                                     <div class="form-group">
28                                         <label class="col-sm-3 control-label">First Name: </label>
29                                         <div class="col-sm-9">
30                                             <input class="form-control" type="text" name="first_name" value="" />
31                                         </div>
32                                     </div>
33                                     <div class="form-group">
34                                         <label class="col-sm-3 control-label">Last Name: </label>
35                                         <div class="col-sm-9">
36                                             <input class="form-control" type="text" name="last_name" value="" />
37                                         </div>
38                                     </div>
39                                     <div class="form-group">
40                                         <label class="col-sm-3 control-label">Organization: </label>
41                                         <div class="col-sm-9">
42                                             <input class="form-control" type="text" name="organization" value="" />
43                                         </div>
44                                     </div>
45                                     <div class="form-group">
46                                         <label class="col-sm-3 control-label">Username: </label>
47                                         <div class="col-sm-9">
48                                             <input class="form-control" type="text" name="username" value="" />
49                                             <p class="help-block">Username must be at least 7 characters long.</p>
50                                         </div>
51                                     </div>
52                                     <div class="form-group">
53                                         <label class="col-sm-3 control-label">Password: </label>
54                                         <div class="col-sm-9">
55                                             <input class="form-control" type="password" name="password" value="" />
56                                             <p class="help-block">Password must be at least 7 characters long and different from your username.</p>
57                                         </div>
58                                     </div>
59                                     <div class="form-group">
60                                         <label class="col-sm-3 control-label">Confirm Password: </label>
61                                         <div class="col-sm-9">
62                                             <input class="form-control" type="password" name="confirm_password" value="" />
63                                             <p class="help-block">Password must be at least 7 characters long and different from your username.</p>
64                                         </div>
65                                     </div>
66                                     <div class="form-group">
67                                         <label class="col-sm-3 control-label">Email Address: </label>
68                                         <div class="col-sm-9">
69                                             <input class="form-control" type="text" name="email_address" value="" />
70                                             <p class="help-block">An email will be sent to this address requiring you to confirm its receipt to activate your account.</p>
71                                         </div>
72                                     </div>
74                                     <div align="right">
75                                         <button class="btn btn-default btn-lg" type="reset" >Reset</button>
76                                         <button class="btn btn-primary btn-lg" type="submit" name="create_account" >Create Account</button>
77                                     </div>
78                                 </div>
79                             </div>
80                         </form>
82                     </div>
83                 </div>
84             </div>
85             <div class="modal-footer">
86                 <button id="close_site_login_new_user_dialog_button" type="button" class="btn btn-default" data-dismiss="modal" style="float:left">Close</button>
87             </div>
88         </div>
89     </div>
90 </div>
92 <script>
94     jQuery('#new_user_modal_show').click(function(){
95         event.preventDefault();
96         jQuery('#site_login_new_user_dialog').modal('show');
97     });
99     jQuery('#new_account_form').submit(function(event) {
100         event.preventDefault();
101         var form_data = jQuery('#new_account_form').serialize();
102         //alert(JSON.stringify(form_data));
103         jQuery.ajax({
104             url: '/ajax/user/new',
105             beforeSend: function(){
106                 jQuery('#working_modal').modal('show');
107             },
108             data: form_data,
109             success: function(r) {
110                 jQuery('#working_modal').modal('hide');
111                 console.log(r);
112                 if (r.error) { alert(r.error); }
113                 else {
114                     alert('New account added. Check your email.');
115                     history.back();
116                 }
117             }
118         });
119    });
120 </script>