9 my $join_breeding_programs = eval{ $c->get_conf('user_registration_join_breeding_programs') };
12 <div class="modal fade" id="site_login_dialog" name="site_login_dialog" tabindex="-1" role="dialog" aria-labelledby="site_login_dialog_title">
13 <div class="modal-dialog modal-sm" role="document">
14 <div class="modal-content">
15 <div class="modal-header" style="text-align:center">
16 % if (!$c->config->{require_login}) {
17 <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button>
19 <h3 class="modal-title" id="site_login_dialog_title">Login</h3>
21 <div class="modal-body">
22 <form id="login_form" name="login_form">
23 <div class="container-fluid">
25 % if ($c->config->{default_login_janedoe}) {
26 <input class="form-control" style="width:240px" id="username" name="username" placeholder="Username" type="text" value="janedoe"/>
28 <input class="form-control" style="width:240px" id="password" name="password" placeholder="Password" type="password" value="secretpw"/>
30 <div class="input-group">
31 <input class="form-control" id="username" name="username" placeholder="Username" type="text" tabindex="1" />
32 <span class="input-group-btn">
33 <button id="forgot_username_modal_show" class="btn btn-default" type="button" tabindex="4"> <span class="glyphicon glyphicon-question-sign"></span> </button>
37 <div class="input-group">
38 <input class="form-control" id="password" name="password" placeholder="Password" type="password" tabindex="2" />
39 <span class="input-group-btn">
40 <button id="reset_password_modal_show" class="btn btn-default" type="button" tabindex="5"> <span class="glyphicon glyphicon-question-sign"></span> </button>
46 <input type="hidden" value="<% $goto_url %>" id="goto_url" name="goto_url" />
49 <button class="btn btn-default" id="new_user_modal_show" style="float:left" tabindex="6">New User</button>
50 <button class="btn btn-primary" id="submit_password" name="submit_password" type="submit" style="float:right" tabindex="3">Login</button>
55 <div class="modal-footer">
56 % if (!$c->config->{require_login}) {
57 <button id="close_site_login_dialog_button" type="button" class="btn btn-default" data-dismiss="modal" style="float:left">Close</button>
64 <div class="modal fade" id="site_login_forgot_username_dialog" name="site_login_forgot_username_dialog" tabindex="-1" role="dialog" aria-labelledby="site_login_forgot_username_dialog_title">
65 <div class="modal-dialog" role="document">
66 <div class="modal-content">
67 <div class="modal-header" style="text-align:center">
68 <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button>
69 <h3 class="modal-title" id="site_login_forgot_username_dialog_title">Forgot Username</h3>
71 <div class="modal-body">
73 If you've forgotten your username, enter your email address below. An email will be sent with any account username(s) associated with your email address.
76 <div style="white-space:nowrap">
77 <form id="forgot_username_form" name="forgot_username_form" style="white-space:nowrap">
78 <div style="white-space:nowrap; align:center">
79 <label class="textlabel">Email Address</label>
80 <input class="form-control" style="width:200px; white-space:nowrap; float:center" id="forgot_username_email" name="forgot_username_email" /><br />
81 <button type="submit" class="btn btn-primary" id="submit_forgot_username_email" style="float:center" >Get Username(s)</button>
86 <div class="modal-footer">
87 <button id="close_site_login_forgot_username_dialog_button" type="button" class="btn btn-default" data-dismiss="modal" style="float:left">Close</button>
93 <div class="modal fade" id="site_login_reset_password_dialog" name="site_login_reset_password_dialog" tabindex="-1" role="dialog" aria-labelledby="site_login_reset_password_dialog_title">
94 <div class="modal-dialog" role="document">
95 <div class="modal-content">
96 <div class="modal-header" style="text-align:center">
97 <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button>
98 <h3 class="modal-title" id="site_login_reset_password_dialog_title">Reset Password</h3>
100 <div class="modal-body">
102 To reset your password, please enter your email address. A link will be sent to that address with a link that will enable you to reset your password.
105 <div style="white-space:nowrap">
106 <form id="password_reset_form" name="password_reset_form" style="white-space:nowrap">
107 <div style="white-space:nowrap; align:center">
108 <label class="textlabel">Email Address</label>
109 <input class="form-control" style="width:200px; white-space:nowrap; float:center" id="password_reset_email" name="password_reset_email" /><br />
110 <button type="submit" class="btn btn-primary" id="submit_password_reset_email" style="float:center" >Get link</button>
115 <div class="modal-footer">
116 <button id="close_site_login_reset_password_dialog_button" type="button" class="btn btn-default" data-dismiss="modal" style="float:left">Close</button>
122 <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">
123 <div class="modal-dialog modal-lg" role="document">
124 <div class="modal-content">
125 <div class="modal-header" style="text-align:center">
126 <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button>
127 <h3 class="modal-title" id="site_login_new_user_dialog_title">Create New User</h3>
129 <div class="modal-body">
131 <div class="col-sm-10 col-sm-offset-1">
133 <form id="new_account_form">
134 <div class="container-fluid">
135 <div class="panel panel-danger">
136 <div class="panel-heading">Notice</div>
137 <div class="panel-body">
139 <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>
140 <li>A link will be emailed to you. Please click on it to activate the account.</li>
141 <li><b>All fields are required.</b></li>
146 <div class="form-horizontal">
147 <div class="form-group">
148 <label class="col-sm-3 control-label">First Name: </label>
149 <div class="col-sm-9">
150 <input class="form-control" type="text" name="first_name" value="" />
153 <div class="form-group">
154 <label class="col-sm-3 control-label">Last Name: </label>
155 <div class="col-sm-9">
156 <input class="form-control" type="text" name="last_name" value="" />
159 % if ( $join_breeding_programs ) {
160 <div class="form-group">
161 <label class="col-sm-3 control-label">Breeding Program(s): </label>
162 <div class="col-sm-9">
163 <div id="breeding_programs_div"></div>
167 <div class="form-group">
168 <label class="col-sm-3 control-label">Organization: </label>
169 <div class="col-sm-9">
170 <input class="form-control" type="text" name="organization" value="" />
174 <div class="form-group">
175 <label class="col-sm-3 control-label">Username: </label>
176 <div class="col-sm-9">
177 <input class="form-control" type="text" name="username" value="" />
178 <p class="help-block">Username must be at least 7 characters long.</p>
181 <div class="form-group">
182 <label class="col-sm-3 control-label">Password: </label>
183 <div class="col-sm-9">
184 <input class="form-control" type="password" name="password" value="" />
185 <p class="help-block">Password must be at least 7 characters long and different from your username.</p>
188 <div class="form-group">
189 <label class="col-sm-3 control-label">Confirm Password: </label>
190 <div class="col-sm-9">
191 <input class="form-control" type="password" name="confirm_password" value="" />
192 <p class="help-block">Password must be at least 7 characters long and different from your username.</p>
195 <div class="form-group">
196 <label class="col-sm-3 control-label">Email Address: </label>
197 <div class="col-sm-9">
198 <input class="form-control" type="text" name="email_address" value="" />
199 <p class="help-block">An email will be sent to this address requiring you to confirm its receipt to activate your account.</p>
204 <button class="btn btn-default btn-lg" type="reset" >Reset</button>
205 <button class="btn btn-primary btn-lg" type="submit" name="create_account" >Create Account</button>
214 <div class="modal-footer">
215 <button id="close_site_login_new_user_dialog_button" type="button" class="btn btn-default" data-dismiss="modal" style="float:left">Close</button>
222 jQuery(document).ready( function() {
224 jQuery("#site_login_dialog").on('shown.bs.modal', function() {
225 jQuery("#username").focus();
228 jQuery('#forgot_username_modal_show').click(function() {
229 jQuery('#site_login_forgot_username_dialog').modal('show');
232 jQuery('#forgot_username_form').submit(function(event) {
233 event.preventDefault();
234 var form_data = jQuery('#forgot_username_form').serialize();
236 url: '/ajax/user/forgot_username',
238 error: function(r) { alert('An error occurred! Sorry!'); },
239 success: function(r) {
240 if (r.error) { alert(r.error); }
243 jQuery('#site_login_forgot_username_dialog').modal('hide');
249 jQuery('#reset_password_modal_show').click(function(){
250 event.preventDefault();
251 jQuery('#site_login_reset_password_dialog').modal('show');
254 jQuery('#password_reset_form').submit( function(event) {
255 event.preventDefault();
256 var form_data = jQuery('#password_reset_form').serialize();
258 url: '/ajax/user/reset_password',
260 error: function(r) { alert('An error occurred! Sorry!'); },
261 success: function(r) {
262 if (r.error) { alert(r.error); }
265 jQuery('#site_login_reset_password_dialog').modal('hide');
271 jQuery('#new_user_modal_show').click(function(){
272 event.preventDefault();
273 jQuery('#site_login_new_user_dialog').modal('show');
275 jQuery("#site_login_new_user_dialog").on('shown.bs.modal', function() {
276 get_select_box('breeding_programs', 'breeding_programs_div', { 'name': 'breeding_programs', 'id': 'breeding_programs', 'default': -1, 'multiple': 1 });
279 jQuery('#new_account_form').submit(function(event) {
280 event.preventDefault();
281 var form_data = jQuery('#new_account_form').serialize();
282 //alert(JSON.stringify(form_data));
284 url: '/ajax/user/new',
285 beforeSend: function(){
286 jQuery('#working_modal').modal('show');
289 success: function(r) {
290 jQuery('#working_modal').modal('hide');
292 if (r.error) { alert(r.error); }
294 let message = r.message || 'New account added. Check your email for the confirmation link - you must confirm your account before you can login.';
296 jQuery('#site_login_new_user_dialog').modal('hide');
297 jQuery('#site_login_dialog').modal('hide');
303 jQuery("#username, #password").keydown(function(event) {
304 var key = event.keyCode ? event.keyCode : event.which;
306 jQuery("#login_form").submit();
307 event.preventDefault();
310 jQuery('#login_form').submit( function(event) {
311 event.preventDefault();
312 var form_data = jQuery('#login_form').serialize();
313 if (!jQuery('#username').val() || !jQuery('#password').val()) {
314 alert('Please enter a username and password');
318 url: '/ajax/user/login',
320 error: function(r) { alert('An error occurred! Sorry!'); },
321 success: function(r) {
326 if (r.goto_url.match('login')) {
328 } else if (r.goto_url && r.goto_url !== "" ) {
329 location.href=r.goto_url;
337 // Display New User Dialog if `new_user` query param set
338 url = new URL(window.location.href);
339 if ( url.searchParams.get('new_user') ) {
340 jQuery('#site_login_new_user_dialog').modal('show');
346 <!-- End login dialog -->