Proyectos de Subversion LeadersLinked - Antes de SPA

Rev

Rev 3732 | Ir a la última revisión | | Ultima modificación | Ver Log |

Rev Autor Línea Nro. Línea
1 www 1
<?php
2
$routeSignin = $this->url('signin');
3
 
4
 
5
$this->inlineScript()->captureStart();
6
echo <<<JS
7
jQuery( document ).ready(function( $ ) {
8
 
9
    $.validator.setDefaults({
10
        debug: true,
11
        highlight: function(element) {
12
            $(element).closest('.sn-field').addClass('sn-field-has-error');
13
        },
14
        unhighlight: function(element) {
15
            $(element).closest('.sn-field').removeClass('sn-field-has-error');
16
        },
17
        errorElement: 'div',
18
        errorClass: 'sn-field-invalid-feedback',
19
        errorPlacement: function(error, element) {
20
            if(element.parent('.sn-field').length) {
21
                error.insertAfter(element.parent());
22
            } else if (element.parent('.fgt-sec').length) {
23
                error.insertAfter(element.parent());
24
            } else {
25
                error.insertAfter(element);
26
            }
27
        }
28
    });
29
 
30
    $.fn.showFormErrorValidator = function(fieldname, errors) {
31
        var field = $(fieldname);
32
        if(field) {
33
            $(field).closest('.sn-field').addClass('sn-field-has-error');
34
 
35
            console.log('fieldname = ' + fieldname);
36
            console.log('error = ' + errors[0]);
37
 
38
            var error = $('<div id="' + fieldname +'-error" class="sn-field-invalid-feedback">' + errors + '</div>');
39
            if(field.parent('.sn-field').length) {
40
                error.insertAfter(field.parent());
41
            } else if (field.parent('.fgt-sec').length) {
42
                error.insertAfter(field.parent());
43
            } else {
44
                error.insertAfter(field);
45
            }
46
        }
47
    };
48
 
49
 
50
 
51
    var validatorForgotPassword = $('#form-forgot-password').validate({
52
        debug: true,
53
        onclick: false,
54
        onkeyup: false,
55
        ignore: [':hidden'],
56
        rules: {
57
            'email': {
58
                required: true,
59
                email: true,
60
                maxlength: 64,
61
            },
62
        },
63
        submitHandler: function(form)
64
        {
65
            if (grecaptcha.getResponse() == '') {
66
                $.fn.showError('ERROR_RECAPTCHA_EMPTY');
67
                return false;
68
            }
69
 
70
            NProgress.start();
71
            $.ajax({
72
                'dataType'  : 'json',
73
                'accept'    : 'application/json',
74
                'method'    : 'post',
75
                'url'       : $('#form-forgot-password').attr('action'),
76
                'data'      : $('#form-forgot-password').serialize(),
77
             }).done(function(response) {
78
                if(response.success) {
79
                    window.location.href = '$routeSignin';
80
                } else {
81
                    if(jQuery.type(response.data) == 'string') {
82
                        $.fn.showError(response.data)
83
                    } else  {
84
                        $.each(response.data, function( fieldname, errors ) {
85
                            $.fn.showFormErrorValidator('#form-forgot-password #' + fieldname, errors);
86
                        });
87
                    }
88
                }
89
            }).fail(function( jqXHR, textStatus, errorThrown) {
90
                $.fn.showError(textStatus)
91
 
92
            }).always(function() {
93
                NProgress.done();
94
                grecaptcha.reset();
95
            })
96
        },
97
        invalidHandler: function(form, validator) {
98
        }
99
    });
100
 
101
 
102
 
103
});
104
JS;
105
$this->inlineScript()->captureEnd();
106
 
107
 
108
?>
109
 
110
<div class="signin-popup">
111
	<div  class="signin-pop">
112
		<div class="row">
113
			<div class="col-lg-6">
114
				<div class="cmp-info">
115
					<div class="cm-logo">
116
						<img src="<?php echo $this->basePath('images/logo428x120.png') ?>" alt="">
117
						<p>LABEL_WELCOME</p>
118
						<p>LABEL_WELCOME_2</p>
119
					</div>
120
					<!--cm-logo end-->
121
				</div><!--cmp-info end-->
122
			</div>
123
 
124
			<div class="col-lg-6">
125
				<div class="login-sec">
126
					<ul class="sign-control">
127
						<li><a href="<?php echo $this->url('signin') ?>" title="">LABEL_SIGNIN</a></li>
128
						<li><a href="<?php echo $this->url('signup') ?>" title="">LABEL_SIGNUP</a></li>
129
					    <li class="current"><a href="#" title="">LABEL_FORGOT_MY_PASSWORD</a></li>
130
					</ul>
131
 
132
					<div class="sign_in_sec current">
133
						<h3>LABEL_FORGOT_MY_PASSWORD</h3>
134
						<?php
135
					    $form = $this->form;
136
        				$form->setAttributes([
137
        				    'method'    => 'post',
138
        				    'action'    => $this->url('forgot-password'),
139
        				    'name'      => 'form-forgot-password',
140
        				    'id'        => 'form-forgot-password'
141
        				]);
142
 
143
        				$form->prepare();
144
        				echo $this->form()->openTag($form);
145
 
146
                        ?>
147
 
148
							<div class="row">
149
                   				<div class="col-lg-12 no-pdd">
150
                    				<div class="sn-field">
151
                    					<?php
152
                                        $element = $form->get('email');
153
                                        $element->setAttributes([
154
                                            'placeholder' => 'LABEL_EMAIL',
155
 
156
                                        ]);
157
                                        echo $this->formText($element);
158
                                        ?>
159
                    					<i class="la la-envelope"></i>
160
                    				</div><!--sn-field end-->
161
                  				</div>
162
 
163
                  				<div class="col-lg-12 no-pdd">
164
                           			<div class="sn-field">
165
                                		<?php
166
                                        $element = $form->get('captcha');
167
                                        echo $this->formRow($element);
168
                                        ?>
169
                              		</div>
170
                                </div>
171
 
172
 
173
                            	<div class="col-lg-12 no-pdd">
174
                              		<button type="submit" value="submit">LABEL_NEW_PASSWORD</button>
175
                            	</div>
176
                    		  </div>
177
                        <?php echo $this->form()->closeTag($form); ?>
178
					</div>
179
 
180
				</div>
181
			</div>
182
		</div>
183
 
184
	</div>
185
</div>
186