Files
grzanieplus.pl/apps/frontend/modules/stUser/templates/ajaxLoginFormSuccess.php
2025-03-12 17:06:23 +01:00

60 lines
2.2 KiB
PHP

<?php
$smarty->assign('error_email', $sf_request->getError('user{email}'));
$smarty->assign('error_password', $sf_request->getError('user{password}'));
$smarty->assign('input_email', input_tag('user[email]', $sf_params->get('user[email]'), array('id'=>'st_form-user-ajax-email', 'placeholder'=>__('E-mail (login)'), 'maxlength'=>'255', 'class'=>'form-control')));
$smarty->assign('input_password', input_password_tag('user[password]', $sf_params->get('user[password]'), array('id'=>'st_form-user-ajax-password', 'placeholder'=>__('Hasło'), 'maxlength'=>'255', 'class'=>'form-control')));
$smarty->assign('remind_password_link', link_to(__('Przypomnij hasło'), 'stUser/remindPassword'));
$smarty->assign('create_account_link', link_to( __('Zarejestruj się'), 'stUser/createAccount'));
$smarty->display('user_ajax_login_form.html');
?>
<script type="text/javascript">
jQuery(function ($) {
$(document).ready(function() {
$( "#submit_login" ).click(function() {
postLogin();
});
$('#st_form-user-email').keypress(function(event) {
var keycode = (event.keyCode ? event.keyCode : event.which);
if (keycode == '13') {
postLogin();
}
});
$('#st_form-user-password').keypress(function(event) {
var keycode = (event.keyCode ? event.keyCode : event.which);
if (keycode == '13') {
postLogin();
}
});
function postLogin(){
$.post("<?php echo url_for('stUser/ajaxLoginForm') ?>", { 'user[email]':$('#st_form-user-ajax-email').val(),'user[password]':$('#st_form-user-ajax-password').val()}, function(data) { $('#ajax-login-form').html(data); });
}
<?php if ($close==1): ?>
$('#ajax-login-form-modal').modal('hide');
location.reload();
<?php endif; ?>
});
});
</script>