PluginProbe ʕ •ᴥ•ʔ
Essential Addons for Elementor – Popular Elementor Templates & Widgets / 6.6.9
Essential Addons for Elementor – Popular Elementor Templates & Widgets v6.6.9
6.6.9 6.6.8 6.6.7 6.6.6 6.6.5 6.6.4 6.6.3 5.7.3 5.7.4 5.8.0 5.8.1 5.8.10 5.8.11 5.8.12 5.8.13 5.8.14 5.8.15 5.8.16 5.8.18 5.8.2 5.8.3 5.8.4 5.8.5 5.8.6 5.8.7 5.8.8 5.8.9 5.9.0 5.9.1 5.9.10 5.9.11 5.9.12 5.9.13 5.9.14 5.9.15 5.9.16 5.9.17 5.9.18 5.9.19 5.9.2 5.9.20 5.9.21 5.9.22 5.9.23 5.9.24 5.9.25 5.9.26 5.9.27 5.9.3 5.9.4 5.9.5 5.9.6 5.9.7 5.9.8 5.9.9 6.0.0 6.0.1 6.0.10 6.0.11 6.0.12 6.0.13 6.0.14 6.0.15 6.0.2 6.0.3 6.0.4 6.0.5 6.0.6 6.0.7 6.0.8 6.0.9 6.1.0 6.1.1 6.1.10 6.1.11 trunk 6.1.12 1.0.0 6.1.13 1.0.1 6.1.14 1.1.0 6.1.15 2.0 6.1.17 2.1 6.1.18 2.10.0 6.1.19 2.10.1 6.1.2 2.10.2 6.1.20 2.10.3 6.1.3 2.10.4 6.1.4 2.10.5 6.1.5 2.2.0 6.1.6 2.2.1 6.1.7 2.2.2 6.1.8 2.2.3 6.1.9 2.2.4 6.2.0 2.2.5 6.2.1 2.3.0 6.2.2 2.3.1 6.2.3 2.4.0 6.2.4 2.4.1 6.3.0 2.4.2 6.3.1 2.4.3 6.3.2 2.5.0 6.3.3 2.6.0 6.4.0 2.7.0 6.5.0 2.7.1 6.5.1 2.7.10 6.5.10 2.7.11 6.5.11 2.7.2 6.5.12 2.7.3 6.5.13 2.7.4 6.5.2 2.7.5 6.5.3 2.7.6 6.5.4 2.7.7 6.5.5 2.7.8 6.5.6 2.7.9 6.5.7 2.8.0 6.5.8 2.8.1 6.5.9 2.8.2 6.6.0 2.8.3 6.6.1 2.8.4 6.6.2 2.8.5 2.8.6 2.8.7 2.9.0 2.9.1 2.9.2 2.9.3 2.9.4 2.9.5 2.9.6 2.9.7 2.9.8 2.9.9 3.0.0 3.0.1 3.0.2 3.0.3 3.0.4 3.0.5 3.1.0 3.1.1 3.1.2 3.1.3 3.1.4 3.1.4.1 3.1.5 3.2.0 3.3.0 3.3.1 3.3.2 3.3.3 3.4.0 3.5.0 3.5.1 3.5.2 3.6.0 3.6.1 3.6.2 3.7.0 3.7.1 3.7.2 3.8.0 3.8.1 3.8.2 3.8.3 3.8.4 3.8.5 3.9.0 3.9.1 3.9.2 3.9.3 3.9.4 4.0.0 4.0.1 4.0.2 4.0.3 4.0.4 4.1.0 4.1.1 4.1.2 4.2.0 4.2.1 4.2.2 4.2.3 4.2.4 4.3.0 4.3.1 4.3.2 4.3.3 4.3.4 4.3.5 4.3.6 4.3.7 4.3.8 4.3.9 4.4.0 4.4.1 4.5.0 4.5.1 4.5.2 4.5.3 4.5.4 4.5.5 4.6.0 4.6.1 4.6.2 4.6.3 4.6.4 4.6.5 4.6.6 4.7.0 4.7.1 4.7.2 4.7.3 4.7.4 4.7.5 4.8.0 4.8.1 4.8.2 4.8.3 4.8.4 4.9.0 4.9.1 4.9.2 4.9.3 4.9.4 4.9.5 4.9.6 4.9.7 5.0.0 5.0.1 5.0.10 5.0.11 5.0.12 5.0.13 5.0.2 5.0.3 5.0.4 5.0.5 5.0.6 5.0.7 5.0.8 5.0.9 5.1.0 5.1.1 5.1.2 5.1.3 5.1.4 5.1.5 5.1.6 5.1.7 5.1.8 5.1.9 5.2.0 5.2.1 5.2.2 5.2.3 5.2.4 5.3.0 5.3.1 5.3.2 5.4.6 5.5.5 5.6.5 5.7.2
essential-addons-for-elementor-lite / includes / Elements / Login_Register.php
essential-addons-for-elementor-lite / includes / Elements Last commit date
Adv_Accordion.php 2 months ago Adv_Tabs.php 2 months ago Advanced_Data_Table.php 2 weeks ago Better_Payment.php 4 years ago Betterdocs_Category_Box.php 3 months ago Betterdocs_Category_Grid.php 3 months ago Betterdocs_Search_Form.php 2 months ago Breadcrumbs.php 2 months ago Business_Reviews.php 6 days ago Caldera_Forms.php 2 months ago Career_Page.php 4 years ago Code_Snippet.php 4 months ago Contact_Form_7.php 2 months ago Content_Ticker.php 4 months ago Countdown.php 2 months ago Creative_Button.php 1 month ago Cta_Box.php 2 months ago Data_Table.php 2 months ago Dual_Color_Header.php 6 days ago EmbedPress.php 4 years ago Event_Calendar.php 1 week ago Facebook_Feed.php 4 months ago Fancy_Text.php 2 months ago Feature_List.php 4 months ago Filterable_Gallery.php 6 days ago Flip_Box.php 2 months ago FluentForm.php 2 months ago Formstack.php 2 months ago GravityForms.php 6 days ago Image_Accordion.php 2 months ago Info_Box.php 6 days ago Interactive_Circle.php 2 months ago Login_Register.php 6 days ago NFT_Gallery.php 4 months ago NinjaForms.php 2 months ago Post_Grid.php 4 months ago Post_Timeline.php 10 months ago Pricing_Table.php 2 months ago Product_Grid.php 3 weeks ago Progress_Bar.php 2 months ago SVG_Draw.php 4 months ago Simple_Menu.php 6 days ago Sticky_Video.php 4 months ago Team_Member.php 4 months ago Testimonial.php 2 months ago Tooltip.php 2 months ago Twitter_Feed.php 4 months ago TypeForm.php 5 months ago WeForms.php 1 year ago Woo_Add_To_Cart.php 2 months ago Woo_Cart.php 4 months ago Woo_Checkout.php 4 months ago Woo_Product_Carousel.php 1 month ago Woo_Product_Compare.php 1 year ago Woo_Product_Gallery.php 4 months ago Woo_Product_Images.php 1 month ago Woo_Product_List.php 2 months ago Woo_Product_Price.php 2 months ago Woo_Product_Rating.php 2 months ago WpForms.php 2 months ago index.php 3 years ago
Login_Register.php
8357 lines
1 <?php
2
3 namespace Essential_Addons_Elementor\Elements;
4
5 use Elementor\Controls_Manager;
6 use Elementor\Group_Control_Background;
7 use Elementor\Group_Control_Border;
8 use Elementor\Group_Control_Box_Shadow;
9 use Elementor\Group_Control_Image_Size;
10 use Elementor\Group_Control_Typography;
11 use Elementor\Icons_Manager;
12 use Elementor\Plugin;
13 use Elementor\Repeater;
14 use Elementor\Utils;
15 use Elementor\Widget_Base;
16 use Essential_Addons_Elementor\Classes\Helper as HelperCLass;
17 use Essential_Addons_Elementor\Traits\Login_Registration;
18 use WP_Roles;
19
20 if ( ! defined( 'ABSPATH' ) ) {
21 exit;
22 } // Exit if accessed directly
23
24 /**
25 * Class Login_Register
26 * @package Essential_Addons_Elementor\Elements
27 */
28 class Login_Register extends Widget_Base {
29
30 use Login_Registration;
31
32 /**
33 * Does the site allows new user registration?
34 * @var bool
35 */
36 protected $user_can_register;
37 /**
38 * Login custom redirect url
39 * @var bool
40 */
41 protected $login_custom_redirect_url;
42 /**
43 * Are you currently in Elementor Editor Screen?
44 * @var bool
45 */
46 protected $in_editor;
47 /**
48 * Should login form be printed?
49 * @var bool
50 */
51 protected $should_print_login_form;
52 /**
53 * Should registration form be printed?
54 * @var bool
55 */
56 protected $should_print_register_form;
57 /**
58 * Should lost password form be printed?
59 * @var bool
60 */
61 protected $should_print_lostpassword_form;
62 /**
63 * Should reset password form be printed?
64 * @var bool
65 */
66 protected $should_print_resetpassword_form;
67 /**
68 * Should reset password form be printed in editor?
69 * @var bool
70 */
71 protected $should_print_resetpassword_form_editor;
72 /**
73 * It contains an array of settings for the display
74 * @var array
75 */
76 protected $ds;
77 /**
78 * @var bool|false|int
79 */
80 protected $page_id;
81 /**
82 * @var bool|false|int
83 */
84 protected $page_id_for_popup;
85 /**
86 * @var string
87 */
88 protected $resetpassword_in_popup_selector;
89 /**
90 * @var bool|string
91 */
92 protected $form_illustration_url;
93 /**
94 * @var bool|string
95 */
96 protected $form_logo;
97 /**
98 * What form to show by default on initial page load. login or register ?
99 * @var string
100 */
101 protected $default_form;
102 /**
103 * Form illustration position
104 * @var mixed|string
105 */
106 protected $form_illustration_pos;
107 /**
108 * Form logo position
109 * @var mixed|string
110 */
111 protected $form_logo_pos;
112 /**
113 * Google reCAPTCHA Site key
114 * @var string|false
115 */
116 protected $recaptcha_sitekey;
117
118 /**
119 * Google reCAPTCHA v3 Site key
120 * @var string|false
121 */
122 protected $recaptcha_sitekey_v3;
123
124 /**
125 * Google reCAPTCHA v3 badge hide flag
126 * @var string|false
127 */
128 protected $recaptcha_badge_hide;
129
130 /**
131 * Cloudflare Turnstile Site key
132 * @var string|false
133 */
134 protected $cloudflare_turnstile_sitekey;
135
136 /**
137 * Cloudflare Turnstile Secret key
138 * @var string|false
139 */
140 protected $cloudflare_turnstile_secretkey;
141
142 /**
143 * @var mixed|void
144 */
145 protected $pro_enabled;
146
147 /**
148 * Login_Register constructor.
149 * Initializing the Login_Register widget class.
150 * @inheritDoc
151 */
152 public function __construct( $data = [], $args = null ) {
153 parent::__construct( $data, $args );
154 $this->user_can_register = get_option( 'users_can_register' );
155 $this->recaptcha_sitekey = get_option( 'eael_recaptcha_sitekey' );
156 $this->cloudflare_turnstile_sitekey = get_option( 'eael_cloudflare_turnstile_sitekey' );
157 $this->cloudflare_turnstile_secretkey = get_option( 'eael_cloudflare_turnstile_secretkey' );
158 $this->recaptcha_sitekey_v3 = get_option( 'eael_recaptcha_sitekey_v3' );
159 $this->recaptcha_badge_hide = get_option('eael_recaptcha_badge_hide');
160 $this->in_editor = Plugin::instance()->editor->is_edit_mode();
161 $this->pro_enabled = apply_filters( 'eael/pro_enabled', false );
162
163 if( ! empty( $this->cloudflare_turnstile_sitekey ) ){
164 //phpcs:ignore PluginCheck.CodeAnalysis.EnqueuedResourceOffloading.OffloadedContent
165 wp_register_script( 'eael-cloudflare', 'https://challenges.cloudflare.com/turnstile/v0/api.js' );
166 }
167
168 if ( $this->recaptcha_badge_hide ) {
169 add_filter( 'body_class', [ $this, 'add_login_register_body_class' ] );
170 }
171 }
172
173 /**
174 * @inheritDoc
175 */
176 public function get_name() {
177 return 'eael-login-register';
178 }
179
180 /**
181 * @inheritDoc
182 */
183 public function get_title() {
184 return esc_html__( 'Login | Register Form', 'essential-addons-for-elementor-lite' );
185 }
186
187 /**
188 * @inheritDoc
189 */
190 public function get_icon() {
191 return 'eaicon-login';
192 }
193
194 public function get_script_depends() {
195 $scripts = parent::get_script_depends();
196 $scripts[] = 'eael-recaptcha';
197
198 return apply_filters( 'eael/login-register/scripts', $scripts );
199 }
200
201 /**
202 * @inheritDoc
203 */
204 public function get_style_depends() {
205 $styles = parent::get_style_depends();
206 $styles[] = 'dashicons';
207
208 return apply_filters( 'eael/login-register/styles', $styles );
209 }
210
211 /**
212 * @inheritDoc
213 */
214 public function get_keywords() {
215 return [
216 'ea login register',
217 'ea register login',
218 'signin form',
219 'signup form',
220 'sign in form',
221 'sign up form',
222 'authentication',
223 'google',
224 'facebook',
225 'ea',
226 'essential addons',
227 ];
228 }
229
230 public function has_widget_inner_wrapper(): bool {
231 return ! HelperCLass::eael_e_optimized_markup();
232 }
233
234 public function get_custom_help_url() {
235 return 'https://essential-addons.com/elementor/docs/login-register-form/';
236 }
237
238 /**
239 * @inheritDoc
240 */
241 public function get_categories() {
242 return [ 'essential-addons-elementor' ];
243 }
244
245 /**
246 * Get an array of form field types.
247 * @return array
248 */
249 protected function get_form_field_types() {
250 $eael_form_field_types = [
251 'user_name' => __( 'Username', 'essential-addons-for-elementor-lite' ),
252 'email' => __( 'Email', 'essential-addons-for-elementor-lite' ),
253 'password' => __( 'Password', 'essential-addons-for-elementor-lite' ),
254 'confirm_pass' => __( 'Confirm Password', 'essential-addons-for-elementor-lite' ),
255 'first_name' => __( 'First Name', 'essential-addons-for-elementor-lite' ),
256 'last_name' => __( 'Last Name', 'essential-addons-for-elementor-lite' ),
257 'website' => __( 'Website', 'essential-addons-for-elementor-lite' ),
258 'honeypot' => __( 'Honeypot', 'essential-addons-for-elementor-lite' ),
259 ];
260
261 if( 'on' === get_option( 'eael_custom_profile_fields' ) ){
262 $eael_form_field_types['eael_phone_number'] = __( 'Phone', 'essential-addons-for-elementor-lite' );
263 $eael_custom_profile_fields = $this->get_eael_custom_profile_fields( 'all' );
264 $eael_form_field_types = array_merge( $eael_form_field_types, $eael_custom_profile_fields );
265 }
266
267 return apply_filters( 'eael/registration-form-fields', $eael_form_field_types );
268 }
269
270 /**
271 * @inheritDoc
272 */
273 protected function register_controls() {
274 /*----Content Tab----*/
275 do_action( 'eael/login-register/before-content-controls', $this );
276 $this->init_content_general_controls();
277 $this->init_bot_protection_controls();
278 $this->init_form_header_controls();
279 // Login Form Related---
280 $this->init_content_login_fields_controls();
281 $this->init_content_login_options_controls();
282
283 if(!$this->pro_enabled){
284 $this->social_login_promo();
285 }
286
287 do_action( 'eael/login-register/after-login-controls-section', $this );
288 // Registration For Related---
289 $this->init_content_register_fields_controls();
290 $this->init_content_register_options_controls();
291 $this->init_content_register_user_email_controls();
292 $this->init_content_register_admin_email_controls();
293
294 // Lost Password Form Related---
295 $this->init_content_lostpassword_fields_controls();
296 $this->init_content_lostpassword_user_email_controls();
297
298 // Reset Password Form Related---
299 $this->init_content_resetpassword_fields_controls();
300 $this->init_content_resetpassword_options_controls();
301
302 //Terms & Conditions
303 $this->init_content_terms_controls();
304 // Error Messages
305 $this->init_content_validation_messages_controls();
306 do_action( 'eael/login-register/animated-character-controls', $this );
307 do_action( 'eael/login-register/after-content-controls', $this );
308
309 // Bit Integrations cross-promo (renders only when the plugin is not active).
310 $this->bit_integrations_promo();
311
312 if(!$this->pro_enabled){
313 $this->show_pro_promotion();
314 }
315
316 /*----Style Tab----*/
317 do_action( 'eael/login-register/before-style-controls', $this );
318 $this->init_style_general_controls();
319 $this->init_style_header_content_controls( 'login' );
320 $this->init_style_header_content_controls( 'register' );
321 $this->init_style_header_content_controls( 'lostpassword' );
322 $this->init_style_header_content_controls( 'resetpassword' );
323 $this->init_style_input_fields_controls();
324 $this->init_style_input_labels_controls();
325 $this->init_style_login_button_controls();
326 $this->init_style_register_button_controls();
327 $this->init_style_lostpassword_button_controls();
328 $this->init_style_resetpassword_button_controls();
329 $this->init_style_login_link_controls();
330 $this->init_style_register_link_controls();
331 $this->init_style_login_recaptcha_controls();
332 $this->init_style_register_recaptcha_controls();
333 $this->init_style_lostpassword_recaptcha_controls();
334 $this->init_style_otp_controls();
335 do_action( 'eael/login-register/animated-character-style-controls', $this );
336 do_action( 'eael/login-register/after-style-controls', $this );
337
338 }
339
340 /**
341 * It adds controls related to Login Form Types section to the Widget Content Tab
342 */
343 protected function init_content_general_controls() {
344 $this->start_controls_section( 'section_content_general', [
345 'label' => __( 'General', 'essential-addons-for-elementor-lite' ),
346 ] );
347 $this->add_control( 'default_form_type_notice', [
348 'type' => Controls_Manager::RAW_HTML,
349 'raw' => __( 'Choose the type of form you want to show by default. Note: you can show both forms in a single page even if you select only login or registration from below.', 'essential-addons-for-elementor-lite' ),
350 'content_classes' => 'elementor-panel-alert elementor-panel-alert-info',
351 ] );
352 $this->add_control( 'default_form_type', [
353 'label' => __( 'Default Form Type', 'essential-addons-for-elementor-lite' ),
354 'type' => Controls_Manager::SELECT,
355 'options' => [
356 'login' => __( 'Login', 'essential-addons-for-elementor-lite' ),
357 'register' => __( 'Registration', 'essential-addons-for-elementor-lite' ),
358 'lostpassword' => __( 'Lost Password', 'essential-addons-for-elementor-lite' ),
359 ],
360 'default' => 'login',
361 ] );
362
363 if ( ! $this->user_can_register ) {
364 $this->add_control( 'registration_off_notice', [
365 'type' => Controls_Manager::RAW_HTML,
366 /* translators: %1$s is settings page link open tag, %2$s is link closing tag */
367 'raw' => sprintf( __( 'Registration is disabled on your site. Please enable it to use registration form. You can enable it from Dashboard » Settings » General » %1$sMembership%2$s.', 'essential-addons-for-elementor-lite' ), '<a href="' . esc_attr( esc_url( admin_url( 'options-general.php' ) ) ) . '" target="_blank">', '</a>' ),
368 'content_classes' => 'elementor-panel-alert elementor-panel-alert-warning',
369 'condition' => [
370 'default_form_type' => 'register',
371 ],
372 ] );
373 }
374
375 $this->add_control( 'enable_reset_password', [
376 'label' => __( 'Enable Reset Password Form', 'essential-addons-for-elementor-lite' ),
377 'type' => Controls_Manager::SWITCHER,
378 'default' => 'no',
379 'conditions' => [
380 'relation' => 'or',
381 'terms' => [
382 [
383 'relation' => 'and',
384 'terms' => [
385 [
386 'name' => 'show_lost_password',
387 'value' => 'yes'
388 ],
389 [
390 'name' => 'lost_password_link_type',
391 'value' => 'form',
392 ]
393 ]
394 ],
395 [
396 'name' => 'default_form_type',
397 'value' => 'lostpassword',
398 ]
399 ],
400 ],
401 ] );
402
403 // preview reset password form
404 $this->add_control( 'preview_reset_password', [
405 'label' => __( 'Preview Reset Password Form', 'essential-addons-for-elementor-lite' ),
406 'description' => __( 'This will show a preview of the reset password form in the editor.', 'essential-addons-for-elementor-lite' ),
407 'type' => Controls_Manager::SWITCHER,
408 'default' => 'no',
409 'condition' => [
410 'enable_reset_password' => 'yes'
411 ],
412 ] );
413
414 $this->add_control( 'hide_for_logged_in_user', [
415 'label' => __( 'Hide all Forms from Logged-in Users', 'essential-addons-for-elementor-lite' ),
416 'type' => Controls_Manager::SWITCHER,
417 'default' => '',
418 ] );
419 $this->add_control( 'redirect_for_logged_in_user', [
420 'label' => __( 'Redirect for Logged-in Users', 'essential-addons-for-elementor-lite' ),
421 'type' => Controls_Manager::SWITCHER,
422 'default' => 'no',
423 ] );
424 $this->add_control( 'redirect_url_for_logged_in_user', [
425 'type' => Controls_Manager::URL,
426 'show_label' => false,
427 'show_external' => false,
428 'placeholder' => site_url(),
429 'description' => __( 'Please note that only your current domain is allowed here to keep your site secure.', 'essential-addons-for-elementor-lite' ),
430 'condition' => [
431 'redirect_for_logged_in_user' => 'yes',
432 ],
433 'default' => [
434 'url' => site_url(),
435 'is_external' => false,
436 'nofollow' => true,
437 ],
438 ] );
439 $this->add_control( 'gen_lgn_content_po_toggle', [
440 'label' => __( 'Login Form General', 'essential-addons-for-elementor-lite' ),
441 'type' => Controls_Manager::POPOVER_TOGGLE,
442 'label_off' => __( 'Controls', 'essential-addons-for-elementor-lite' ),
443 'label_on' => __( 'Custom', 'essential-addons-for-elementor-lite' ),
444 'return_value' => 'yes',
445 'default' => 'yes',
446 ] );
447 $this->start_popover();
448 $this->add_control( 'show_log_out_message', [
449 'label' => __( 'Show Logout Link', 'essential-addons-for-elementor-lite' ),
450 'type' => Controls_Manager::SWITCHER,
451 'default' => 'yes',
452 ] );
453 $this->add_control( 'log_out_link_text', [
454 'label' => __( 'Logout Link Text', 'essential-addons-for-elementor-lite' ),
455 'label_block' => true,
456 'type' => Controls_Manager::TEXT,
457 'dynamic' => [
458 'active' => true,
459 ],
460 'default' => __( 'You are already logged in as [username]. ([logout_link])', 'essential-addons-for-elementor-lite' ),
461 'condition' => [
462 'show_log_out_message' => 'yes',
463 ],
464 ] );
465 $this->add_control( 'show_lost_password', [
466 'label' => __( 'Show Lost your password?', 'essential-addons-for-elementor-lite' ),
467 'type' => Controls_Manager::SWITCHER,
468 'default' => 'yes',
469 ] );
470 $this->add_control( 'lost_password_text', [
471 'label' => __( 'Lost Password Text', 'essential-addons-for-elementor-lite' ),
472 'label_block' => true,
473 'type' => Controls_Manager::TEXT,
474 'dynamic' => [
475 'active' => true,
476 ],
477 'default' => __( 'Forgot Password?', 'essential-addons-for-elementor-lite' ),
478 'condition' => [
479 'show_lost_password' => 'yes',
480 ],
481 'ai' => [
482 'active' => true,
483 ],
484 ] );
485 $this->add_control( 'lost_password_link_type', [
486 'label' => __( 'Lost Password Link to', 'essential-addons-for-elementor-lite' ),
487 'label_block' => true,
488 'type' => Controls_Manager::SELECT,
489 'options' => [
490 'default' => __( 'Default WordPress Page', 'essential-addons-for-elementor-lite' ),
491 'custom' => __( 'Custom URL', 'essential-addons-for-elementor-lite' ),
492 'form' => __( 'Show Lost Password Form', 'essential-addons-for-elementor-lite' ),
493 ],
494 'default' => 'default',
495 'condition' => [
496 'show_lost_password' => 'yes',
497 ],
498 ] );
499 $this->add_control( 'lost_password_link_type_notice', [
500 'type' => Controls_Manager::RAW_HTML,
501 'raw' => __( "Note: To use the Reset Password Form enable it from Content » General » Enabled Reset Password Form.", 'essential-addons-for-elementor-lite' ),
502 'content_classes' => 'elementor-panel-alert elementor-panel-alert-info',
503 'condition' => [
504 'lost_password_link_type' => 'form'
505 ]
506 ] );
507 $this->add_control( 'lost_password_url', [
508 'label' => __( 'Custom Lost Password URL', 'essential-addons-for-elementor-lite' ),
509 'label_block' => true,
510 'type' => Controls_Manager::URL,
511 'show_external' => false,
512 'dynamic' => [
513 'active' => true,
514 ],
515 'condition' => [
516 'lost_password_link_type' => 'custom',
517 'show_lost_password' => 'yes',
518 ],
519 ] );
520 $this->add_control( 'login_show_remember_me', [
521 'label' => __( 'Remember Me Field', 'essential-addons-for-elementor-lite' ),
522 'type' => Controls_Manager::SWITCHER,
523 'default' => 'yes',
524 'label_off' => __( 'Hide', 'essential-addons-for-elementor-lite' ),
525 'label_on' => __( 'Show', 'essential-addons-for-elementor-lite' ),
526 ] );
527 $this->add_control( 'remember_text', [
528 'label' => __( 'Remember Me Field Text', 'essential-addons-for-elementor-lite' ),
529 'label_block' => true,
530 'type' => Controls_Manager::TEXT,
531 'dynamic' => [
532 'active' => true,
533 ],
534 'default' => __( 'Remember Me', 'essential-addons-for-elementor-lite' ),
535 'condition' => [
536 'login_show_remember_me' => 'yes',
537 ],
538 'ai' => [
539 'active' => true,
540 ],
541 ] );
542 if ( $this->user_can_register ) {
543 $this->add_control( 'reg_hr', [
544 'type' => Controls_Manager::DIVIDER,
545 ] );
546 $this->add_control( 'show_register_link', [
547 'label' => __( 'Show Register Link', 'essential-addons-for-elementor-lite' ),
548 'type' => Controls_Manager::SWITCHER,
549 'default' => 'yes',
550 'separator' => 'before',
551
552 ] );
553 $this->add_control( 'registration_link_text', [
554 'label' => __( 'Register Link Text', 'essential-addons-for-elementor-lite' ),
555 'label_block' => true,
556 'description' => __( 'You can put text in two lines to make the last line linkable. Pro Tip: You can keep the first line empty and put the text only in the second line to get a link only.', 'essential-addons-for-elementor-lite' ),
557 'type' => Controls_Manager::TEXTAREA,
558 'rows' => 2,
559 'dynamic' => [
560 'active' => true,
561 ],
562 'default' => __( " \nRegister Now", 'essential-addons-for-elementor-lite' ),
563 'condition' => [
564 'show_register_link' => 'yes',
565 ],
566 ] );
567 $this->add_control( 'registration_link_action', [
568 'label' => __( 'Registration Link Action', 'essential-addons-for-elementor-lite' ),
569 'label_block' => true,
570 'type' => Controls_Manager::SELECT,
571 'options' => [
572 'default' => __( 'WordPress Registration Page', 'essential-addons-for-elementor-lite' ),
573 'custom' => __( 'Custom URL', 'essential-addons-for-elementor-lite' ),
574 'form' => __( 'Show Register Form', 'essential-addons-for-elementor-lite' ),
575 ],
576 'default' => 'form',
577 'condition' => [
578 'show_register_link' => 'yes',
579 ],
580 ] );
581 $this->add_control( 'custom_register_url', [
582 'label' => __( 'Custom Register URL', 'essential-addons-for-elementor-lite' ),
583 'label_block' => true,
584 'type' => Controls_Manager::URL,
585 'show_external' => false,
586 'dynamic' => [
587 'active' => true,
588 ],
589 'condition' => [
590 'registration_link_action' => 'custom',
591 'show_register_link' => 'yes',
592 ],
593 ] );
594 } else {
595 $this->add_control( 'show_register_link', [
596 'label' => __( 'Show Register Link', 'essential-addons-for-elementor-lite' ),
597 'type' => Controls_Manager::HIDDEN,
598 'default' => 'no',
599 'separator' => 'before',
600 ] );
601 }
602 $this->end_popover();
603
604
605 /*--show registration related control only if registration is enable on the site--*/
606 if ( $this->user_can_register ) {
607 $this->add_control( 'gen_reg_content_po_toggle', [
608 'label' => __( 'Register Form General', 'essential-addons-for-elementor-lite' ),
609 'type' => Controls_Manager::POPOVER_TOGGLE,
610 'label_off' => __( 'Default', 'essential-addons-for-elementor-lite' ),
611 'label_on' => __( 'Custom', 'essential-addons-for-elementor-lite' ),
612 'return_value' => 'yes',
613 'default' => 'yes',
614 ] );
615 $this->start_popover();
616 $this->add_control( 'show_login_link', [
617 'label' => __( 'Show Login Link', 'essential-addons-for-elementor-lite' ),
618 'type' => Controls_Manager::SWITCHER,
619 'default' => 'yes',
620 ] );
621 $this->add_control( 'login_link_text', [
622 'label' => __( 'Login Link Text', 'essential-addons-for-elementor-lite' ),
623 'label_block' => true,
624 'description' => __( 'You can put text in two lines to make the last line linkable. Pro Tip: You can keep the first line empty and put the text only in the second line to get a link only.', 'essential-addons-for-elementor-lite' ),
625 'type' => Controls_Manager::TEXTAREA,
626 'rows' => 2,
627 'dynamic' => [
628 'active' => true,
629 ],
630 'default' => __( " \nSign In", 'essential-addons-for-elementor-lite' ),
631 'condition' => [
632 'show_login_link' => 'yes',
633 ],
634 ] );
635 $this->add_control( 'login_link_action', [
636 'label' => __( 'Login Link Action', 'essential-addons-for-elementor-lite' ),
637 'label_block' => true,
638 'type' => Controls_Manager::SELECT,
639 'options' => [
640 'default' => __( 'Default WordPress Page', 'essential-addons-for-elementor-lite' ),
641 'custom' => __( 'Custom URL', 'essential-addons-for-elementor-lite' ),
642 'form' => __( 'Show Login Form', 'essential-addons-for-elementor-lite' ),
643 ],
644 'default' => 'form',
645 'condition' => [
646 'show_login_link' => 'yes',
647 ],
648 ] );
649 $this->add_control( 'custom_login_url', [
650 'label' => __( 'Custom Login URL', 'essential-addons-for-elementor-lite' ),
651 'label_block' => true,
652 'show_external' => false,
653 'type' => Controls_Manager::URL,
654 'dynamic' => [
655 'active' => true,
656 ],
657 'condition' => [
658 'login_link_action' => 'custom',
659 'show_login_link' => 'yes',
660 ],
661 ] );
662 do_action( 'eael/login-register/mailchimp-integration', $this );
663 $this->end_popover();
664
665 } else {
666 $this->add_control( 'show_login_link', [
667 'label' => __( 'Show Login Link', 'essential-addons-for-elementor-lite' ),
668 'type' => Controls_Manager::HIDDEN,
669 'default' => 'no',
670 ] );
671 }
672
673 // Lost Password Form general settings starts
674 $this->add_control( 'gen_lostpassword_content_po_toggle', [
675 'label' => __( 'Lost Password Form General', 'essential-addons-for-elementor-lite' ),
676 'type' => Controls_Manager::POPOVER_TOGGLE,
677 'label_off' => __( 'Controls', 'essential-addons-for-elementor-lite' ),
678 'label_on' => __( 'Custom', 'essential-addons-for-elementor-lite' ),
679 'return_value' => 'yes',
680 'default' => 'yes',
681 ] );
682 $this->start_popover();
683 $this->add_control( 'show_login_link_lostpassword', [
684 'label' => __( 'Show Login Link', 'essential-addons-for-elementor-lite' ),
685 'type' => Controls_Manager::SWITCHER,
686 'default' => 'yes',
687 ] );
688 $this->add_control( 'login_link_text_lostpassword', [
689 'label' => __( 'Login Link Text', 'essential-addons-for-elementor-lite' ),
690 'label_block' => true,
691 'description' => __( 'You can put text in two lines to make the last line linkable. Pro Tip: You can keep the first line empty and put the text only in the second line to get a link only.', 'essential-addons-for-elementor-lite' ),
692 'type' => Controls_Manager::TEXTAREA,
693 'rows' => 2,
694 'dynamic' => [
695 'active' => true,
696 ],
697 'default' => __( " \nSign In", 'essential-addons-for-elementor-lite' ),
698 'condition' => [
699 'show_login_link_lostpassword' => 'yes',
700 ],
701 ] );
702 $this->add_control( 'login_link_action_lostpassword', [
703 'label' => __( 'Login Link Action', 'essential-addons-for-elementor-lite' ),
704 'label_block' => true,
705 'type' => Controls_Manager::SELECT,
706 'options' => [
707 'default' => __( 'Default WordPress Page', 'essential-addons-for-elementor-lite' ),
708 'custom' => __( 'Custom URL', 'essential-addons-for-elementor-lite' ),
709 'form' => __( 'Show Login Form', 'essential-addons-for-elementor-lite' ),
710 ],
711 'default' => 'form',
712 'condition' => [
713 'show_login_link_lostpassword' => 'yes',
714 ],
715 ] );
716 $this->add_control( 'custom_login_url_lostpass', [
717 'label' => __( 'Custom Login URL', 'essential-addons-for-elementor-lite' ),
718 'label_block' => true,
719 'show_external' => false,
720 'type' => Controls_Manager::URL,
721 'dynamic' => [
722 'active' => true,
723 ],
724 'condition' => [
725 'login_link_action_lostpassword' => 'custom',
726 'show_login_link_lostpassword' => 'yes',
727 ],
728 ] );
729 $this->end_popover();
730
731 do_action( 'eael/login-register/after-general-controls', $this );
732
733 if ( !$this->pro_enabled ) {
734 $this->add_control( 'enable_ajax', [
735 'label' => sprintf(
736 /* translators: %s: Icon markup indicating Pro feature. */
737 __( 'Submit Form via AJAX %s', 'essential-addons-for-elementor-lite' ),
738 '<i class="eael-pro-labe eicon-pro-icon"></i>'
739 ),
740 'type' => Controls_Manager::SWITCHER,
741 'classes' => 'eael-pro-control',
742 ] );
743
744 $this->add_control( 'enable_webhook', [
745 /* translators: %s: Pro icon */
746 'label' => sprintf( __( 'Enable Webhook %s', 'essential-addons-for-elementor-lite' ), '<i class="eael-pro-labe eicon-pro-icon"></i>' ),
747 'type' => Controls_Manager::SWITCHER,
748 'classes' => 'eael-pro-control',
749 ] );
750 }
751
752 $this->end_controls_section();
753 }
754
755 protected function init_bot_protection_controls() {
756 $this->start_controls_section(
757 'section_content_bot_protection',
758 [
759 'label' => __( 'Bot Protection', 'essential-addons-for-elementor-lite' ),
760 ]
761 );
762
763 $this->add_control(
764 'bot_protection_notice',
765 [
766 'type' => Controls_Manager::NOTICE,
767 'notice_type' => 'info',
768 'content' => esc_html__( 'This helps protect your site from spam form submissions by bots.', 'essential-addons-for-elementor-lite' ),
769 ]
770 );
771
772 $this->add_control(
773 'google_recaptcha_heading',
774 [
775 'label' => __( 'Google reCAPTCHA', 'essential-addons-for-elementor-lite' ),
776 'type' => Controls_Manager::HEADING,
777 ]
778 );
779
780 $this->add_control( 'enable_login_register_recaptcha', [
781 'label' => __( 'Enable', 'essential-addons-for-elementor-lite' ),
782 'type' => Controls_Manager::SWITCHER,
783 'return_value' => 'yes',
784 'default' => 'yes',
785 ] );
786
787 $this->add_control( 'login_register_recaptcha_version', [
788 'label' => __( 'Version', 'essential-addons-for-elementor-lite' ),
789 'label_block' => false,
790 'type' => Controls_Manager::CHOOSE,
791 'toggle' => false,
792 'default' => 'v2',
793 'options' => [
794 'v2' => [
795 'title' => __( 'v2', 'essential-addons-for-elementor-lite' ),
796 'text' => 'v2',
797 ],
798 'v3' => [
799 'title' => __( 'v3', 'essential-addons-for-elementor-lite' ),
800 'text' => 'v3',
801 ],
802 ],
803 'condition' => [
804 'enable_login_register_recaptcha' => 'yes',
805 ],
806 ] );
807
808 $this->add_control( 'login_register_recaptcha_v3_description', [
809 'type' => Controls_Manager::RAW_HTML,
810 'content_classes' => 'elementor-control-field-description',
811 /* translators: %s: HTML paragraph indicating v3 notice. */
812 'raw' => sprintf( '%s',
813 '<p style="margin-top:-15px">' . esc_html__( 'v3 will be applied to all forms. After saving, reload the preview to see the changes.', 'essential-addons-for-elementor-lite' ) . '</p>'
814 ),
815 'condition' => [
816 'login_register_recaptcha_version' => 'v3',
817 'enable_login_register_recaptcha' => 'yes',
818 ],
819 ] );
820
821 $this->add_control(
822 'enable_login_recaptcha_heading',
823 [
824 'label' => __( 'Apply on', 'essential-addons-for-elementor-lite' ),
825 'type' => Controls_Manager::HEADING,
826 'condition' => [
827 'enable_login_register_recaptcha' => 'yes',
828 'login_register_recaptcha_version' => 'v2',
829 ],
830 ]
831 );
832
833 $this->add_control( 'enable_login_recaptcha', [
834 'label' => __( 'Login Form', 'essential-addons-for-elementor-lite' ),
835 'type' => Controls_Manager::SWITCHER,
836 'label_on' => __( 'Yes', 'essential-addons-for-elementor-lite' ),
837 'label_off' => __( 'No', 'essential-addons-for-elementor-lite' ),
838 'return_value' => 'yes',
839 'condition' => [
840 'enable_login_register_recaptcha' => 'yes',
841 'login_register_recaptcha_version' => 'v2',
842 ],
843 ] );
844
845 if( $this->user_can_register ) {
846 $this->add_control( 'enable_register_recaptcha', [
847 'label' => __( 'Registration Form', 'essential-addons-for-elementor-lite' ),
848 'type' => Controls_Manager::SWITCHER,
849 'label_on' => __( 'Yes', 'essential-addons-for-elementor-lite' ),
850 'label_off' => __( 'No', 'essential-addons-for-elementor-lite' ),
851 'return_value' => 'yes',
852 'condition' => [
853 'enable_login_register_recaptcha' => 'yes',
854 'login_register_recaptcha_version' => 'v2',
855 ],
856 ] );
857 }
858
859 $this->add_control( 'enable_lostpassword_recaptcha', [
860 'label' => __( 'Lost Password Form', 'essential-addons-for-elementor-lite' ),
861 'type' => Controls_Manager::SWITCHER,
862 'label_on' => __( 'Yes', 'essential-addons-for-elementor-lite' ),
863 'label_off' => __( 'No', 'essential-addons-for-elementor-lite' ),
864 'return_value' => 'yes',
865 'condition' => [
866 'enable_login_register_recaptcha' => 'yes',
867 'login_register_recaptcha_version' => 'v2',
868 ],
869 ] );
870
871 if ( empty( $this->recaptcha_sitekey ) ) {
872 $this->add_control(
873 'eael_recaptcha_keys_missing', [
874 'type' => Controls_Manager::NOTICE,
875 'notice_type' => 'warning',
876 'heading' => __( 'reCAPTCHA v3 API keys are missing', 'essential-addons-for-elementor-lite' ),
877 'content' => sprintf(
878 /* translators: %1$s: Opening HTML link tag, %2$s: Closing HTML link tag. */
879 __( 'Please add them from %1$sDashboard >> Essential Addons >> Elements >> Login | Register Form%2$s Settings', 'essential-addons-for-elementor-lite' ),
880 '<a href="' . esc_url( site_url( '/wp-admin/admin.php?page=eael-settings#/elements/login-register' ) ) . '" target="_blank"><strong>',
881 '</strong></a>'
882 ),
883 'condition' => [
884 'enable_login_register_recaptcha' => 'yes',
885 'login_register_recaptcha_version' => 'v2',
886 ],
887 ] );
888 }
889
890 if ( empty( $this->recaptcha_sitekey_v3 ) ) {
891 $this->add_control(
892 'eael_recaptcha_keys_missing_v3', [
893 'type' => Controls_Manager::NOTICE,
894 'notice_type' => 'warning',
895 'heading' => __( 'reCAPTCHA v3 API keys are missing', 'essential-addons-for-elementor-lite' ),
896 'content' => sprintf(
897 /* translators: %1$s: Opening HTML link tag, %2$s: Closing HTML link tag. */
898 __( 'Please add them from %1$sDashboard >> Essential Addons >> Elements >> Login | Register Form%2$s Settings', 'essential-addons-for-elementor-lite' ),
899 '<a href="' . esc_url( site_url( '/wp-admin/admin.php?page=eael-settings#/elements/login-register' ) ) . '" target="_blank"><strong>',
900 '</strong></a>'
901 ),
902 'condition' => [
903 'enable_login_register_recaptcha' => 'yes',
904 'login_register_recaptcha_version' => 'v3',
905 ],
906 ] );
907 }
908
909 $this->add_control( 'login_register_recaptcha_v3_score_threshold', [
910 'label' => esc_html__( 'Score Threshold', 'essential-addons-for-elementor-lite' ),
911 'description' => esc_html__( 'By default, you can use a threshold of 0.5.', 'essential-addons-for-elementor-lite' ),
912 'type' => Controls_Manager::SLIDER,
913 'size_units' => [
914 '%',
915 ],
916 'range' => [
917 '%' => [
918 'min' => 0,
919 'max' => 1,
920 'step' => 0.1,
921 ],
922 ],
923 'default' => [
924 'unit' => '%',
925 'size' => 0.5,
926 ],
927 'condition' => [
928 'enable_login_register_recaptcha' => 'yes',
929 'login_register_recaptcha_version' => 'v3',
930 ],
931 ] );
932
933 $this->add_control(
934 'cloudflare_turnstile_heading',
935 [
936 'label' => __( 'Cloudflare Turnstile', 'essential-addons-for-elementor-lite' ),
937 'type' => Controls_Manager::HEADING,
938 'separator' => 'before',
939 ]
940 );
941
942 $this->add_control(
943 'enable_cloudflare_turnstile',
944 [
945 'label' => __( 'Enable', 'essential-addons-for-elementor-lite' ),
946 'type' => Controls_Manager::SWITCHER,
947 'return_value' => 'yes',
948 ] );
949
950 $this->add_control(
951 'enable_cloudflare_turnstile_appearance_notice',
952 [
953 'type' => Controls_Manager::NOTICE,
954 'notice_type' => 'info',
955 'heading' => __( 'Appearance', 'essential-addons-for-elementor-lite' ),
956 'content' => __( 'Cloudflare Turnstile will be applied on frontend only.', 'essential-addons-for-elementor-lite' ),
957 'condition' => [
958 'enable_cloudflare_turnstile' => 'yes',
959 ],
960 ]
961 );
962
963 $this->add_control(
964 'cloudflare_turnstile_theme',
965 [
966 'label' => __( 'Theme', 'essential-addons-for-elementor-lite' ),
967 'type' => Controls_Manager::CHOOSE,
968 'options' => [
969 'auto' => [
970 'title' => __( 'Auto', 'essential-addons-for-elementor-lite' ),
971 'icon' => 'eicon-ai',
972 ],
973 'light' => [
974 'title' => __( 'Light', 'essential-addons-for-elementor-lite' ),
975 'icon' => 'eicon-light-mode',
976 ],
977 'dark' => [
978 'title' => __( 'Dark', 'essential-addons-for-elementor-lite' ),
979 'icon' => 'eicon-dark-mode',
980 ],
981 ],
982 'toggle' => false,
983 'default' => 'auto',
984 'condition' => [
985 'enable_cloudflare_turnstile' => 'yes',
986 ],
987 ]
988 );
989
990
991 if ( empty( $this->cloudflare_turnstile_sitekey ) || empty( $this->cloudflare_turnstile_secretkey ) ) {
992 $this->add_control(
993 'eael_cloudflare_turnstile_keys_missing', [
994 'type' => Controls_Manager::NOTICE,
995 'notice_type' => 'warning',
996 'heading' => __( 'Cloudflare Turnstile Site Key or Secret Key is missing', 'essential-addons-for-elementor-lite' ),
997 'content' => sprintf(
998 /* translators: %1$s: Opening HTML link tag, %2$s: Closing HTML link tag. */
999 __( 'Please add it from %1$sDashboard >> Essential Addons >> Elements >> Login | Register Form%2$s Settings', 'essential-addons-for-elementor-lite' ),
1000 '<a href="' . esc_url( site_url( '/wp-admin/admin.php?page=eael-settings#/elements/login-register' ) ) . '" target="_blank"><strong>',
1001 '</strong></a>'
1002 ),
1003 'condition' => [
1004 'enable_cloudflare_turnstile' => 'yes',
1005 ],
1006 ] );
1007 }
1008
1009 $this->add_control( 'enable_cloudflare_turnstile_heading', [
1010 'label' => __( 'Apply on', 'essential-addons-for-elementor-lite' ),
1011 'type' => Controls_Manager::HEADING,
1012 'condition' => [
1013 'enable_cloudflare_turnstile' => 'yes',
1014 ],
1015 ] );
1016
1017 $this->add_control(
1018 'enable_cloudflare_turnstile_on_login',
1019 [
1020 'label' => __( 'Login Form', 'essential-addons-for-elementor-lite' ),
1021 'type' => Controls_Manager::SWITCHER,
1022 'condition' => [
1023 'enable_cloudflare_turnstile' => 'yes',
1024 ],
1025 ]
1026 );
1027
1028 if( $this->user_can_register ) {
1029 $this->add_control(
1030 'enable_cloudflare_turnstile_on_register',
1031 [
1032 'label' => __( 'Registration Form', 'essential-addons-for-elementor-lite' ),
1033 'type' => Controls_Manager::SWITCHER,
1034 'condition' => [
1035 'enable_cloudflare_turnstile' => 'yes',
1036 ],
1037 ]
1038 );
1039 }
1040
1041 $this->add_control(
1042 'enable_cloudflare_turnstile_on_lostpassword',
1043 [
1044 'label' => __( 'Lost Password Form', 'essential-addons-for-elementor-lite' ),
1045 'type' => Controls_Manager::SWITCHER,
1046 'condition' => [
1047 'enable_cloudflare_turnstile' => 'yes',
1048 ],
1049 ]
1050 );
1051
1052 $this->end_controls_section();
1053 }
1054
1055 /**
1056 * It adds controls related to Login Form Fields section to the Widget Content Tab
1057 */
1058 protected function init_content_login_fields_controls() {
1059 $this->start_controls_section( 'section_content_login_fields', [
1060 'label' => __( 'Login Form Fields', 'essential-addons-for-elementor-lite' ),
1061 'conditions' => $this->get_form_controls_display_condition( 'login' ),
1062 ] );
1063
1064 $this->add_control( 'login_label_types', [
1065 'label' => __( 'Labels & Placeholders', 'essential-addons-for-elementor-lite' ),
1066 'type' => Controls_Manager::SELECT,
1067 'options' => [
1068 'default' => __( 'Default', 'essential-addons-for-elementor-lite' ),
1069 'custom' => __( 'Custom', 'essential-addons-for-elementor-lite' ),
1070 'none' => __( 'Hide', 'essential-addons-for-elementor-lite' ),
1071 ],
1072 'default' => 'default',
1073 ] );
1074
1075 $this->add_control( 'login_labels_heading', [
1076 'label' => __( 'Labels', 'essential-addons-for-elementor-lite' ),
1077 'type' => Controls_Manager::HEADING,
1078 'separator' => 'before',
1079 'condition' => [ 'login_label_types' => 'custom', ],
1080 ] );
1081
1082
1083 $this->add_control( 'login_user_label', [
1084 'label' => __( 'Username Label', 'essential-addons-for-elementor-lite' ),
1085 'placeholder' => __( 'Username or Email Address', 'essential-addons-for-elementor-lite' ),
1086 'default' => __( 'Username or Email Address', 'essential-addons-for-elementor-lite' ),
1087 'type' => Controls_Manager::TEXT,
1088 'dynamic' => [ 'active' => true, ],
1089 'label_block' => true,
1090 'condition' => [ 'login_label_types' => 'custom', ],
1091 'ai' => [
1092 'active' => true,
1093 ],
1094 ] );
1095
1096 $this->add_control( 'login_password_label', [
1097 'label' => __( 'Password Label', 'essential-addons-for-elementor-lite' ),
1098 'placeholder' => __( 'Password', 'essential-addons-for-elementor-lite' ),
1099 'default' => __( 'Password', 'essential-addons-for-elementor-lite' ),
1100 'type' => Controls_Manager::TEXT,
1101 'dynamic' => [ 'active' => true, ],
1102 'label_block' => true,
1103 'condition' => [ 'login_label_types' => 'custom', ],
1104 'ai' => [
1105 'active' => true,
1106 ],
1107 ] );
1108
1109 $this->add_control( 'login_placeholders_heading', [
1110 'label' => esc_html__( 'Placeholders', 'essential-addons-for-elementor-lite' ),
1111 'type' => Controls_Manager::HEADING,
1112 'condition' => [ 'login_label_types' => 'custom', ],
1113 'separator' => 'before',
1114 ] );
1115
1116 $this->add_control( 'login_user_placeholder', [
1117 'label' => __( 'Username Placeholder', 'essential-addons-for-elementor-lite' ),
1118 'placeholder' => __( 'Username or Email Address', 'essential-addons-for-elementor-lite' ),
1119 'default' => __( 'Username or Email Address', 'essential-addons-for-elementor-lite' ),
1120 'type' => Controls_Manager::TEXT,
1121 'dynamic' => [ 'active' => true, ],
1122 'label_block' => true,
1123 'condition' => [ 'login_label_types' => 'custom', ],
1124 'ai' => [
1125 'active' => true,
1126 ],
1127 ] );
1128
1129 $this->add_control( 'login_password_placeholder', [
1130 'label' => __( 'Password Placeholder', 'essential-addons-for-elementor-lite' ),
1131 'placeholder' => __( 'Password', 'essential-addons-for-elementor-lite' ),
1132 'default' => __( 'Password', 'essential-addons-for-elementor-lite' ),
1133 'type' => Controls_Manager::TEXT,
1134 'dynamic' => [ 'active' => true, ],
1135 'label_block' => true,
1136 'condition' => [ 'login_label_types' => 'custom', ],
1137 'ai' => [
1138 'active' => true,
1139 ],
1140 ] );
1141
1142 $this->add_responsive_control( 'login_field_width', [
1143 'label' => esc_html__( 'Input Fields width', 'essential-addons-for-elementor-lite' ),
1144 'type' => Controls_Manager::SLIDER,
1145 'size_units' => [
1146 'px',
1147 '%',
1148 ],
1149 'range' => [
1150 'px' => [
1151 'min' => 0,
1152 'max' => 500,
1153 'step' => 5,
1154 ],
1155 '%' => [
1156 'min' => 0,
1157 'max' => 100,
1158 ],
1159 ],
1160 'default' => [
1161 'unit' => '%',
1162 'size' => 100,
1163 ],
1164 'selectors' => [
1165 '{{WRAPPER}} .eael-login-form .eael-user-login' => 'width: {{SIZE}}{{UNIT}};',
1166 '{{WRAPPER}} .eael-login-form .eael-user-password' => 'width: {{SIZE}}{{UNIT}};',
1167 ],
1168 'separator' => 'before',
1169 ] );
1170
1171 $this->add_control( 'password_toggle', [
1172 'label' => __( 'Password Visibility Icon', 'essential-addons-for-elementor-lite' ),
1173 'type' => Controls_Manager::SWITCHER,
1174 'label_off' => __( 'Hide', 'essential-addons-for-elementor-lite' ),
1175 'label_on' => __( 'Show', 'essential-addons-for-elementor-lite' ),
1176 'default' => 'yes',
1177 ] );
1178 do_action( 'eael/login-register/after-pass-visibility-controls', $this );
1179
1180 $this->add_control( 'login_form_fields_remember_me_heading', [
1181 'label' => esc_html__( 'Remember Me', 'essential-addons-for-elementor-lite' ),
1182 'type' => Controls_Manager::HEADING,
1183 'separator' => 'before',
1184 'condition' => [
1185 'login_show_remember_me' => 'yes',
1186 ]
1187 ] );
1188
1189 $this->add_control( 'login_form_fields_remember_me_checked', [
1190 'label' => __( 'Checked By Default', 'essential-addons-for-elementor-lite' ),
1191 'type' => Controls_Manager::SWITCHER,
1192 'label_off' => __( 'No', 'essential-addons-for-elementor-lite' ),
1193 'label_on' => __( 'Yes', 'essential-addons-for-elementor-lite' ),
1194 'default' => '',
1195 'condition' => [
1196 'login_show_remember_me' => 'yes',
1197 ]
1198 ] );
1199
1200 /*--Login Fields Button--*/
1201 $this->add_control( 'login_button_heading', [
1202 'label' => esc_html__( 'Login Button', 'essential-addons-for-elementor-lite' ),
1203 'type' => Controls_Manager::HEADING,
1204 'separator' => 'before',
1205 ] );
1206
1207 $this->add_control( 'login_button_text', [
1208 'label' => __( 'Text', 'essential-addons-for-elementor-lite' ),
1209 'type' => Controls_Manager::TEXT,
1210 'dynamic' => [ 'active' => true, ],
1211 'default' => __( 'Log In', 'essential-addons-for-elementor-lite' ),
1212 'placeholder' => __( 'Log In', 'essential-addons-for-elementor-lite' ),
1213 'ai' => [
1214 'active' => true,
1215 ],
1216 ] );
1217
1218 $this->add_control(
1219 'login_button_icon',
1220 [
1221 'label' => esc_html__( 'Icon', 'essential-addons-for-elementor-lite' ),
1222 'type' => Controls_Manager::ICONS,
1223 ]
1224 );
1225
1226 $this->add_control(
1227 'login_button_icon_position',
1228 [
1229 'label' => esc_html__( 'Icon Position', 'essential-addons-for-elementor-lite' ),
1230 'type' => Controls_Manager::CHOOSE,
1231 'options' => [
1232 'left' => [
1233 'title' => esc_html__( 'Left', 'essential-addons-for-elementor-lite' ),
1234 'icon' => 'eicon-h-align-left',
1235 ],
1236 'right' => [
1237 'title' => esc_html__( 'Right', 'essential-addons-for-elementor-lite' ),
1238 'icon' => 'eicon-h-align-right',
1239 ],
1240 ],
1241 'default' => 'left',
1242 'toggle' => false,
1243 ]
1244 );
1245
1246 $this->end_controls_section();
1247 }
1248
1249 /**
1250 * It adds controls related to Lost Password Form Fields section to the Widget Content Tab
1251 */
1252 protected function init_content_lostpassword_fields_controls() {
1253 $this->start_controls_section( 'section_content_lostpass_fields', [
1254 'label' => __( 'Lost Password Form Fields', 'essential-addons-for-elementor-lite' ),
1255 'conditions' => [
1256 'relation' => 'or',
1257 'terms' => [
1258 [
1259 'relation' => 'and',
1260 'terms' => [
1261 [
1262 'name' => 'show_lost_password',
1263 'value' => 'yes'
1264 ],
1265 [
1266 'name' => 'lost_password_link_type',
1267 'value' => 'form',
1268 ]
1269 ]
1270 ],
1271 [
1272 'name' => 'default_form_type',
1273 'value' => 'lostpassword',
1274 ]
1275 ],
1276 ],
1277 ] );
1278
1279 $this->add_control( 'lostpassword_label_types', [
1280 'label' => __( 'Label & Placeholder', 'essential-addons-for-elementor-lite' ),
1281 'type' => Controls_Manager::SELECT,
1282 'options' => [
1283 'default' => __( 'Default', 'essential-addons-for-elementor-lite' ),
1284 'custom' => __( 'Custom', 'essential-addons-for-elementor-lite' ),
1285 'none' => __( 'Hide', 'essential-addons-for-elementor-lite' ),
1286 ],
1287 'default' => 'default',
1288 ] );
1289
1290 $this->add_control( 'lostpassword_labels_heading', [
1291 'label' => __( 'Label', 'essential-addons-for-elementor-lite' ),
1292 'type' => Controls_Manager::HEADING,
1293 'separator' => 'before',
1294 'condition' => [ 'lostpassword_label_types' => 'custom', ],
1295 ] );
1296
1297
1298 $this->add_control( 'lostpassword_user_label', [
1299 'label' => __( 'Username Label', 'essential-addons-for-elementor-lite' ),
1300 'placeholder' => __( 'Username or Email Address', 'essential-addons-for-elementor-lite' ),
1301 'default' => __( 'Username or Email Address', 'essential-addons-for-elementor-lite' ),
1302 'type' => Controls_Manager::TEXT,
1303 'dynamic' => [ 'active' => true, ],
1304 'label_block' => true,
1305 'condition' => [ 'lostpassword_label_types' => 'custom', ],
1306 'ai' => [
1307 'active' => true,
1308 ],
1309 ] );
1310
1311 $this->add_control( 'lostpassword_placeholders_heading', [
1312 'label' => esc_html__( 'Placeholder', 'essential-addons-for-elementor-lite' ),
1313 'type' => Controls_Manager::HEADING,
1314 'condition' => [ 'lostpassword_label_types' => 'custom', ],
1315 'separator' => 'before',
1316 ] );
1317
1318 $this->add_control( 'lostpassword_user_placeholder', [
1319 'label' => __( 'Username Placeholder', 'essential-addons-for-elementor-lite' ),
1320 'placeholder' => __( 'Username or Email Address', 'essential-addons-for-elementor-lite' ),
1321 'default' => __( 'Username or Email Address', 'essential-addons-for-elementor-lite' ),
1322 'type' => Controls_Manager::TEXT,
1323 'dynamic' => [ 'active' => true, ],
1324 'label_block' => true,
1325 'condition' => [ 'lostpassword_label_types' => 'custom', ],
1326 'ai' => [
1327 'active' => true,
1328 ],
1329 ] );
1330
1331 $this->add_responsive_control( 'lostpassword_field_width', [
1332 'label' => esc_html__( 'Input Field width', 'essential-addons-for-elementor-lite' ),
1333 'type' => Controls_Manager::SLIDER,
1334 'size_units' => [
1335 'px',
1336 '%',
1337 ],
1338 'range' => [
1339 'px' => [
1340 'min' => 0,
1341 'max' => 500,
1342 'step' => 5,
1343 ],
1344 '%' => [
1345 'min' => 0,
1346 'max' => 100,
1347 ],
1348 ],
1349 'default' => [
1350 'unit' => '%',
1351 'size' => 100,
1352 ],
1353 'selectors' => [
1354 '{{WRAPPER}} .eael-lostpassword-form .eael-lr-form-group' => 'width: {{SIZE}}{{UNIT}};',
1355 ],
1356 'separator' => 'before',
1357 ] );
1358
1359 /*--Lost Password Fields Button--*/
1360 $this->add_control( 'lostpassword_button_heading', [
1361 'label' => esc_html__( 'Lost Password Button', 'essential-addons-for-elementor-lite' ),
1362 'type' => Controls_Manager::HEADING,
1363 'separator' => 'before',
1364 ] );
1365
1366 $this->add_control( 'lostpassword_button_text', [
1367 'label' => __( 'Button Text', 'essential-addons-for-elementor-lite' ),
1368 'type' => Controls_Manager::TEXT,
1369 'dynamic' => [ 'active' => true, ],
1370 'default' => __( 'Reset Password', 'essential-addons-for-elementor-lite' ),
1371 'placeholder' => __( 'Reset Password', 'essential-addons-for-elementor-lite' ),
1372 'ai' => [
1373 'active' => true,
1374 ],
1375 ] );
1376
1377 $this->add_control(
1378 'lost_pass_button_icon',
1379 [
1380 'label' => esc_html__( 'Icon', 'essential-addons-for-elementor-lite' ),
1381 'type' => Controls_Manager::ICONS,
1382 ]
1383 );
1384
1385 $this->add_control(
1386 'lost_pass_button_icon_position',
1387 [
1388 'label' => esc_html__( 'Icon Position', 'essential-addons-for-elementor-lite' ),
1389 'type' => Controls_Manager::CHOOSE,
1390 'options' => [
1391 'left' => [
1392 'title' => esc_html__( 'Left', 'essential-addons-for-elementor-lite' ),
1393 'icon' => 'eicon-h-align-left',
1394 ],
1395 'right' => [
1396 'title' => esc_html__( 'Right', 'essential-addons-for-elementor-lite' ),
1397 'icon' => 'eicon-h-align-right',
1398 ],
1399 ],
1400 'default' => 'left',
1401 'toggle' => false,
1402 ]
1403 );
1404
1405 $this->end_controls_section();
1406 }
1407
1408 /**
1409 * It adds controls related to Reset Password Form Fields section to the Widget Content Tab
1410 */
1411 protected function init_content_resetpassword_fields_controls() {
1412 $this->start_controls_section( 'section_content_resetpass_fields', [
1413 'label' => __( 'Reset Password Form Fields', 'essential-addons-for-elementor-lite' ),
1414 'conditions' => [
1415 'relation' => 'or',
1416 'terms' => [
1417 [
1418 'relation' => 'and',
1419 'terms' => [
1420 [
1421 'name' => 'show_lost_password',
1422 'value' => 'yes'
1423 ],
1424 [
1425 'name' => 'lost_password_link_type',
1426 'value' => 'form',
1427 ]
1428 ]
1429 ],
1430 [
1431 'name' => 'default_form_type',
1432 'value' => 'lostpassword',
1433 ]
1434 ],
1435 ],
1436 ] );
1437
1438 $this->add_control( 'resetpassword_label_types', [
1439 'label' => __( 'Labels & Placeholders', 'essential-addons-for-elementor-lite' ),
1440 'type' => Controls_Manager::SELECT,
1441 'options' => [
1442 'default' => __( 'Default', 'essential-addons-for-elementor-lite' ),
1443 'custom' => __( 'Custom', 'essential-addons-for-elementor-lite' ),
1444 'none' => __( 'Hide', 'essential-addons-for-elementor-lite' ),
1445 ],
1446 'default' => 'default',
1447 ] );
1448
1449 $this->add_control( 'resetpassword_labels_heading', [
1450 'label' => __( 'Labels', 'essential-addons-for-elementor-lite' ),
1451 'type' => Controls_Manager::HEADING,
1452 'separator' => 'before',
1453 'condition' => [ 'resetpassword_label_types' => 'custom', ],
1454 ] );
1455
1456 $this->add_control( 'resetpassword_password_label', [
1457 'label' => __( 'Password Label', 'essential-addons-for-elementor-lite' ),
1458 'placeholder' => __( 'New Password', 'essential-addons-for-elementor-lite' ),
1459 'default' => __( 'New Password', 'essential-addons-for-elementor-lite' ),
1460 'type' => Controls_Manager::TEXT,
1461 'dynamic' => [ 'active' => true, ],
1462 'label_block' => true,
1463 'condition' => [ 'resetpassword_label_types' => 'custom', ],
1464 'ai' => [
1465 'active' => true,
1466 ],
1467 ] );
1468
1469 $this->add_control( 'resetpassword_confirm_password_label', [
1470 'label' => __( 'Confirm Password Label', 'essential-addons-for-elementor-lite' ),
1471 'placeholder' => __( 'Confirm New Password', 'essential-addons-for-elementor-lite' ),
1472 'default' => __( 'Confirm New Password', 'essential-addons-for-elementor-lite' ),
1473 'type' => Controls_Manager::TEXT,
1474 'dynamic' => [ 'active' => true, ],
1475 'label_block' => true,
1476 'condition' => [ 'resetpassword_label_types' => 'custom', ],
1477 'ai' => [
1478 'active' => true,
1479 ],
1480 ] );
1481
1482 $this->add_control( 'resetpassword_placeholders_heading', [
1483 'label' => esc_html__( 'Placeholders', 'essential-addons-for-elementor-lite' ),
1484 'type' => Controls_Manager::HEADING,
1485 'condition' => [ 'resetpassword_label_types' => 'custom', ],
1486 'separator' => 'before',
1487 ] );
1488
1489 $this->add_control( 'resetpassword_password_placeholder', [
1490 'label' => __( 'Password Placeholder', 'essential-addons-for-elementor-lite' ),
1491 'placeholder' => __( 'New Password', 'essential-addons-for-elementor-lite' ),
1492 'default' => __( 'New Password', 'essential-addons-for-elementor-lite' ),
1493 'type' => Controls_Manager::TEXT,
1494 'dynamic' => [ 'active' => true, ],
1495 'label_block' => true,
1496 'condition' => [ 'resetpassword_label_types' => 'custom', ],
1497 'ai' => [
1498 'active' => true,
1499 ],
1500 ] );
1501
1502 $this->add_control( 'resetpassword_confirm_password_placeholder', [
1503 'label' => __( 'Confirm Password Placeholder', 'essential-addons-for-elementor-lite' ),
1504 'placeholder' => __( 'Confirm New Password', 'essential-addons-for-elementor-lite' ),
1505 'default' => __( 'Confirm New Password', 'essential-addons-for-elementor-lite' ),
1506 'type' => Controls_Manager::TEXT,
1507 'dynamic' => [ 'active' => true, ],
1508 'label_block' => true,
1509 'condition' => [ 'resetpassword_label_types' => 'custom', ],
1510 'ai' => [
1511 'active' => true,
1512 ],
1513 ] );
1514
1515 $this->add_responsive_control( 'resetpassword_field_width', [
1516 'label' => esc_html__( 'Input Fields width', 'essential-addons-for-elementor-lite' ),
1517 'type' => Controls_Manager::SLIDER,
1518 'size_units' => [
1519 'px',
1520 '%',
1521 ],
1522 'range' => [
1523 'px' => [
1524 'min' => 0,
1525 'max' => 500,
1526 'step' => 5,
1527 ],
1528 '%' => [
1529 'min' => 0,
1530 'max' => 100,
1531 ],
1532 ],
1533 'default' => [
1534 'unit' => '%',
1535 'size' => 100,
1536 ],
1537 'selectors' => [
1538 '{{WRAPPER}} .eael-resetpassword-form .eael-lr-form-group ' => 'width: {{SIZE}}{{UNIT}};',
1539 ],
1540 'separator' => 'before',
1541 ] );
1542
1543 $this->add_control( 'password_toggle_resetpassword', [
1544 'label' => __( 'Password Visibility Icon', 'essential-addons-for-elementor-lite' ),
1545 'type' => Controls_Manager::SWITCHER,
1546 'label_off' => __( 'Hide', 'essential-addons-for-elementor-lite' ),
1547 'label_on' => __( 'Show', 'essential-addons-for-elementor-lite' ),
1548 'default' => 'yes',
1549 ] );
1550
1551 /*--Reset Password Fields Button--*/
1552 $this->add_control( 'resetpassword_button_heading', [
1553 'label' => esc_html__( 'Reset Password Button', 'essential-addons-for-elementor-lite' ),
1554 'type' => Controls_Manager::HEADING,
1555 'separator' => 'before',
1556 ] );
1557
1558 $this->add_control( 'resetpassword_button_text', [
1559 'label' => __( 'Button Text', 'essential-addons-for-elementor-lite' ),
1560 'type' => Controls_Manager::TEXT,
1561 'dynamic' => [ 'active' => true, ],
1562 'default' => __( 'Save Password', 'essential-addons-for-elementor-lite' ),
1563 'placeholder' => __( 'Save Password', 'essential-addons-for-elementor-lite' ),
1564 'ai' => [
1565 'active' => true,
1566 ],
1567 ] );
1568
1569 $this->end_controls_section();
1570 }
1571
1572 protected function init_content_resetpassword_options_controls() {
1573
1574 $this->start_controls_section( 'section_content_resetpassword_options', [
1575 'label' => __( 'Reset Password Form Options', 'essential-addons-for-elementor-lite' ),
1576 'conditions' => $this->get_form_controls_display_condition( 'resetpassword' ),
1577 ] );
1578
1579 $this->add_control( 'redirect_after_resetpassword', [
1580 'label' => __( 'Redirect After Password Reset', 'essential-addons-for-elementor-lite' ),
1581 'type' => Controls_Manager::SWITCHER,
1582 ] );
1583
1584 global $wp;
1585 $this->add_control( 'redirect_url_resetpassword', [
1586 'type' => Controls_Manager::URL,
1587 'show_label' => false,
1588 'show_external' => false,
1589 'placeholder' => get_permalink( get_the_ID() ),
1590 'description' => __( 'Please note that only your current domain is allowed here to keep your site secure.', 'essential-addons-for-elementor-lite' ),
1591 'condition' => [
1592 'redirect_after_resetpassword' => 'yes',
1593 ],
1594 'default' => [
1595 'url' => get_permalink( get_the_ID() ),
1596 'is_external' => false,
1597 'nofollow' => true,
1598 ],
1599 'separator' => 'after',
1600 ] );
1601
1602 $this->end_controls_section();
1603 }
1604
1605 protected function init_form_header_controls() {
1606 $this->start_controls_section( 'section_content_lr_form_header', [
1607 'label' => __( 'Form Header Content', 'essential-addons-for-elementor-lite' ),
1608 ] );
1609
1610 $this->add_control( 'lr_form_image', [
1611 'label' => __( 'Form Header Image', 'essential-addons-for-elementor-lite' ),
1612 'type' => Controls_Manager::MEDIA,
1613 'dynamic' => [
1614 'active' => true,
1615 ],
1616 'default' => [
1617 'url' => Utils::get_placeholder_image_src(),
1618 ],
1619 'ai' => [
1620 'active' => false,
1621 ],
1622 ] );
1623
1624 $this->add_group_control( Group_Control_Image_Size::get_type(), [
1625 'name' => 'lr_form_image',
1626 // Usage: `{name}_size` and `{name}_custom_dimension`, in this case `image_size` and `image_custom_dimension`.
1627 'default' => 'full',
1628 'separator' => 'none',
1629 ] );
1630
1631 $this->add_control( "lr_form_image_position", [
1632 'label' => __( 'Header Image Position', 'essential-addons-for-elementor-lite' ),
1633 'type' => Controls_Manager::CHOOSE,
1634 'options' => [
1635 'left' => [
1636 'title' => __( 'Left', 'essential-addons-for-elementor-lite' ),
1637 'icon' => 'eicon-arrow-left',
1638 ],
1639 'right' => [
1640 'title' => __( 'Right', 'essential-addons-for-elementor-lite' ),
1641 'icon' => 'eicon-arrow-right',
1642 ],
1643 ],
1644 'default' => 'left',
1645 ] );
1646
1647 $this->add_control( 'show_image_on_lostpassword_form', [
1648 'label' => __( 'Show on Lost Password Form', 'essential-addons-for-elementor-lite' ),
1649 'type' => Controls_Manager::SWITCHER,
1650 'default' => 'yes',
1651 'conditions' => [
1652 'relation' => 'or',
1653 'terms' => [
1654 [
1655 'name' => "show_lost_password",
1656 'value' => 'yes',
1657 ],
1658 [
1659 'name' => 'default_form_type',
1660 'value' => 'lostpassword',
1661 ]
1662 ],
1663 ],
1664 'separator' => 'after',
1665 ] );
1666
1667 $this->add_control( 'lr_form_logo', [
1668 'label' => __( 'Form Header Logo', 'essential-addons-for-elementor-lite' ),
1669 'type' => Controls_Manager::MEDIA,
1670 'dynamic' => [
1671 'active' => true,
1672 ],
1673 'default' => [
1674 'url' => Utils::get_placeholder_image_src(),
1675 ],
1676 'ai' => [
1677 'active' => false,
1678 ],
1679 ] );
1680
1681 $this->add_group_control( Group_Control_Image_Size::get_type(), [
1682 'name' => 'lr_form_logo',
1683 'default' => 'full',
1684 'separator' => 'none',
1685 ] );
1686 $this->add_control( "lr_form_logo_position", [
1687 'label' => __( 'Form Logo Position', 'essential-addons-for-elementor-lite' ),
1688 'type' => Controls_Manager::CHOOSE,
1689 'options' => [
1690 'inline' => [
1691 'title' => __( 'Left', 'essential-addons-for-elementor-lite' ),
1692 'icon' => 'eicon-arrow-left',
1693 ],
1694 'block' => [
1695 'title' => __( 'Top', 'essential-addons-for-elementor-lite' ),
1696 'icon' => 'eicon-arrow-up',
1697 ],
1698 ],
1699 'default' => 'left',
1700 ] );
1701
1702 $this->add_control( 'show_logo_on_lostpassword_form', [
1703 'label' => __( 'Show on Lost Password Form', 'essential-addons-for-elementor-lite' ),
1704 'type' => Controls_Manager::SWITCHER,
1705 'default' => 'yes',
1706 'conditions' => [
1707 'relation' => 'or',
1708 'terms' => [
1709 [
1710 'name' => "show_lost_password",
1711 'value' => 'yes',
1712 ],
1713 [
1714 'name' => 'default_form_type',
1715 'value' => 'lostpassword',
1716 ]
1717 ],
1718 ],
1719 'separator' => 'after',
1720 ] );
1721
1722 $this->add_control( 'login_form_title', [
1723 'label' => __( 'Login Form Title', 'essential-addons-for-elementor-lite' ),
1724 'type' => Controls_Manager::TEXT,
1725 'dynamic' => [ 'active' => true, ],
1726 'placeholder' => __( 'Welcome Back!', 'essential-addons-for-elementor-lite' ),
1727 'separator' => 'before',
1728 'ai' => [
1729 'active' => true,
1730 ],
1731 ] );
1732 $this->add_control( 'login_form_subtitle', [
1733 'label' => __( 'Login Form Sub Title', 'essential-addons-for-elementor-lite' ),
1734 'type' => Controls_Manager::TEXTAREA,
1735 'dynamic' => [ 'active' => true, ],
1736 'placeholder' => __( 'Please login to your account', 'essential-addons-for-elementor-lite' ),
1737 ] );
1738
1739 $this->add_control( 'register_form_title', [
1740 'label' => __( 'Register Form Title', 'essential-addons-for-elementor-lite' ),
1741 'type' => Controls_Manager::TEXT,
1742 'dynamic' => [ 'active' => true, ],
1743 'placeholder' => __( 'Create a New Account', 'essential-addons-for-elementor-lite' ),
1744 'separator' => 'before',
1745 'ai' => [
1746 'active' => true,
1747 ],
1748 ] );
1749 $this->add_control( 'register_form_subtitle', [
1750 'label' => __( 'Register Form Sub Title', 'essential-addons-for-elementor-lite' ),
1751 'type' => Controls_Manager::TEXTAREA,
1752 'dynamic' => [ 'active' => true, ],
1753 'placeholder' => __( 'Create an account to enjoy awesome features.', 'essential-addons-for-elementor-lite' ),
1754 ] );
1755
1756 $this->add_control( 'lostpassword_form_title', [
1757 'label' => __( 'Lost Password Form Title', 'essential-addons-for-elementor-lite' ),
1758 'type' => Controls_Manager::TEXT,
1759 'dynamic' => [ 'active' => true, ],
1760 'placeholder' => __( 'Get New Password', 'essential-addons-for-elementor-lite' ),
1761 'separator' => 'before',
1762 'ai' => [
1763 'active' => true,
1764 ],
1765 ] );
1766 $this->add_control( 'lostpassword_form_subtitle', [
1767 'label' => __( 'Lost Password Form Sub Title', 'essential-addons-for-elementor-lite' ),
1768 'type' => Controls_Manager::TEXTAREA,
1769 'dynamic' => [ 'active' => true, ],
1770 'placeholder' => __( 'Please enter your username or email address. You will receive an email message with instructions on how to reset your password.', 'essential-addons-for-elementor-lite' ),
1771 ] );
1772
1773 $this->add_control( 'resetpassword_form_title', [
1774 'label' => __( 'Reset Password Form Title', 'essential-addons-for-elementor-lite' ),
1775 'type' => Controls_Manager::TEXT,
1776 'dynamic' => [ 'active' => true, ],
1777 'placeholder' => __( 'Reset Password', 'essential-addons-for-elementor-lite' ),
1778 'separator' => 'before',
1779 'ai' => [
1780 'active' => true,
1781 ],
1782 ] );
1783 $this->add_control( 'resetpassword_form_subtitle', [
1784 'label' => __( 'Reset Password Form Sub Title', 'essential-addons-for-elementor-lite' ),
1785 'type' => Controls_Manager::TEXTAREA,
1786 'dynamic' => [ 'active' => true, ],
1787 'placeholder' => __( 'Enter your new password below.', 'essential-addons-for-elementor-lite' ),
1788 ] );
1789
1790 $this->end_controls_section();
1791 }
1792
1793 protected function init_content_login_options_controls() {
1794
1795 $this->start_controls_section( 'section_content_login_options', [
1796 'label' => __( 'Login Form Options', 'essential-addons-for-elementor-lite' ),
1797 'conditions' => $this->get_form_controls_display_condition( 'login' ),
1798 ] );
1799
1800 $this->add_control( 'allow_login_roles', [
1801 'label' => __( 'Allowed User Roles', 'essential-addons-for-elementor-lite' ),
1802 'description' => __( 'Select user roles that are allowed to login. Leave empty to allow all.', 'essential-addons-for-elementor-lite' ),
1803 'type' => Controls_Manager::SELECT2,
1804 'multiple' => true,
1805 'options' => $this->eael_get_role_names(),
1806 'label_block' => true,
1807 ] );
1808
1809 $this->add_control( 'redirect_after_login', [
1810 'label' => __( 'Redirect After Login', 'essential-addons-for-elementor-lite' ),
1811 'type' => Controls_Manager::SWITCHER,
1812 'separator' => 'before',
1813 ] );
1814
1815 $this->add_control( 'redirect_url', [
1816 'type' => Controls_Manager::URL,
1817 'show_label' => false,
1818 'show_external' => false,
1819 'placeholder' => admin_url(),
1820 'condition' => [
1821 'redirect_after_login' => 'yes',
1822 'login_redirect_url_prev_page!' => 'yes',
1823 ],
1824 'default' => [
1825 'url' => admin_url(),
1826 'is_external' => false,
1827 'nofollow' => true,
1828 ],
1829 ] );
1830
1831 $this->add_control( 'redirect_based_on_roles', [
1832 'label' => __( 'Redirect Based On User Roles', 'essential-addons-for-elementor-lite' ),
1833 'type' => Controls_Manager::SWITCHER,
1834 'condition' => [
1835 'redirect_after_login' => 'yes',
1836 ]
1837 ] );
1838
1839 $user_roles = $this->eael_get_role_names();
1840
1841 if( ! empty( $user_roles ) && is_array( $user_roles ) && count( $user_roles ) ){
1842 foreach( $user_roles as $user_role_key => $user_role_value ){
1843 $this->add_control( 'redirect_url_' . esc_html( $user_role_key ), [
1844 'type' => Controls_Manager::URL,
1845 'label' => esc_html( $user_role_value ),
1846 'show_external' => false,
1847 'placeholder' => admin_url(),
1848 'condition' => [
1849 'redirect_after_login' => 'yes',
1850 'redirect_based_on_roles' => 'yes',
1851 ],
1852 ] );
1853 }
1854 }
1855
1856 $this->add_control( 'login_redirect_url_prev_page', [
1857 'label' => __( 'Redirect to Previous Page', 'essential-addons-for-elementor-lite' ),
1858 'description' => __( 'Redirect to the last visited page before login.', 'essential-addons-for-elementor-lite' ),
1859 'type' => Controls_Manager::SWITCHER,
1860 'default' => '',
1861 'condition' => [
1862 'redirect_after_login' => 'yes',
1863 ],
1864 ] );
1865
1866 $this->add_control( 'logout_redirect_url', [
1867 'type' => Controls_Manager::URL,
1868 'label' => __( 'Redirect After Logout', 'essential-addons-for-elementor-lite' ),
1869 'description' => __( 'Leave empty to redirect back to the current page.', 'essential-addons-for-elementor-lite' ),
1870 'show_external' => false,
1871 'separator' => 'before',
1872 'options' => false,
1873 ] );
1874
1875 $this->_init_otp_controls( 'login' );
1876
1877 $this->end_controls_section();
1878 }
1879
1880 /**
1881 * Email OTP Verification controls — shared between login and register sections.
1882 *
1883 * @param string $form_type 'login' or 'register'
1884 */
1885 protected function _init_otp_controls( $form_type = 'login' ) {
1886 $prefix = $form_type; // login | register
1887 $default_subject = sprintf(
1888 /* translators: %s: Site Name */
1889 __( 'Your verification code for %s', 'essential-addons-for-elementor-lite' ),
1890 get_option( 'blogname' )
1891 );
1892 $default_message = __( 'Hello,', 'essential-addons-for-elementor-lite' ) . "\r\n\r\n";
1893 $default_message .= __( 'Your one-time verification code is: [otp_code]', 'essential-addons-for-elementor-lite' ) . "\r\n\r\n";
1894 $default_message .= __( 'This code will expire in [otp_expiry] minutes.', 'essential-addons-for-elementor-lite' ) . "\r\n\r\n";
1895 $default_message .= __( 'You can return to the verification screen here: [direct_login_url]', 'essential-addons-for-elementor-lite' ) . "\r\n\r\n";
1896 $default_message .= __( 'If you did not request this code, you can safely ignore this email.', 'essential-addons-for-elementor-lite' ) . "\r\n\r\n";
1897 $default_message .= __( 'Thanks,', 'essential-addons-for-elementor-lite' ) . "\r\n";
1898 $default_message .= '[sitetitle]';
1899
1900 $this->add_control( "enable_{$prefix}_otp_heading", [
1901 'label' => __( 'Email OTP Verification', 'essential-addons-for-elementor-lite' ),
1902 'type' => Controls_Manager::HEADING,
1903 'separator' => 'before',
1904 ] );
1905
1906 $this->add_control( "enable_{$prefix}_otp", [
1907 'label' => 'login' === $form_type
1908 ? __( 'Enable OTP for Login', 'essential-addons-for-elementor-lite' )
1909 : __( 'Enable OTP for Registration', 'essential-addons-for-elementor-lite' ),
1910 'description' => __( 'Require an email-based one-time password before completing this action.', 'essential-addons-for-elementor-lite' ),
1911 'type' => Controls_Manager::SWITCHER,
1912 'label_on' => __( 'Yes', 'essential-addons-for-elementor-lite' ),
1913 'label_off' => __( 'No', 'essential-addons-for-elementor-lite' ),
1914 'return_value' => 'yes',
1915 'default' => '',
1916 ] );
1917
1918 $this->add_control( "{$prefix}_otp_expiry", [
1919 'label' => __( 'OTP Expiry Time (minutes)', 'essential-addons-for-elementor-lite' ),
1920 'type' => Controls_Manager::NUMBER,
1921 'min' => 1,
1922 'max' => 60,
1923 'step' => 1,
1924 'default' => 5,
1925 'condition' => [
1926 "enable_{$prefix}_otp" => 'yes',
1927 ],
1928 ] );
1929
1930 $this->add_control( "{$prefix}_otp_resend_cooldown", [
1931 'label' => __( 'Resend Cooldown (seconds)', 'essential-addons-for-elementor-lite' ),
1932 'description' => __( 'Minimum number of seconds before a user can request a new OTP.', 'essential-addons-for-elementor-lite' ),
1933 'type' => Controls_Manager::NUMBER,
1934 'min' => 15,
1935 'max' => 600,
1936 'step' => 5,
1937 'default' => 60,
1938 'condition' => [
1939 "enable_{$prefix}_otp" => 'yes',
1940 ],
1941 ] );
1942
1943 $this->add_control( "{$prefix}_otp_email_subject", [
1944 'label' => __( 'Email Subject', 'essential-addons-for-elementor-lite' ),
1945 'type' => Controls_Manager::TEXT,
1946 'placeholder' => $default_subject,
1947 'default' => $default_subject,
1948 'label_block' => true,
1949 'render_type' => 'none',
1950 'condition' => [
1951 "enable_{$prefix}_otp" => 'yes',
1952 ],
1953 'ai' => [
1954 'active' => true,
1955 ],
1956 ] );
1957
1958 $this->add_control( "{$prefix}_otp_email_message", [
1959 'label' => __( 'Email Message', 'essential-addons-for-elementor-lite' ),
1960 'type' => Controls_Manager::WYSIWYG,
1961 'placeholder' => __( 'Enter Your Custom Email Message..', 'essential-addons-for-elementor-lite' ),
1962 'default' => $default_message,
1963 'label_block' => true,
1964 'render_type' => 'none',
1965 'condition' => [
1966 "enable_{$prefix}_otp" => 'yes',
1967 ],
1968 ] );
1969
1970 $this->add_control( "{$prefix}_otp_email_content_note", [
1971 'type' => Controls_Manager::RAW_HTML,
1972 'raw' => __( '<strong>Note:</strong> Available tags are: [otp_code], [otp_expiry], [email], [sitetitle], [direct_login_url]. In HTML emails [direct_login_url] expands to a clickable link; in plain emails it expands to the bare URL. The link automatically carries an <code>?eael_otp=&lt;token&gt;</code> query arg so it works from any browser or device.', 'essential-addons-for-elementor-lite' ),
1973 'content_classes' => 'elementor-panel-alert elementor-panel-alert-info',
1974 'condition' => [
1975 "enable_{$prefix}_otp" => 'yes',
1976 ],
1977 'render_type' => 'none',
1978 ] );
1979
1980 $this->add_control( "{$prefix}_otp_email_content_type", [
1981 'label' => __( 'Email Content Type', 'essential-addons-for-elementor-lite' ),
1982 'type' => Controls_Manager::SELECT,
1983 'default' => 'html',
1984 'render_type' => 'none',
1985 'options' => [
1986 'html' => __( 'HTML', 'essential-addons-for-elementor-lite' ),
1987 'plain' => __( 'Plain', 'essential-addons-for-elementor-lite' ),
1988 ],
1989 'condition' => [
1990 "enable_{$prefix}_otp" => 'yes',
1991 ],
1992 ] );
1993
1994 $this->add_control( "{$prefix}_otp_title_text", [
1995 'label' => __( 'OTP Form Title', 'essential-addons-for-elementor-lite' ),
1996 'type' => Controls_Manager::TEXT,
1997 'default' => __( 'Verify Your Email', 'essential-addons-for-elementor-lite' ),
1998 'label_block' => true,
1999 'condition' => [
2000 "enable_{$prefix}_otp" => 'yes',
2001 ],
2002 ] );
2003
2004 $this->add_control( "{$prefix}_otp_subtitle_text", [
2005 'label' => __( 'OTP Form Subtitle', 'essential-addons-for-elementor-lite' ),
2006 'type' => Controls_Manager::TEXTAREA,
2007 'default' => __( 'We have sent a 6-digit verification code to your email. Please enter it below to continue.', 'essential-addons-for-elementor-lite' ),
2008 'label_block' => true,
2009 'condition' => [
2010 "enable_{$prefix}_otp" => 'yes',
2011 ],
2012 ] );
2013
2014 $this->add_control( "{$prefix}_otp_verify_button_text", [
2015 'label' => __( 'Verify Button Text', 'essential-addons-for-elementor-lite' ),
2016 'type' => Controls_Manager::TEXT,
2017 'default' => __( 'Verify', 'essential-addons-for-elementor-lite' ),
2018 'condition' => [
2019 "enable_{$prefix}_otp" => 'yes',
2020 ],
2021 ] );
2022
2023 $this->add_control( "{$prefix}_otp_resend_text", [
2024 'label' => __( 'Resend Link Text', 'essential-addons-for-elementor-lite' ),
2025 'type' => Controls_Manager::TEXT,
2026 'default' => __( 'Resend Code', 'essential-addons-for-elementor-lite' ),
2027 'condition' => [
2028 "enable_{$prefix}_otp" => 'yes',
2029 ],
2030 ] );
2031
2032 // Register-only: an admin-side switcher that flips OTP register behavior to
2033 // "create user immediately + mark as pending until verified", and surfaces the
2034 // flag in wp-admin → Users.
2035 if ( 'register' === $prefix ) {
2036 $users_list_link = esc_url( admin_url( 'users.php' ) );
2037 $flag_description = sprintf(
2038 /* translators: %1$s: link to wp-admin users.php */
2039 __( 'When enabled, new sign-ups are created immediately and marked as <em>email verification pending</em>. Pending users appear with a flag at <a href="%1$s" target="_blank" rel="noopener">%1$s</a>. The flag is removed automatically on successful OTP verification.', 'essential-addons-for-elementor-lite' ),
2040 $users_list_link
2041 );
2042
2043 $this->add_control( 'register_otp_show_user_flag', [
2044 'label' => __( 'Show Flag on User list', 'essential-addons-for-elementor-lite' ),
2045 'description' => $flag_description,
2046 'type' => Controls_Manager::SWITCHER,
2047 'label_on' => __( 'Yes', 'essential-addons-for-elementor-lite' ),
2048 'label_off' => __( 'No', 'essential-addons-for-elementor-lite' ),
2049 'return_value' => 'yes',
2050 'default' => '',
2051 'separator' => 'before',
2052 'condition' => [
2053 "enable_{$prefix}_otp" => 'yes',
2054 ],
2055 ] );
2056 }
2057 }
2058
2059 /**
2060 * Returns the active OTP flow ('login' | 'register') for this widget on the current request,
2061 * or empty string if no OTP challenge is in flight.
2062 *
2063 * Sources, in priority order:
2064 * 1. Editor "Preview OTP Field" switcher (editor only) — register wins if both are on.
2065 * 2. ?eael_otp=<token>&eael_otp_flow=<login|register> URL params (clicked email link).
2066 * 3. eael_lr_otp_token_<wid> cookie (same-device fallback).
2067 *
2068 * When this returns non-empty, EVERY form section other than the matching one must be
2069 * suppressed so the user only sees the OTP wrapper.
2070 *
2071 * @return string '' | 'login' | 'register'
2072 */
2073 protected function eael_otp_active_flow() {
2074 // Editor preview — only honored inside the editor canvas. Single global switcher
2075 // (`otp_preview`) drives both login and register; we resolve which form's OTP UI to
2076 // reveal by picking the currently-visible form (default form first, then any form
2077 // with OTP enabled).
2078 if ( $this->in_editor && ! empty( $this->ds['otp_preview'] ) && 'yes' === $this->ds['otp_preview'] ) {
2079 $default = isset( $this->ds['default_form_type'] ) ? $this->ds['default_form_type'] : '';
2080 $login_enabled = ! empty( $this->ds['enable_login_otp'] ) && 'yes' === $this->ds['enable_login_otp'];
2081 $register_enabled = ! empty( $this->ds['enable_register_otp'] ) && 'yes' === $this->ds['enable_register_otp'];
2082
2083 if ( 'register' === $default && $register_enabled ) {
2084 return 'register';
2085 }
2086 if ( 'login' === $default && $login_enabled ) {
2087 return 'login';
2088 }
2089 if ( $register_enabled ) {
2090 return 'register';
2091 }
2092 if ( $login_enabled ) {
2093 return 'login';
2094 }
2095 }
2096
2097 //phpcs:ignore WordPress.Security.NonceVerification.Recommended
2098 if ( ! empty( $_GET['eael_otp'] ) && ! empty( $_GET['eael_otp_flow'] ) ) {
2099 //phpcs:ignore WordPress.Security.NonceVerification.Recommended
2100 $flow = sanitize_text_field( wp_unslash( $_GET['eael_otp_flow'] ) );
2101 if ( 'login' === $flow || 'register' === $flow ) {
2102 return $flow;
2103 }
2104 }
2105
2106 $cookie_name = 'eael_lr_otp_token_' . $this->get_id();
2107 if ( ! empty( $_COOKIE[ $cookie_name ] ) ) {
2108 $cookie_value = sanitize_text_field( wp_unslash( $_COOKIE[ $cookie_name ] ) );
2109 if ( strpos( $cookie_value, '|' ) !== false ) {
2110 list( , $cookie_flow ) = array_map( 'sanitize_text_field', explode( '|', $cookie_value, 2 ) );
2111 if ( 'login' === $cookie_flow || 'register' === $cookie_flow ) {
2112 return $cookie_flow;
2113 }
2114 }
2115 }
2116
2117 return '';
2118 }
2119
2120 /**
2121 * Should the OTP UI be force-shown for this form on the current request?
2122 *
2123 * Returns true when:
2124 * - the user is in the Elementor editor and toggled the Preview switcher on, OR
2125 * - a non-AJAX OTP challenge is in flight (the OTP cookie is present for this widget+flow).
2126 *
2127 * The Preview switcher is intentionally honored only inside the editor, so even if the
2128 * value is persisted in the database it has zero effect on the live frontend.
2129 *
2130 * @param string $form_type 'login' or 'register'
2131 * @return bool
2132 */
2133 protected function eael_otp_should_force_show( $form_type ) {
2134 // The pending-registration intercept in log_user_in() sets an OTP cookie using flow='login'
2135 // even when enable_login_otp is off. We must honour that cookie so the page-reload path
2136 // (non-AJAX) also shows the OTP UI and prevents a flash of the login form.
2137 return $this->eael_otp_active_flow() === $form_type;
2138 }
2139
2140 public function eael_get_role_names() {
2141
2142 global $wp_roles;
2143
2144 if ( ! isset( $wp_roles ) )
2145 $wp_roles = new WP_Roles();
2146
2147 return $wp_roles->get_names();
2148 }
2149
2150 protected function social_login_promo() {
2151
2152 $this->start_controls_section( 'section_content_social_login', [
2153 'label' => __( 'Social Login', 'essential-addons-for-elementor-lite' ),
2154 'conditions' => $this->get_form_controls_display_condition( 'login' ),
2155 ] );
2156
2157 $this->add_control( 'enable_google_login', [
2158 'label' => sprintf(
2159 /* translators: %s: Icon markup indicating Pro feature. */
2160 __( 'Enable Login with Google %s', 'essential-addons-for-elementor-lite' ),
2161 '<i class="eael-pro-labe eicon-pro-icon"></i>'
2162 ),
2163 'type' => Controls_Manager::SWITCHER,
2164 'classes' => 'eael-pro-control',
2165 ] );
2166
2167 $this->add_control( 'enable_fb_login', [
2168 'label' => sprintf(
2169 /* translators: %s: Icon markup indicating Pro feature. */
2170 __( 'Enable Login with Facebook %s', 'essential-addons-for-elementor-lite' ),
2171 '<i class="eael-pro-labe eicon-pro-icon"></i>'
2172 ),
2173 'type' => Controls_Manager::SWITCHER,
2174 'classes' => 'eael-pro-control',
2175 ] );
2176
2177 $this->end_controls_section();
2178 }
2179
2180 protected function init_content_terms_controls() {
2181 $this->start_controls_section( 'section_content_terms_conditions', [
2182 'label' => __( 'Terms & Conditions', 'essential-addons-for-elementor-lite' ),
2183 'conditions' => $this->get_form_controls_display_condition( 'register' ),
2184 ] );
2185
2186 $this->add_control( 'show_terms_conditions', [
2187 'label' => __( 'Enforce Terms & Conditions', 'essential-addons-for-elementor-lite' ),
2188 'type' => Controls_Manager::SWITCHER,
2189 'label_on' => __( 'Yes', 'essential-addons-for-elementor-lite' ),
2190 'label_off' => __( 'No', 'essential-addons-for-elementor-lite' ),
2191 'default' => 'no',
2192 'return_value' => 'yes',
2193 ] );
2194
2195 $this->add_control( 'eael_terms_conditions_field_type', [
2196 'label' => __( 'Field Type', 'essential-addons-for-elementor-lite' ),
2197 'type' => Controls_Manager::SELECT,
2198 'default' => 'toggle',
2199 'options' => [
2200 'toggle' => __( 'Toggle', 'essential-addons-for-elementor-lite' ),
2201 'checkbox' => __( 'Checkbox', 'essential-addons-for-elementor-lite' ),
2202 ],
2203 'condition' => [
2204 'show_terms_conditions' => 'yes',
2205 ],
2206 ] );
2207
2208 $this->add_control( 'acceptance_label', [
2209 'label' => __( 'Acceptance Label', 'essential-addons-for-elementor-lite' ),
2210 'description' => __( 'Eg. I accept the terms & conditions. Note: First line is checkbox label & Last line will be used as link text.', 'essential-addons-for-elementor-lite' ),
2211 'type' => Controls_Manager::TEXTAREA,
2212 'rows' => 2,
2213 'label_block' => true,
2214 'placeholder' => __( 'I Accept the Terms and Conditions.', 'essential-addons-for-elementor-lite' ),
2215 /* translators: \n means new line. So, Don't translate this*/
2216 'default' => __( "I Accept\n the Terms and Conditions.", 'essential-addons-for-elementor-lite' ),
2217 'condition' => [
2218 'show_terms_conditions' => 'yes',
2219 ],
2220 ] );
2221
2222 $this->add_control( 'acceptance_text_source', [
2223 'label' => __( 'Content Source', 'essential-addons-for-elementor-lite' ),
2224 'type' => Controls_Manager::SELECT,
2225 'options' => [
2226 'editor' => __( 'Editor', 'essential-addons-for-elementor-lite' ),
2227 'custom' => __( 'Custom', 'essential-addons-for-elementor-lite' ),
2228 ],
2229 'default' => 'custom',
2230 'condition' => [
2231 'show_terms_conditions' => 'yes',
2232 ],
2233 ] );
2234
2235 $this->add_control( 'acceptance_text', [
2236 'label' => __( 'Terms and Conditions', 'essential-addons-for-elementor-lite' ),
2237 'type' => Controls_Manager::WYSIWYG,
2238 'rows' => 3,
2239 'default' => __( 'Please go through the following terms and conditions carefully.', 'essential-addons-for-elementor-lite' ),
2240 'condition' => [
2241 'show_terms_conditions' => 'yes',
2242 'acceptance_text_source' => 'editor',
2243 ],
2244 ] );
2245
2246 $terms_conditions_url = get_the_permalink( get_option( 'wp_page_for_privacy_policy' ) );
2247
2248 $this->add_control( 'acceptance_text_url', [
2249 'label' => __( 'Terms & Conditions URL', 'essential-addons-for-elementor-lite' ),
2250 'description' => __( 'Enter the link where your terms & condition or privacy policy is found.', 'essential-addons-for-elementor-lite' ),
2251 'type' => Controls_Manager::URL,
2252 'dynamic' => [
2253 'active' => true,
2254 ],
2255 'default' => [
2256 'url' => ! empty( $terms_conditions_url ) && 'false' !== $terms_conditions_url ? $terms_conditions_url : '',
2257 'is_external' => true,
2258 'nofollow' => true,
2259 ],
2260 'condition' => [
2261 'show_terms_conditions' => 'yes',
2262 'acceptance_text_source' => 'custom',
2263 ],
2264 ] );
2265
2266 $this->end_controls_section();
2267 }
2268
2269 protected function init_content_validation_messages_controls() {
2270 $this->start_controls_section( 'section_content_errors', [
2271 'label' => __( 'Validation Messages', 'essential-addons-for-elementor-lite' ),
2272 ] );
2273
2274 $this->start_controls_tabs( 'error_messages_tabs' );
2275
2276 $this->start_controls_tab(
2277 'error_messages_tab_msg',
2278 [
2279 'label' => esc_html__( 'Messages', 'essential-addons-for-elementor-lite' ),
2280 ]
2281 );
2282
2283 $this->add_control( 'err_message_heading', [
2284 'label' => esc_html__( 'Error Messages', 'essential-addons-for-elementor-lite' ),
2285 'type' => Controls_Manager::HEADING,
2286 ] );
2287
2288 $this->add_control( 'err_email', [
2289 'label' => __( 'Invalid Email', 'essential-addons-for-elementor-lite' ),
2290 'type' => Controls_Manager::TEXT,
2291 'label_block' => true,
2292 'placeholder' => __( 'Eg. Your email is invalid.', 'essential-addons-for-elementor-lite' ),
2293 'default' => __( "You have used an invalid email", 'essential-addons-for-elementor-lite' ),
2294 'ai' => [
2295 'active' => true,
2296 ],
2297 ] );
2298 $this->add_control( 'err_email_missing', [
2299 'label' => __( 'Email is missing', 'essential-addons-for-elementor-lite' ),
2300 'type' => Controls_Manager::TEXT,
2301 'label_block' => true,
2302 'placeholder' => __( 'Eg. Email is missing or Invalid', 'essential-addons-for-elementor-lite' ),
2303 'default' => __( 'Email is missing or Invalid', 'essential-addons-for-elementor-lite' ),
2304 'ai' => [
2305 'active' => true,
2306 ],
2307 ] );
2308 $this->add_control( 'err_email_used', [
2309 'label' => __( 'Already Used Email', 'essential-addons-for-elementor-lite' ),
2310 'type' => Controls_Manager::TEXT,
2311 'label_block' => true,
2312 'placeholder' => __( 'Eg. Your email is already in use..', 'essential-addons-for-elementor-lite' ),
2313 'default' => __( 'The provided email is already registered with other account. Please login or reset password or use another email.', 'essential-addons-for-elementor-lite' ),
2314 'ai' => [
2315 'active' => true,
2316 ],
2317 ] );
2318 $this->add_control( 'err_username', [
2319 'label' => __( 'Invalid Username', 'essential-addons-for-elementor-lite' ),
2320 'type' => Controls_Manager::TEXT,
2321 'label_block' => true,
2322 'placeholder' => __( 'Eg. Your username is invalid.', 'essential-addons-for-elementor-lite' ),
2323 'default' => __( "You have used an invalid username", 'essential-addons-for-elementor-lite' ),
2324 'ai' => [
2325 'active' => true,
2326 ],
2327 ] );
2328 $this->add_control( 'err_username_used', [
2329 'label' => __( 'Username already in use', 'essential-addons-for-elementor-lite' ),
2330 'type' => Controls_Manager::TEXT,
2331 'label_block' => true,
2332 'placeholder' => __( 'Eg. Your username is already registered.', 'essential-addons-for-elementor-lite' ),
2333 'default' => __( 'Invalid username provided or the username already registered.', 'essential-addons-for-elementor-lite' ),
2334 'ai' => [
2335 'active' => true,
2336 ],
2337 ] );
2338 $this->add_control( 'err_pass', [
2339 'label' => __( 'Invalid Password', 'essential-addons-for-elementor-lite' ),
2340 'type' => Controls_Manager::TEXT,
2341 'label_block' => true,
2342 'placeholder' => __( 'Eg. Your password is invalid', 'essential-addons-for-elementor-lite' ),
2343 'default' => __( "Your password is invalid.", 'essential-addons-for-elementor-lite' ),
2344 'ai' => [
2345 'active' => true,
2346 ],
2347 ] );
2348
2349 $this->add_control( 'err_conf_pass', [
2350 'label' => __( 'Invalid Password Confirmed', 'essential-addons-for-elementor-lite' ),
2351 'type' => Controls_Manager::TEXT,
2352 'label_block' => true,
2353 'placeholder' => __( 'Eg. Password did not matched', 'essential-addons-for-elementor-lite' ),
2354 'default' => __( "Your confirmed password did not match", 'essential-addons-for-elementor-lite' ),
2355 'ai' => [
2356 'active' => true,
2357 ],
2358 ] );
2359
2360 $this->add_control( 'err_loggedin', [
2361 'label' => __( 'Already Logged In', 'essential-addons-for-elementor-lite' ),
2362 'type' => Controls_Manager::TEXT,
2363 'label_block' => true,
2364 'placeholder' => __( 'Eg. You are already logged in', 'essential-addons-for-elementor-lite' ),
2365 'default' => __( "You are already logged in", 'essential-addons-for-elementor-lite' ),
2366 'ai' => [
2367 'active' => true,
2368 ],
2369 ] );
2370
2371 $this->add_control( 'err_recaptcha', [
2372 'label' => __( 'reCAPTCHA Failed', 'essential-addons-for-elementor-lite' ),
2373 'type' => Controls_Manager::TEXT,
2374 'label_block' => true,
2375 'placeholder' => __( 'Eg. reCAPTCHA Validation Failed', 'essential-addons-for-elementor-lite' ),
2376 'default' => __( "You did not pass reCAPTCHA challenge.", 'essential-addons-for-elementor-lite' ),
2377 'ai' => [
2378 'active' => true,
2379 ],
2380 'condition' => [
2381 'enable_recaptcha' => 'yes',
2382 ],
2383 ] );
2384
2385 $this->add_control( 'err_cloudflare_turnstile', [
2386 'label' => __( 'Cloudflare Turnstile Failed', 'essential-addons-for-elementor-lite' ),
2387 'type' => Controls_Manager::TEXT,
2388 'label_block' => true,
2389 'placeholder' => __( 'Eg. Cloudflare Turnstile Validation Failed', 'essential-addons-for-elementor-lite' ),
2390 'default' => __( "You did not pass Cloudflare Turnstile challenge.", 'essential-addons-for-elementor-lite' ),
2391 'ai' => [
2392 'active' => true,
2393 ],
2394 'condition' => [
2395 'enable_cloudflare_turnstile' => 'yes',
2396 ],
2397 ] );
2398
2399 $this->add_control( 'err_reset_password_key_expired', [
2400 'label' => __( 'Reset Password Expired Error', 'essential-addons-for-elementor-lite' ),
2401 'type' => Controls_Manager::TEXT,
2402 'label_block' => true,
2403 'placeholder' => __( 'Eg. Your password reset link appears to be invalid. Please request a new link.', 'essential-addons-for-elementor-lite' ),
2404 'default' => __( 'Your password reset link appears to be invalid. Please request a new link.', 'essential-addons-for-elementor-lite' ),
2405 'ai' => [
2406 'active' => true,
2407 ],
2408 ] );
2409
2410 $this->add_control( 'err_tc', [
2411 'label' => __( 'Terms & Condition Error', 'essential-addons-for-elementor-lite' ),
2412 'type' => Controls_Manager::TEXT,
2413 'label_block' => true,
2414 'placeholder' => __( 'Eg. You must accept the Terms & Conditions', 'essential-addons-for-elementor-lite' ),
2415 'default' => __( 'You did not accept the Terms and Conditions. Please accept it and try again.', 'essential-addons-for-elementor-lite' ),
2416 'ai' => [
2417 'active' => true,
2418 ],
2419 ] );
2420
2421 $this->add_control( 'err_unknown', [
2422 'label' => __( 'Other Errors', 'essential-addons-for-elementor-lite' ),
2423 'type' => Controls_Manager::TEXT,
2424 'label_block' => true,
2425 'placeholder' => __( 'Eg. Something went wrong', 'essential-addons-for-elementor-lite' ),
2426 'default' => __( "Something went wrong!", 'essential-addons-for-elementor-lite' ),
2427 'ai' => [
2428 'active' => true,
2429 ],
2430 ] );
2431
2432 $this->add_control( 'err_restricted_role', [
2433 'label' => __( 'Restricted Role Error', 'essential-addons-for-elementor-lite' ),
2434 'type' => Controls_Manager::TEXT,
2435 'label_block' => true,
2436 'placeholder' => __( 'Eg. You are not allowed to login from here.', 'essential-addons-for-elementor-lite' ),
2437 'default' => __( "You are not allowed to login from here.", 'essential-addons-for-elementor-lite' ),
2438 'ai' => [
2439 'active' => true,
2440 ],
2441 ] );
2442
2443 $this->add_control( 'err_phone_number_missing', [
2444 'label' => __( 'Phone number is missing', 'essential-addons-for-elementor-lite' ),
2445 'type' => Controls_Manager::TEXT,
2446 'label_block' => true,
2447 'placeholder' => __( 'Phone number is missing', 'essential-addons-for-elementor-lite' ),
2448 'default' => __( 'Phone number is missing', 'essential-addons-for-elementor-lite' ),
2449 'ai' => [
2450 'active' => true,
2451 ],
2452 ] );
2453
2454 $this->add_control( 'err_phone_number_invalid', [
2455 'label' => __( 'Invalid phone number provided', 'essential-addons-for-elementor-lite' ),
2456 'type' => Controls_Manager::TEXT,
2457 'label_block' => true,
2458 'placeholder' => __( 'Invalid phone number provided', 'essential-addons-for-elementor-lite' ),
2459 'default' => __( 'Invalid phone number provided', 'essential-addons-for-elementor-lite' ),
2460 'ai' => [
2461 'active' => true,
2462 ],
2463 ] );
2464
2465 $this->add_control( 'success_message_heading', [
2466 'label' => esc_html__( 'Success Messages', 'essential-addons-for-elementor-lite' ),
2467 'type' => Controls_Manager::HEADING,
2468 'separator' => 'before',
2469 ] );
2470
2471 $this->add_control( 'success_login', [
2472 'label' => __( 'Successful Login', 'essential-addons-for-elementor-lite' ),
2473 'type' => Controls_Manager::TEXT,
2474 'label_block' => true,
2475 'placeholder' => __( 'Eg. You have logged in successfully', 'essential-addons-for-elementor-lite' ),
2476 'default' => __( "You have logged in successfully", 'essential-addons-for-elementor-lite' ),
2477 'ai' => [
2478 'active' => true,
2479 ],
2480 ] );
2481 $this->add_control( 'success_register', [
2482 'label' => __( 'Successful Registration', 'essential-addons-for-elementor-lite' ),
2483 'type' => Controls_Manager::TEXTAREA,
2484 'default' => __( 'Registration completed successfully, Check your inbox for password if you did not provided while registering.', 'essential-addons-for-elementor-lite' ),
2485 'placeholder' => __( 'eg. Registration completed successfully', 'essential-addons-for-elementor-lite' ),
2486 ] );
2487 $this->add_control( 'success_lostpassword', [
2488 'label' => __( 'Lost Password Form Success', 'essential-addons-for-elementor-lite' ),
2489 'type' => Controls_Manager::TEXTAREA,
2490 'default' => __( 'Check your email for the confirmation link.', 'essential-addons-for-elementor-lite' ),
2491 'placeholder' => __( 'eg. Check your email for the confirmation link.', 'essential-addons-for-elementor-lite' ),
2492 ] );
2493 $this->add_control( 'success_resetpassword', [
2494 'label' => __( 'Successful Password Reset', 'essential-addons-for-elementor-lite' ),
2495 'type' => Controls_Manager::TEXTAREA,
2496 'default' => __( 'Your password has been reset.', 'essential-addons-for-elementor-lite' ),
2497 'placeholder' => __( 'eg. Your password has been reset.', 'essential-addons-for-elementor-lite' ),
2498 ] );
2499
2500 $this->end_controls_tab();
2501
2502 $this->start_controls_tab(
2503 'error_messages_tab_msg_position',
2504 [
2505 'label' => esc_html__( 'Position', 'essential-addons-for-elementor-lite' ),
2506 ]
2507 );
2508
2509 $this->add_control(
2510 'error_messages_position_heading',
2511 [
2512 'label' => esc_html__( 'Set Error Message Position For', 'essential-addons-for-elementor-lite' ),
2513 'type' => Controls_Manager::HEADING,
2514 ]
2515 );
2516
2517 $this->add_control(
2518 'err_message_position_login',
2519 [
2520 'label' => esc_html__( 'Login', 'essential-addons-for-elementor-lite' ),
2521 'type' => Controls_Manager::CHOOSE,
2522 'options' => [
2523 'top' => [
2524 'title' => esc_html__( 'Top', 'essential-addons-for-elementor-lite' ),
2525 'icon' => 'eicon-v-align-top',
2526 ],
2527 'bottom' => [
2528 'title' => esc_html__( 'Bottom', 'essential-addons-for-elementor-lite' ),
2529 'icon' => 'eicon-v-align-bottom',
2530 ],
2531 ],
2532 'default' => 'bottom',
2533 'toggle' => false,
2534 ]
2535 );
2536
2537 $this->add_control(
2538 'err_message_position_registration',
2539 [
2540 'label' => esc_html__( 'Registration', 'essential-addons-for-elementor-lite' ),
2541 'type' => Controls_Manager::CHOOSE,
2542 'options' => [
2543 'top' => [
2544 'title' => esc_html__( 'Top', 'essential-addons-for-elementor-lite' ),
2545 'icon' => 'eicon-v-align-top',
2546 ],
2547 'bottom' => [
2548 'title' => esc_html__( 'Bottom', 'essential-addons-for-elementor-lite' ),
2549 'icon' => 'eicon-v-align-bottom',
2550 ],
2551 ],
2552 'default' => 'bottom',
2553 'toggle' => false,
2554 ]
2555 );
2556
2557 $this->add_control(
2558 'err_message_position_lostpassword',
2559 [
2560 'label' => esc_html__( 'Forget Password', 'essential-addons-for-elementor-lite' ),
2561 'type' => Controls_Manager::CHOOSE,
2562 'options' => [
2563 'top' => [
2564 'title' => esc_html__( 'Top', 'essential-addons-for-elementor-lite' ),
2565 'icon' => 'eicon-v-align-top',
2566 ],
2567 'bottom' => [
2568 'title' => esc_html__( 'Bottom', 'essential-addons-for-elementor-lite' ),
2569 'icon' => 'eicon-v-align-bottom',
2570 ],
2571 ],
2572 'default' => 'bottom',
2573 'toggle' => false,
2574 ]
2575 );
2576
2577 $this->add_control(
2578 'err_message_position_reset',
2579 [
2580 'label' => esc_html__( 'Reset Password', 'essential-addons-for-elementor-lite' ),
2581 'type' => Controls_Manager::CHOOSE,
2582 'options' => [
2583 'top' => [
2584 'title' => esc_html__( 'Top', 'essential-addons-for-elementor-lite' ),
2585 'icon' => 'eicon-v-align-top',
2586 ],
2587 'bottom' => [
2588 'title' => esc_html__( 'Bottom', 'essential-addons-for-elementor-lite' ),
2589 'icon' => 'eicon-v-align-bottom',
2590 ],
2591 ],
2592 'default' => 'bottom',
2593 'toggle' => false,
2594 ]
2595 );
2596
2597 $this->end_controls_tab();
2598
2599 $this->end_controls_tabs();
2600
2601 $this->end_controls_section();
2602 }
2603
2604 protected function show_pro_promotion(){
2605
2606 $this->start_controls_section(
2607 'eael_section_pro',
2608 [
2609 'label' => __( 'Go Premium for More Features', 'essential-addons-for-elementor-lite' ),
2610 ]
2611 );
2612
2613 $this->add_control(
2614 'eael_control_get_pro',
2615 [
2616 'label' => __( 'Unlock more possibilities', 'essential-addons-for-elementor-lite' ),
2617 'type' => Controls_Manager::CHOOSE,
2618 'options' => [
2619 '1' => [
2620 'title' => '',
2621 'icon' => 'fa fa-unlock-alt',
2622 ],
2623 ],
2624 'default' => '1',
2625 'description' => '<span class="pro-feature"> Get the <a href="https://wpdeveloper.com/upgrade/ea-pro" target="_blank">Pro version</a> for more stunning elements and customization options.</span>',
2626 ]
2627 );
2628
2629 $this->end_controls_section();
2630
2631 }
2632
2633 /**
2634 * Renders a cross-promo section for the Bit Integrations plugin.
2635 *
2636 * Only registered when Bit Integrations is NOT active on the site
2637 * (detected via WP.org slug `bit-integrations/bit-integrations.php`).
2638 *
2639 * @see https://wordpress.org/plugins/bit-integrations/
2640 * @see https://bit-integrations.com/wp-docs/trigger/essential-addons-for-elementor-integration/
2641 *
2642 * @return void
2643 */
2644 protected function bit_integrations_promo() {
2645 if ( ! function_exists( 'is_plugin_active' ) ) {
2646 include_once ABSPATH . 'wp-admin/includes/plugin.php';
2647 }
2648
2649 // Bit Integrations main file is `bitwpfi.php` (not `bit-integrations.php` despite the slug).
2650 if ( is_plugin_active( 'bit-integrations/bitwpfi.php' ) ) {
2651 return;
2652 }
2653
2654 $this->start_controls_section(
2655 'eael_section_bit_integrations_promo',
2656 [
2657 'label' => __( 'Connect & Automate', 'essential-addons-for-elementor-lite' ),
2658 ]
2659 );
2660
2661 $promo = '<div class="eael-bit-integrations-promo">';
2662 $promo .= '<div class="eael-bit-integrations-promo__title">' . esc_html__( 'Connect Your Login/Register Form to 174+ Platforms with Bit Integrations', 'essential-addons-for-elementor-lite' ) . '</div>';
2663 $promo .= '<div class="eael-bit-integrations-promo__message">' . esc_html__( 'Send Login/Register submissions to Google Sheets, ActiveCampaign, HubSpot, CRMs, and beyond. Bit Integrations turns every form submission into an automation trigger with conditional logic and custom field mapping.', 'essential-addons-for-elementor-lite' ) . '</div>';
2664 $promo .= '<a class="eael-bit-integrations-promo__cta" href="' . esc_url( 'https://bitapps.pro/?r=12133&target_site=https%3A%2F%2Fbit-integrations.com' ) . '" target="_blank" rel="noopener noreferrer nofollow">' . esc_html__( 'Explore Bit Integrations', 'essential-addons-for-elementor-lite' ) . ' &rarr;</a>';
2665 $promo .= '</div>';
2666
2667 $this->add_control(
2668 'eael_bit_integrations_promo_notice',
2669 [
2670 'type' => Controls_Manager::RAW_HTML,
2671 'raw' => $promo,
2672 ]
2673 );
2674
2675 $this->end_controls_section();
2676 }
2677
2678 protected function init_content_register_fields_controls() {
2679 $custom_fields_image = array_keys( $this->get_eael_custom_profile_fields( 'image' ) );
2680
2681 $this->start_controls_section( 'section_content_register_fields', [
2682 'label' => __( 'Register Form Fields', 'essential-addons-for-elementor-lite' ),
2683 'conditions' => $this->get_form_controls_display_condition( 'register' ),
2684 ] );
2685 $this->add_control( 'register_form_field_note', [
2686 'type' => Controls_Manager::RAW_HTML,
2687 'raw' => sprintf(
2688 /* translators: %s: Link to the Login Register Form Settings page. */
2689 __( 'Select the type of fields you want to show in the registration form. You can enable custom fields from EA Dashboard » Elements » %s.', 'essential-addons-for-elementor-lite' ),
2690 '<a href="' . esc_url( site_url('/wp-admin/admin.php?page=eael-settings#/elements/login-register') ) . '" target="_blank">Login Register Form Settings</a>'
2691 ),
2692 'content_classes' => 'elementor-panel-alert elementor-panel-alert-info',
2693 ] );
2694 $repeater = new Repeater();
2695
2696 $repeater->add_control( 'field_type', [
2697 'label' => __( 'Type', 'essential-addons-for-elementor-lite' ),
2698 'type' => Controls_Manager::SELECT,
2699 'options' => $this->get_form_field_types(),
2700 'default' => 'first_name',
2701 ] );
2702
2703 $repeater->add_control( 'field_type_custom_image_note', [
2704 'type' => Controls_Manager::RAW_HTML,
2705 'raw' => __( 'File upload will not work if AJAX submission is enabled.', 'essential-addons-for-elementor-lite' ),
2706 'condition' => [
2707 'field_type' => array_keys( $this->get_eael_custom_profile_fields( 'image' ) ),
2708 ],
2709 'content_classes' => 'eael-warning',
2710 ] );
2711
2712 $repeater->add_control( 'field_label', [
2713 'label' => __( 'Label', 'essential-addons-for-elementor-lite' ),
2714 'type' => Controls_Manager::TEXT,
2715 'default' => '',
2716 'dynamic' => [
2717 'active' => true,
2718 ],
2719 'ai' => [
2720 'active' => true,
2721 ],
2722 ] );
2723
2724 $repeater->add_control( 'field_type_custom_image_extensions', [
2725 'label' => __( 'File Extensions', 'essential-addons-for-elementor-lite' ),
2726 'description' => __('Only extensions that is permitted on WordPress.', 'essential-addons-for-elementor-lite'),
2727 'type' => Controls_Manager::TEXT,
2728 'default' => '',
2729 'placeholder' => '.png, .jpg, .jpeg',
2730 'dynamic' => [
2731 'active' => true,
2732 ],
2733 'condition' => [
2734 'field_type' => $custom_fields_image,
2735 ],
2736 ] );
2737
2738 $repeater->add_control(
2739 'field_type_custom_image_filename_length',
2740 [
2741 'label' => __('Max Filename Length', 'essential-addons-for-elementor-lite'),
2742 'type' => Controls_Manager::NUMBER,
2743 'placeholder' => '128',
2744 'default' => '128',
2745 'min' => '1',
2746 'max' => '128',
2747 'condition' => [
2748 'field_type' => $custom_fields_image,
2749 ],
2750 ]
2751 );
2752
2753 $max_file_size = wp_max_upload_size();
2754 if( $max_file_size ){
2755 $max_file_size = $max_file_size / 1048576; //(1024x1024=1048576)
2756 }
2757
2758 $repeater->add_control(
2759 'field_type_custom_image_filesize',
2760 [
2761 'label' => __('Max File Size (MB)', 'essential-addons-for-elementor-lite'),
2762 'description' => sprintf(
2763 // translators: %s is the maximum file size
2764 __('Set max file size up to %s MB.', 'essential-addons-for-elementor-lite'), $max_file_size ),
2765 'type' => Controls_Manager::NUMBER,
2766 'placeholder' => '5',
2767 'default' => '5',
2768 'Min' => '1',
2769 'Max' => $max_file_size,
2770 'condition' => [
2771 'field_type' => $custom_fields_image,
2772 ],
2773 ]
2774 );
2775
2776 $repeater->add_control( 'placeholder', [
2777 'label' => __( 'Placeholder', 'essential-addons-for-elementor-lite' ),
2778 'type' => Controls_Manager::TEXT,
2779 'default' => '',
2780 'dynamic' => [
2781 'active' => true,
2782 ],
2783 'condition' => [
2784 'field_type!' => array_merge( $custom_fields_image, ['honeypot'] ),
2785 ],
2786 'ai' => [
2787 'active' => true,
2788 ],
2789 ] );
2790
2791 $repeater->add_control( 'required', [
2792 'label' => __( 'Required', 'essential-addons-for-elementor-lite' ),
2793 'type' => Controls_Manager::SWITCHER,
2794 'condition' => [
2795 'field_type!' => [
2796 'email',
2797 'password',
2798 'confirm_pass',
2799 'honeypot'
2800 ],
2801 ],
2802 ] );
2803
2804 $repeater->add_control( 'required_note', [
2805 'type' => Controls_Manager::RAW_HTML,
2806 'raw' => __( 'Note: This field is required by default.', 'essential-addons-for-elementor-lite' ),
2807 'condition' => [
2808 'field_type' => [
2809 'email',
2810 'password',
2811 'confirm_pass',
2812 ],
2813 ],
2814 'content_classes' => 'elementor-panel-alert elementor-panel-alert-info',
2815 ] );
2816
2817 $repeater->add_control( 'show_on_my_account', [
2818 'label' => __( 'On My Account Dashboard', 'essential-addons-for-elementor-lite' ),
2819 'type' => Controls_Manager::SWITCHER,
2820 'default' => 'no',
2821 'description' => __( 'When enabled, this field will appear on the WooCommerce "Account Details" page so users can view and update their submitted data after registration.', 'essential-addons-for-elementor-lite' ),
2822 'condition' => [
2823 'field_type!' => [ ...$custom_fields_image, 'password', 'confirm_pass' ],
2824 ],
2825 ] );
2826
2827 $repeater->add_responsive_control( 'width', [
2828 'label' => __( 'Field Width', 'essential-addons-for-elementor-lite' ),
2829 'type' => Controls_Manager::SLIDER,
2830 'size_units' => [ 'px', '%' ],
2831 'range' => [
2832 'px' => [
2833 'min' => 0,
2834 'max' => 1000,
2835 'step' => 5,
2836 ],
2837 '%' => [
2838 'min' => 0,
2839 'max' => 100,
2840 ],
2841 ],
2842 'default' => [
2843 'unit' => '%',
2844 'size' => 100,
2845 ],
2846 'selectors' => [
2847 '{{WRAPPER}} {{CURRENT_ITEM}}' => 'width: {{SIZE}}{{UNIT}};',
2848 ],
2849 'condition' => [
2850 'field_type!' => [
2851 'honeypot'
2852 ],
2853 ],
2854 ] );
2855 apply_filters( 'eael/login-register/register-repeater', $repeater );
2856 $rf = [
2857 'label' => __( 'Fields', 'essential-addons-for-elementor-lite' ),
2858 'type' => Controls_Manager::REPEATER,
2859 'fields' => apply_filters( 'eael/login-register/register-repeater-fields', $repeater->get_controls() ),
2860 'default' => apply_filters( 'eael/login-register/register-rf-default', [
2861 [
2862 'field_type' => 'user_name',
2863 'field_label' => __( 'Username', 'essential-addons-for-elementor-lite' ),
2864 'placeholder' => __( 'Username', 'essential-addons-for-elementor-lite' ),
2865 ],
2866 [
2867 'field_type' => 'email',
2868 'field_label' => __( 'Email', 'essential-addons-for-elementor-lite' ),
2869 'placeholder' => __( 'Email', 'essential-addons-for-elementor-lite' ),
2870 'required' => 'yes',
2871 ],
2872 [
2873 'field_type' => 'password',
2874 'field_label' => __( 'Password', 'essential-addons-for-elementor-lite' ),
2875 'placeholder' => __( 'Password', 'essential-addons-for-elementor-lite' ),
2876 'required' => 'yes',
2877 ],
2878 ] ),
2879 'title_field' => '{{ field_label }}',
2880 ];
2881 if ( $this->pro_enabled ) {
2882 $rf['title_field'] = '{{{ elementor.helpers.renderIcon( this, icon, {}, "i", "panel" ) || \'<i class="{{ icon }}" aria-hidden="true"></i>\' }}} {{ field_label }}';
2883 }
2884 $this->add_control( 'register_fields', $rf );
2885
2886 $this->add_control( 'show_labels', [
2887 'label' => __( 'Show Label', 'essential-addons-for-elementor-lite' ),
2888 'type' => Controls_Manager::SWITCHER,
2889 'default' => 'yes',
2890 ] );
2891
2892 $this->add_control( 'mark_required', [
2893 'label' => __( 'Show Required Mark', 'essential-addons-for-elementor-lite' ),
2894 'type' => Controls_Manager::SWITCHER,
2895 'condition' => [
2896 'show_labels' => 'yes',
2897 ],
2898 ] );
2899
2900 $this->add_control( 'password_toggle_register', [
2901 'label' => __( 'Password Visibility Icon', 'essential-addons-for-elementor-lite' ),
2902 'type' => Controls_Manager::SWITCHER,
2903 'label_off' => __( 'Hide', 'essential-addons-for-elementor-lite' ),
2904 'label_on' => __( 'Show', 'essential-addons-for-elementor-lite' ),
2905 'default' => '',
2906 ] );
2907
2908 do_action( 'eael/login-register/after-register-options-controls', $this );
2909
2910 /*--Register Fields Button--*/
2911 $this->add_control( 'reg_button_heading', [
2912 'label' => esc_html__( 'Register Button', 'essential-addons-for-elementor-lite' ),
2913 'type' => Controls_Manager::HEADING,
2914 'separator' => 'before',
2915 ] );
2916
2917 $this->add_control( 'reg_button_text', [
2918 'label' => __( 'Button Text', 'essential-addons-for-elementor-lite' ),
2919 'type' => Controls_Manager::TEXT,
2920 'dynamic' => [ 'active' => true, ],
2921 'default' => __( 'Register', 'essential-addons-for-elementor-lite' ),
2922 'ai' => [
2923 'active' => true,
2924 ],
2925 ] );
2926
2927 $this->add_control(
2928 'reg_button_icon',
2929 [
2930 'label' => esc_html__( 'Icon', 'essential-addons-for-elementor-lite' ),
2931 'type' => Controls_Manager::ICONS,
2932 ]
2933 );
2934
2935 $this->add_control(
2936 'reg_button_icon_position',
2937 [
2938 'label' => esc_html__( 'Icon Position', 'essential-addons-for-elementor-lite' ),
2939 'type' => Controls_Manager::CHOOSE,
2940 'options' => [
2941 'left' => [
2942 'title' => esc_html__( 'Left', 'essential-addons-for-elementor-lite' ),
2943 'icon' => 'eicon-h-align-left',
2944 ],
2945 'right' => [
2946 'title' => esc_html__( 'Right', 'essential-addons-for-elementor-lite' ),
2947 'icon' => 'eicon-h-align-right',
2948 ],
2949 ],
2950 'default' => 'left',
2951 'toggle' => false,
2952 ]
2953 );
2954
2955 $this->end_controls_section();
2956 }
2957
2958 protected function init_content_register_options_controls() {
2959
2960 $this->start_controls_section( 'section_content_register_actions', [
2961 'label' => __( 'Register Form Options', 'essential-addons-for-elementor-lite' ),
2962 'conditions' => $this->get_form_controls_display_condition( 'register' ),
2963 ] );
2964
2965 $this->add_control( 'register_action', [
2966 'label' => __( 'Register Actions', 'essential-addons-for-elementor-lite' ),
2967 'description' => __( 'You can select what should happen after a user registers successfully', 'essential-addons-for-elementor-lite' ),
2968 'type' => Controls_Manager::SELECT2,
2969 'multiple' => true,
2970 'label_block' => true,
2971 'default' => 'send_email',
2972 'options' => [
2973 'redirect' => __( 'Redirect', 'essential-addons-for-elementor-lite' ),
2974 'auto_login' => __( 'Auto Login', 'essential-addons-for-elementor-lite' ),
2975 'send_email' => __( 'Notify User By Email', 'essential-addons-for-elementor-lite' ),
2976 ],
2977 ] );
2978
2979 $this->add_control( 'register_redirect_url', [
2980 'type' => Controls_Manager::URL,
2981 'label' => __( 'Custom Redirect URL', 'essential-addons-for-elementor-lite' ),
2982 'show_external' => false,
2983 'placeholder' => __( 'eg. https://your-link.com/wp-admin/', 'essential-addons-for-elementor-lite' ),
2984 'description' => __( 'Please note that only your current domain is allowed here to keep your site secure.', 'essential-addons-for-elementor-lite' ),
2985 'default' => [
2986 'url' => get_admin_url(),
2987 'is_external' => false,
2988 'nofollow' => true,
2989 ],
2990 'condition' => [
2991 'register_action' => 'redirect',
2992 'register_redirect_url_prev_page!' => 'yes'
2993 ],
2994 ] );
2995
2996 $this->add_control( 'register_redirect_url_prev_page', [
2997 'label' => __( 'Redirect to Previous Page', 'essential-addons-for-elementor-lite' ),
2998 'description' => __( 'Redirect to the last visited page before registration.', 'essential-addons-for-elementor-lite' ),
2999 'type' => Controls_Manager::SWITCHER,
3000 'default' => '',
3001 'condition' => [
3002 'register_action' => 'redirect',
3003 ],
3004 ] );
3005
3006 if ( current_user_can( 'administrator' ) ) {
3007 $user_role = $this->get_user_roles();
3008 } else {
3009 $user_role = [
3010 '' => __( 'Default', 'essential-addons-for-elementor-lite' ),
3011 ];
3012 }
3013
3014 $this->add_control( 'register_user_role', [
3015 'label' => __( 'New User Role', 'essential-addons-for-elementor-lite' ),
3016 'type' => Controls_Manager::SELECT,
3017 'default' => '',
3018 'options' => $user_role,
3019 'separator' => 'before',
3020 ] );
3021
3022 $this->_init_otp_controls( 'register' );
3023
3024 $this->end_controls_section();
3025 }
3026
3027 protected function init_content_register_user_email_controls() {
3028 /* translators: %s: Site Name */
3029 $default_subject = sprintf( __( 'Thank you for registering on "%s"!', 'essential-addons-for-elementor-lite' ), get_option( 'blogname' ) );
3030 $default_message = $default_subject . "\r\n\r\n";
3031 $default_message .= __( 'Username: [username]', 'essential-addons-for-elementor-lite' ) . "\r\n\r\n";
3032 $default_message .= __( 'Password: [password]', 'essential-addons-for-elementor-lite' ) . "\r\n\r\n";
3033 $default_message .= __( 'To reset your password, visit the following address:', 'essential-addons-for-elementor-lite' ) . "\r\n\r\n";
3034 $default_message .= "[password_reset_link]\r\n\r\n";
3035 $default_message .= __( 'Please click the following address to login to your account:', 'essential-addons-for-elementor-lite' ) . "\r\n\r\n";
3036 $default_message .= wp_login_url() . "\r\n";
3037
3038 $this->start_controls_section( 'section_content_reg_email', [
3039 'label' => __( 'Register User Email Options', 'essential-addons-for-elementor-lite' ),
3040 'conditions' => [
3041 'relation' => 'or',
3042 'terms' => [
3043 [
3044 'name' => 'show_register_link',
3045 'value' => 'yes',
3046 //@TODO; debug why multi-level condition is not working.
3047 //'relation' => 'and',
3048 //'terms' => [
3049 // [
3050 // 'name' => 'register_action',
3051 // 'value' => 'send_email',
3052 // 'operator' => '===',
3053 // ],
3054 //],
3055 ],
3056 [
3057 'name' => 'default_form_type',
3058 'value' => 'register',
3059 //'relation' => 'and',
3060 //'terms' => [
3061 // [
3062 // 'name' => 'register_action',
3063 // 'value' => 'send_email',
3064 // 'operator' => '===',
3065 // ],
3066 //],
3067 ],
3068 ],
3069 ],
3070 ] );
3071
3072 $this->add_control( 'reg_email_template_type', [
3073 'label' => __( 'Email Template Type', 'essential-addons-for-elementor-lite' ),
3074 'description' => __( 'Default template uses WordPress Default email template. So, please select the Custom Option to send the user proper information if you used any username field.', 'essential-addons-for-elementor-lite' ),
3075 'type' => Controls_Manager::SELECT,
3076 'default' => 'default',
3077 'render_type' => 'none',
3078 'options' => [
3079 'default' => __( 'WordPres Default', 'essential-addons-for-elementor-lite' ),
3080 'custom' => __( 'Custom', 'essential-addons-for-elementor-lite' ),
3081 ],
3082 ] );
3083
3084 $this->add_control( 'reg_email_subject', [
3085 'label' => __( 'Email Subject', 'essential-addons-for-elementor-lite' ),
3086 'type' => Controls_Manager::TEXT,
3087 'placeholder' => $default_subject,
3088 'default' => $default_subject,
3089 'label_block' => true,
3090 'render_type' => 'none',
3091 'condition' => [
3092 'reg_email_template_type' => 'custom',
3093 ],
3094 'ai' => [
3095 'active' => true,
3096 ],
3097 ] );
3098
3099 $this->add_control( 'reg_email_message', [
3100 'label' => __( 'Email Message', 'essential-addons-for-elementor-lite' ),
3101 'type' => Controls_Manager::WYSIWYG,
3102 'placeholder' => __( 'Enter Your Custom Email Message..', 'essential-addons-for-elementor-lite' ),
3103 'default' => $default_message,
3104 'label_block' => true,
3105 'render_type' => 'none',
3106 'condition' => [
3107 'reg_email_template_type' => 'custom',
3108 ],
3109 ] );
3110
3111 $this->add_control( 'reg_email_content_note', [
3112 'type' => Controls_Manager::RAW_HTML,
3113 'raw' => __( '<strong>Note:</strong> You can use dynamic content in the email body like [fieldname]. For example [username] will be replaced by user-typed username. Available tags are: [password], [username], [email], [firstname],[lastname], [website], [loginurl], [password_reset_link], [eael_phone_number] and [sitetitle]. <br>For custom profile fields use slug of the field name e.x. [my_custom_field_1]', 'essential-addons-for-elementor-lite' ),
3114 'content_classes' => 'elementor-panel-alert elementor-panel-alert-info',
3115 'condition' => [
3116 'reg_email_template_type' => 'custom',
3117 ],
3118 'render_type' => 'none',
3119 ] );
3120
3121 $this->add_control( 'reg_email_content_type', [
3122 'label' => __( 'Email Content Type', 'essential-addons-for-elementor-lite' ),
3123 'type' => Controls_Manager::SELECT,
3124 'default' => 'html',
3125 'render_type' => 'none',
3126 'options' => [
3127 'html' => __( 'HTML', 'essential-addons-for-elementor-lite' ),
3128 'plain' => __( 'Plain', 'essential-addons-for-elementor-lite' ),
3129 ],
3130 'condition' => [
3131 'reg_email_template_type' => 'custom',
3132 ],
3133 ] );
3134
3135 $this->end_controls_section();
3136 }
3137
3138 protected function init_content_register_admin_email_controls() {
3139 /* translators: %s: Site Name */
3140 $default_subject = sprintf( __( '["%s"] New User Registration', 'essential-addons-for-elementor-lite' ), get_option( 'blogname' ) );
3141 /* translators: %s: Site Name */
3142 $default_message = sprintf( __( "New user registration on your site %s", 'essential-addons-for-elementor-lite' ), get_option( 'blogname' ) ) . "\r\n\r\n";
3143 $default_message .= __( 'Username: [username]', 'essential-addons-for-elementor-lite' ) . "\r\n\r\n";
3144 $default_message .= __( 'Email: [email]', 'essential-addons-for-elementor-lite' ) . "\r\n\r\n";
3145
3146
3147 $this->start_controls_section( 'section_content_reg_admin_email', [
3148 'label' => __( 'Register Admin Email Options', 'essential-addons-for-elementor-lite' ),
3149 'conditions' => [
3150 'relation' => 'or',
3151 'terms' => [
3152 [
3153 'name' => 'show_register_link',
3154 'value' => 'yes',
3155 //@TODO; debug why multi-level condition is not working.
3156 //'relation' => 'and',
3157 //'terms' => [
3158 // [
3159 // 'name' => 'register_action',
3160 // 'value' => 'send_email',
3161 // 'operator' => '===',
3162 // ],
3163 //],
3164 ],
3165 [
3166 'name' => 'default_form_type',
3167 'value' => 'register',
3168 //'relation' => 'and',
3169 //'terms' => [
3170 // [
3171 // 'name' => 'register_action',
3172 // 'value' => 'send_email',
3173 // 'operator' => '===',
3174 // ],
3175 //],
3176 ],
3177 ],
3178 ],
3179 ] );
3180
3181 $this->add_control( 'reg_admin_email_template_type', [
3182 'label' => __( 'Email Template Type', 'essential-addons-for-elementor-lite' ),
3183 'description' => __( 'Default template uses WordPress Default Admin email template. You can customize it by choosing the custom option.', 'essential-addons-for-elementor-lite' ),
3184 'type' => Controls_Manager::SELECT,
3185 'default' => 'default',
3186 'render_type' => 'none',
3187 'options' => [
3188 'default' => __( 'WordPres Default', 'essential-addons-for-elementor-lite' ),
3189 'custom' => __( 'Custom', 'essential-addons-for-elementor-lite' ),
3190 ],
3191 ] );
3192
3193 $this->add_control( 'reg_admin_email_subject', [
3194 'label' => __( 'Email Subject', 'essential-addons-for-elementor-lite' ),
3195 'type' => Controls_Manager::TEXT,
3196 'placeholder' => $default_subject,
3197 'default' => $default_subject,
3198 'label_block' => true,
3199 'render_type' => 'none',
3200 'condition' => [
3201 'reg_admin_email_template_type' => 'custom',
3202 ],
3203 'ai' => [
3204 'active' => true,
3205 ],
3206 ] );
3207
3208 $this->add_control( 'reg_admin_email_message', [
3209 'label' => __( 'Email Message', 'essential-addons-for-elementor-lite' ),
3210 'type' => Controls_Manager::WYSIWYG,
3211 'placeholder' => __( 'Enter Your Custom Email Message..', 'essential-addons-for-elementor-lite' ),
3212 'default' => $default_message,
3213 'label_block' => true,
3214 'render_type' => 'none',
3215 'condition' => [
3216 'reg_admin_email_template_type' => 'custom',
3217 ],
3218 ] );
3219
3220 $this->add_control( 'reg_admin_email_content_note', [
3221 'type' => Controls_Manager::RAW_HTML,
3222 'raw' => __( '<strong>Note:</strong> You can use dynamic content in the email body like [fieldname]. For example [username] will be replaced by user-typed username. Available tags are: [username], [email], [firstname],[lastname], [website], [loginurl], [eael_phone_number] and [sitetitle]. <br>For custom profile fields use slug of the field name e.x. [my_custom_field_1]', 'essential-addons-for-elementor-lite' ),
3223 'content_classes' => 'elementor-panel-alert elementor-panel-alert-info',
3224 'condition' => [
3225 'reg_admin_email_template_type' => 'custom',
3226 ],
3227 'render_type' => 'none',
3228 ] );
3229
3230 $this->add_control( 'reg_admin_email_content_type', [
3231 'label' => __( 'Email Content Type', 'essential-addons-for-elementor-lite' ),
3232 'type' => Controls_Manager::SELECT,
3233 'default' => 'html',
3234 'render_type' => 'none',
3235 'options' => [
3236 'html' => __( 'HTML', 'essential-addons-for-elementor-lite' ),
3237 'plain' => __( 'Plain', 'essential-addons-for-elementor-lite' ),
3238 ],
3239 'condition' => [
3240 'reg_admin_email_template_type' => 'custom',
3241 ],
3242 ] );
3243
3244 $this->end_controls_section();
3245 }
3246
3247 protected function init_content_lostpassword_user_email_controls() {
3248 /* translators: %s: Site Name */
3249 $default_subject = __( 'Password Reset Confirmation', 'essential-addons-for-elementor-lite' );
3250 $default_message = __( 'Someone has requested a password reset for the following account:', 'essential-addons-for-elementor-lite' ) . "\r\n\r\n";
3251 $default_message .= __( 'Sitename: [sitetitle]', 'essential-addons-for-elementor-lite' ) . "\r\n\r\n";
3252 $default_message .= __( 'Username: [username]', 'essential-addons-for-elementor-lite' ) . "\r\n\r\n";
3253 $default_message .= __( 'If this was a mistake, ignore this email and nothing will happen.', 'essential-addons-for-elementor-lite' ) . "\r\n\r\n";
3254 $default_message .= __( 'To reset your password, visit the following address:', 'essential-addons-for-elementor-lite' ) . "\r\n\r\n";
3255 $default_message .= '[password_reset_link]' . "\r\n\r\n";
3256 $default_message .= __( 'Thanks!', 'essential-addons-for-elementor-lite' );
3257
3258 $this->start_controls_section( 'section_content_lostpassword_email', [
3259 'label' => __( 'Lost Password Email Options', 'essential-addons-for-elementor-lite' ),
3260 'condition' => [
3261 'enable_reset_password' => 'yes'
3262 ],
3263 ] );
3264
3265 $this->add_control( 'lostpassword_email_subject', [
3266 'label' => __( 'Email Subject', 'essential-addons-for-elementor-lite' ),
3267 'type' => Controls_Manager::TEXT,
3268 'placeholder' => $default_subject,
3269 'default' => $default_subject,
3270 'label_block' => true,
3271 'render_type' => 'none',
3272 'ai' => [
3273 'active' => true,
3274 ],
3275 ] );
3276
3277 $this->add_control( 'lostpassword_email_message', [
3278 'label' => __( 'Email Message', 'essential-addons-for-elementor-lite' ),
3279 'type' => Controls_Manager::WYSIWYG,
3280 'placeholder' => $default_message,
3281 'default' => $default_message,
3282 'label_block' => true,
3283 'render_type' => 'none',
3284 ] );
3285
3286 $this->add_control( 'lostpassword_email_content_note', [
3287 'type' => Controls_Manager::RAW_HTML,
3288 'raw' => __( '<strong>Note:</strong> You can use dynamic content in the email body like [fieldname]. For example [username] will be replaced by user-typed username. Available tags are: [username], [email], [firstname],[lastname], [website], [password_reset_link] and [sitetitle] ', 'essential-addons-for-elementor-lite' ),
3289 'content_classes' => 'elementor-panel-alert elementor-panel-alert-info',
3290 'render_type' => 'none',
3291 ] );
3292
3293 $this->add_control( 'lostpassword_email_message_reset_link_text', [
3294 'label' => __( 'Reset Link Text', 'essential-addons-for-elementor-lite' ),
3295 'type' => Controls_Manager::TEXT,
3296 'placeholder' => __( 'Enter Reset Link Text', 'essential-addons-for-elementor-lite' ),
3297 'default' => __( 'Click here to reset your password', 'essential-addons-for-elementor-lite'),
3298 'label_block' => false,
3299 'render_type' => 'none',
3300 'ai' => [
3301 'active' => true,
3302 ],
3303 ] );
3304
3305 $this->add_control( 'lostpassword_email_message_reset_link_in_popup', [
3306 'label' => __( 'Reset Link in Popup', 'essential-addons-for-elementor-lite' ),
3307 'type' => Controls_Manager::SWITCHER,
3308 'label_on' => __( 'Yes', 'essential-addons-for-elementor-lite' ),
3309 'label_off' => __( 'No', 'essential-addons-for-elementor-lite' ),
3310 'return_value' => 'yes',
3311 'default' => '',
3312 ] );
3313
3314 $this->add_control( 'lostpassword_email_message_reset_link_in_popup_warning', [
3315 'type' => Controls_Manager::RAW_HTML,
3316 'raw' => __( 'Enable "Reset Link in Popup" feature if your form is displayed in a popup.', 'essential-addons-for-elementor-lite' ),
3317 'content_classes' => 'eael-warning',
3318 ] );
3319
3320 $this->add_control( 'lostpassword_email_message_reset_link_popup_selector', [
3321 'label' => __( 'Popup Button Selector', 'essential-addons-for-elementor-lite' ),
3322 'type' => Controls_Manager::TEXT,
3323 'placeholder' => '.parent .child',
3324 'description' => __( 'Specify the class for the popup button that can be automatically triggered upon the page\'s loading.', 'essential-addons-for-elementor-lite' ),
3325 'condition' => [
3326 'lostpassword_email_message_reset_link_in_popup' => 'yes',
3327 ],
3328 'ai' => [
3329 'active' => true,
3330 ],
3331 ] );
3332
3333 $this->add_control( 'lostpassword_email_content_type', [
3334 'label' => __( 'Email Content Type', 'essential-addons-for-elementor-lite' ),
3335 'type' => Controls_Manager::SELECT,
3336 'default' => 'html',
3337 'render_type' => 'none',
3338 'options' => [
3339 'html' => __( 'HTML', 'essential-addons-for-elementor-lite' ),
3340 'plain' => __( 'Plain', 'essential-addons-for-elementor-lite' ),
3341 ],
3342 ] );
3343
3344 $this->end_controls_section();
3345 }
3346
3347 /**
3348 * It prints controls for managing general style of both login and registration form
3349 */
3350 protected function init_style_general_controls() {
3351 $this->start_controls_section( 'section_style_general', [
3352 'label' => __( 'General', 'essential-addons-for-elementor-lite' ),
3353 'tab' => Controls_Manager::TAB_STYLE,
3354 ] );
3355 //---Form Container or Box
3356 $this->add_control( 'form_form_wrap_po_toggle', [
3357 'label' => __( 'Container Box', 'essential-addons-for-elementor-lite' ),
3358 'type' => Controls_Manager::POPOVER_TOGGLE,
3359 'label_off' => __( 'Default', 'essential-addons-for-elementor-lite' ),
3360 'label_on' => __( 'Custom', 'essential-addons-for-elementor-lite' ),
3361 'return_value' => 'yes',
3362 ] );
3363 $this->start_popover();
3364 $this->add_control( 'eael_form_wrap_width_form_type', [
3365 'label' => __( 'Apply Width on', 'essential-addons-for-elementor-lite' ),
3366 'type' => Controls_Manager::SELECT,
3367 'options' => [
3368 'default' => __( 'All Forms', 'essential-addons-for-elementor-lite' ),
3369 'lostpassword' => __( 'Lost Password', 'essential-addons-for-elementor-lite' ),
3370 ],
3371 'default' => 'default',
3372 ] );
3373 $this->add_responsive_control( "eael_form_wrap_width", [
3374 'label' => esc_html__( 'Width', 'essential-addons-for-elementor-lite' ),
3375 'type' => Controls_Manager::SLIDER,
3376 'size_units' => [
3377 'px',
3378 'rem',
3379 '%',
3380 ],
3381 'range' => [
3382 'px' => [
3383 'min' => 0,
3384 'max' => 1000,
3385 'step' => 5,
3386 ],
3387 'rem' => [
3388 'min' => 0,
3389 'max' => 10,
3390 'step' => .5,
3391 ],
3392 '%' => [
3393 'min' => 0,
3394 'max' => 100,
3395 ],
3396 ],
3397 'desktop_default' => [
3398 'unit' => '%',
3399 'size' => 65,
3400 ],
3401 'tablet_default' => [
3402 'unit' => '%',
3403 'size' => 75,
3404 ],
3405 'mobile_default' => [
3406 'unit' => '%',
3407 'size' => 100,
3408 ],
3409 'selectors' => [
3410 "{{WRAPPER}} .eael-lr-form-wrapper" => 'width: {{SIZE}}{{UNIT}};',
3411 ],
3412 'condition' => [
3413 'form_form_wrap_po_toggle' => 'yes',
3414 'eael_form_wrap_width_form_type' => 'default'
3415 ],
3416 ] );
3417
3418 $this->add_responsive_control( "eael_form_wrap_width_lostpassword", [
3419 'label' => esc_html__( 'Width', 'essential-addons-for-elementor-lite' ),
3420 'type' => Controls_Manager::SLIDER,
3421 'size_units' => [
3422 'px',
3423 'rem',
3424 '%',
3425 ],
3426 'range' => [
3427 'px' => [
3428 'min' => 0,
3429 'max' => 1000,
3430 'step' => 5,
3431 ],
3432 'rem' => [
3433 'min' => 0,
3434 'max' => 10,
3435 'step' => .5,
3436 ],
3437 '%' => [
3438 'min' => 0,
3439 'max' => 100,
3440 ],
3441 ],
3442 'desktop_default' => [
3443 'unit' => '%',
3444 'size' => 65,
3445 ],
3446 'tablet_default' => [
3447 'unit' => '%',
3448 'size' => 75,
3449 ],
3450 'mobile_default' => [
3451 'unit' => '%',
3452 'size' => 100,
3453 ],
3454 'selectors' => [
3455 "{{WRAPPER}} .eael-lr-form-wrapper.eael-lostpassword-form-wrapper" => 'width: {{SIZE}}{{UNIT}};',
3456 "{{WRAPPER}} .eael-lr-form-wrapper.eael-resetpassword-form-wrapper" => 'width: {{SIZE}}{{UNIT}};',
3457 ],
3458 'condition' => [
3459 'form_form_wrap_po_toggle' => 'yes',
3460 'eael_form_wrap_width_form_type' => 'lostpassword'
3461 ],
3462 ] );
3463
3464 $this->add_responsive_control( "eael_form_wrap_margin", [
3465 'label' => __( 'Margin', 'essential-addons-for-elementor-lite' ),
3466 'type' => Controls_Manager::DIMENSIONS,
3467 'size_units' => [
3468 'px',
3469 'em',
3470 '%',
3471 ],
3472 'selectors' => [
3473 "{{WRAPPER}} .eael-lr-form-wrapper" => $this->apply_dim( 'margin' ),
3474 ],
3475 'condition' => [
3476 'form_form_wrap_po_toggle' => 'yes',
3477 ],
3478 ] );
3479 $this->add_responsive_control( "eael_form_wrap_padding", [
3480 'label' => __( 'Padding', 'essential-addons-for-elementor-lite' ),
3481 'type' => Controls_Manager::DIMENSIONS,
3482 'size_units' => [
3483 'px',
3484 'em',
3485 '%',
3486 ],
3487 'selectors' => [
3488 "{{WRAPPER}} .eael-lr-form-wrapper" => $this->apply_dim( 'padding' ),
3489 ],
3490 'condition' => [
3491 'form_form_wrap_po_toggle' => 'yes',
3492 ],
3493 ] );
3494 $this->add_group_control( Group_Control_Border::get_type(), [
3495 'name' => "eael_form_wrap_border",
3496 'selector' => "{{WRAPPER}} .eael-lr-form-wrapper",
3497 'condition' => [
3498 'form_form_wrap_po_toggle' => 'yes',
3499 ],
3500 ] );
3501 $this->add_control( "eael_form_wrap_border_radius", [
3502 'label' => __( 'Border Radius', 'essential-addons-for-elementor-lite' ),
3503 'type' => Controls_Manager::DIMENSIONS,
3504 'size_units' => [
3505 'px',
3506 '%',
3507 ],
3508 'selectors' => [
3509 "{{WRAPPER}} .eael-lr-form-wrapper" => $this->apply_dim( 'border-radius' ),
3510 ],
3511 'condition' => [
3512 'form_form_wrap_po_toggle' => 'yes',
3513 ],
3514 ] );
3515 $this->add_group_control( Group_Control_Background::get_type(), [
3516 'name' => "eael_form_wrap_bg_color",
3517 'label' => __( 'Background Color', 'essential-addons-for-elementor-lite' ),
3518 'types' => [
3519 'classic',
3520 'gradient',
3521 ],
3522 'selector' => "{{WRAPPER}} .eael-lr-form-wrapper",
3523 'condition' => [
3524 'form_form_wrap_po_toggle' => 'yes',
3525 ],
3526 ] );
3527 $this->end_popover();
3528 $this->add_group_control( Group_Control_Box_Shadow::get_type(), [
3529 'label' => __( 'Container Box Shadow', 'essential-addons-for-elementor-lite' ),
3530 'name' => 'eael_form_wrap_shadow',
3531 'selector' => "{{WRAPPER}} .eael-lr-form-wrapper",
3532 'exclude' => [
3533 'box_shadow_position',
3534 ],
3535 ] );
3536
3537 //----Form Wrapper-----
3538 $this->add_control( 'form_form_po_toggle', [
3539 'label' => __( 'Form', 'essential-addons-for-elementor-lite' ),
3540 'type' => Controls_Manager::POPOVER_TOGGLE,
3541 'label_off' => __( 'Default', 'essential-addons-for-elementor-lite' ),
3542 'label_on' => __( 'Custom', 'essential-addons-for-elementor-lite' ),
3543 'return_value' => 'yes',
3544 'separator' => 'before',
3545 ] );
3546 $this->start_popover();
3547 $this->add_control( 'eael_form_wrapper_heading', [
3548 'type' => Controls_Manager::HEADING,
3549 'label' => __( '---Form Wrapper---', 'essential-addons-for-elementor-lite' ),
3550 'separator' => 'before',
3551 ] );
3552
3553 $this->add_responsive_control( "eael_form_width", [
3554 'label' => esc_html__( 'Wrapper width', 'essential-addons-for-elementor-lite' ),
3555 'type' => Controls_Manager::SLIDER,
3556 'size_units' => [
3557 'px',
3558 'rem',
3559 '%',
3560 ],
3561 'range' => [
3562 'px' => [
3563 'min' => 0,
3564 'max' => 1000,
3565 'step' => 5,
3566 ],
3567 'rem' => [
3568 'min' => 0,
3569 'max' => 10,
3570 'step' => .5,
3571 ],
3572 '%' => [
3573 'min' => 0,
3574 'max' => 100,
3575 ],
3576 ],
3577 'desktop_default' => [
3578 'unit' => '%',
3579 'size' => 50,
3580 ],
3581 'tablet_default' => [
3582 'unit' => '%',
3583 'size' => 75,
3584 ],
3585 'mobile_default' => [
3586 'unit' => '%',
3587 'size' => 100,
3588 ],
3589 'selectors' => [
3590 "{{WRAPPER}} .lr-form-wrapper" => 'width: {{SIZE}}{{UNIT}};',
3591 ],
3592 'condition' => [
3593 'form_form_po_toggle' => 'yes',
3594 ],
3595 ] );
3596
3597 $this->add_responsive_control( "eael_form_margin", [
3598 'label' => __( 'Wrapper Margin', 'essential-addons-for-elementor-lite' ),
3599 'type' => Controls_Manager::DIMENSIONS,
3600 'size_units' => [
3601 'px',
3602 'em',
3603 '%',
3604 ],
3605 'selectors' => [
3606 "{{WRAPPER}} .lr-form-wrapper" => $this->apply_dim( 'margin' ),
3607 ],
3608 'condition' => [
3609 'form_form_po_toggle' => 'yes',
3610 ],
3611 ] );
3612 $this->add_responsive_control( "eael_form_padding", [
3613 'label' => __( 'Wrapper Padding', 'essential-addons-for-elementor-lite' ),
3614 'type' => Controls_Manager::DIMENSIONS,
3615 'size_units' => [
3616 'px',
3617 'em',
3618 '%',
3619 ],
3620 'selectors' => [
3621 "{{WRAPPER}} .lr-form-wrapper" => $this->apply_dim( 'padding' ),
3622 ],
3623 'condition' => [
3624 'form_form_po_toggle' => 'yes',
3625 ],
3626 ] );
3627 $this->add_group_control( Group_Control_Border::get_type(), [
3628 'name' => "eael_form_border",
3629 'selector' => "{{WRAPPER}} .lr-form-wrapper",
3630 'condition' => [
3631 'form_form_po_toggle' => 'yes',
3632 ],
3633 ] );
3634 $this->add_control( "eael_form_border_radius", [
3635 'label' => __( 'Wrapper Border Radius', 'essential-addons-for-elementor-lite' ),
3636 'type' => Controls_Manager::DIMENSIONS,
3637 'size_units' => [
3638 'px',
3639 '%',
3640 ],
3641 'selectors' => [
3642 "{{WRAPPER}} .lr-form-wrapper" => $this->apply_dim( 'border-radius' ),
3643 ],
3644 'condition' => [
3645 'form_form_po_toggle' => 'yes',
3646 ],
3647 ] );
3648 $this->add_group_control( Group_Control_Background::get_type(), [
3649 'name' => "eael_form_bg_color",
3650 'label' => __( 'Background Color', 'essential-addons-for-elementor-lite' ),
3651 'types' => [
3652 'classic',
3653 'gradient',
3654 ],
3655 'selector' => "{{WRAPPER}} .lr-form-wrapper",
3656 ] );
3657
3658 $this->add_control( 'eael_form_input_container', [
3659 'type' => Controls_Manager::HEADING,
3660 'label' => __( '---Form Style---', 'essential-addons-for-elementor-lite' ),
3661 'separator' => 'before',
3662 ] );
3663 $this->add_responsive_control( "eael_form_ic_width", [
3664 'label' => esc_html__( 'Form width', 'essential-addons-for-elementor-lite' ),
3665 'type' => Controls_Manager::SLIDER,
3666 'size_units' => [
3667 'px',
3668 'rem',
3669 '%',
3670 ],
3671 'range' => [
3672 'px' => [
3673 'min' => 0,
3674 'max' => 1000,
3675 'step' => 5,
3676 ],
3677 'rem' => [
3678 'min' => 0,
3679 'max' => 10,
3680 'step' => .5,
3681 ],
3682 '%' => [
3683 'min' => 0,
3684 'max' => 100,
3685 ],
3686 ],
3687 'default' => [
3688 'unit' => '%',
3689 'size' => 100,
3690 ],
3691 'selectors' => [
3692 "{{WRAPPER}} .lr-form-wrapper form" => 'width: {{SIZE}}{{UNIT}};',
3693 ],
3694 'condition' => [
3695 'form_form_po_toggle' => 'yes',
3696 ],
3697 ] );
3698
3699 $this->add_responsive_control( "eael_form_ic_margin", [
3700 'label' => __( 'Form Margin', 'essential-addons-for-elementor-lite' ),
3701 'type' => Controls_Manager::DIMENSIONS,
3702 'size_units' => [
3703 'px',
3704 'em',
3705 '%',
3706 ],
3707 'selectors' => [
3708 "{{WRAPPER}} .lr-form-wrapper form" => $this->apply_dim( 'margin' ),
3709 ],
3710 'condition' => [
3711 'form_form_po_toggle' => 'yes',
3712 ],
3713 ] );
3714 $this->add_responsive_control( "eael_form_ic_padding", [
3715 'label' => __( 'Form Padding', 'essential-addons-for-elementor-lite' ),
3716 'type' => Controls_Manager::DIMENSIONS,
3717 'size_units' => [
3718 'px',
3719 'em',
3720 '%',
3721 ],
3722 'selectors' => [
3723 "{{WRAPPER}} .lr-form-wrapper form" => $this->apply_dim( 'padding' ),
3724 ],
3725 'condition' => [
3726 'form_form_po_toggle' => 'yes',
3727 ],
3728 ] );
3729 $this->add_group_control( Group_Control_Border::get_type(), [
3730 'name' => "eael_form_ic_border",
3731 'selector' => "{{WRAPPER}} .lr-form-wrapper form",
3732 'condition' => [
3733 'form_form_po_toggle' => 'yes',
3734 ],
3735 ] );
3736 $this->add_control( "eael_form_ic_border_radius", [
3737 'label' => __( 'Border Radius', 'essential-addons-for-elementor-lite' ),
3738 'type' => Controls_Manager::DIMENSIONS,
3739 'size_units' => [
3740 'px',
3741 '%',
3742 ],
3743 'selectors' => [
3744 "{{WRAPPER}} .lr-form-wrapper form" => $this->apply_dim( 'border-radius' ),
3745 ],
3746 'condition' => [
3747 'form_form_po_toggle' => 'yes',
3748 ],
3749 ] );
3750 $this->add_group_control( Group_Control_Background::get_type(), [
3751 'name' => "eael_form_ic_bg_color",
3752 'label' => __( 'Background Color', 'essential-addons-for-elementor-lite' ),
3753 'types' => [
3754 'classic',
3755 'gradient',
3756 ],
3757 'selector' => "{{WRAPPER}} .lr-form-wrapper form",
3758 ] );
3759 $this->end_popover();
3760
3761 $this->add_group_control( Group_Control_Box_Shadow::get_type(), [
3762 'label' => __( 'Form Wrapper Shadow', 'essential-addons-for-elementor-lite' ),
3763 'name' => 'eael_form_shadow',
3764 'selector' => "{{WRAPPER}} .lr-form-wrapper",
3765 'exclude' => [
3766 'box_shadow_position',
3767 ],
3768 ] );
3769
3770 $this->add_group_control( Group_Control_Box_Shadow::get_type(), [
3771 'label' => __( 'Form Shadow', 'essential-addons-for-elementor-lite' ),
3772 'name' => 'eael_form_ic_shadow',
3773 'selector' => "{{WRAPPER}} .lr-form-wrapper form",
3774 'exclude' => [
3775 'box_shadow_position',
3776 ],
3777 ] );
3778 //@TODO; add only input wrapper shadow
3779 $this->end_controls_section();
3780 }
3781
3782 protected function init_style_header_content_controls( $form_type = 'login' ) {
3783 $form_type_for_heading = 'lostpassword' == $form_type ? __( 'Lost Password', 'essential-addons-for-elementor-lite' ) : $form_type;
3784 $form_type_for_heading = 'resetpassword' == $form_type ? __( 'Reset Password', 'essential-addons-for-elementor-lite' ) : $form_type_for_heading;
3785
3786 $this->start_controls_section( "section_style_{$form_type}_header_content", [
3787 'label' => sprintf(
3788 /* translators: %s: Form type to display in the header label. */
3789 __( '%s Form Header', 'essential-addons-for-elementor-lite' ),
3790 esc_html( ucfirst( $form_type_for_heading ) )
3791 ),
3792 // Login Form Header | Register Form Header | Lost Password Form Header | Reset Password Form Header
3793 'tab' => Controls_Manager::TAB_STYLE,
3794 'conditions' => $this->get_form_controls_display_condition( $form_type ),
3795 ] );
3796 //Define all css selectors ahead for better management
3797 $illustration_selector = "{{WRAPPER}} .eael-{$form_type}-form-wrapper .lr-form-illustration";
3798 $header_selector = "{{WRAPPER}} .eael-{$form_type}-form-wrapper .lr-form-header";
3799 $logo_selector = "{{WRAPPER}} .eael-{$form_type}-form-wrapper .lr-form-header img";
3800 $title_selector = "{{WRAPPER}} .eael-{$form_type}-form-wrapper .lr-form-header .form-dsc h4";
3801 $subtitle_selector = "{{WRAPPER}} .eael-{$form_type}-form-wrapper .lr-form-header .form-dsc p";
3802
3803 $this->add_control( "{$form_type}_fhc_po_toggle", [
3804 'label' => __( 'Header Content', 'essential-addons-for-elementor-lite' ),
3805 'type' => Controls_Manager::POPOVER_TOGGLE,
3806 'label_off' => __( 'Default', 'essential-addons-for-elementor-lite' ),
3807 'label_on' => __( 'Custom', 'essential-addons-for-elementor-lite' ),
3808 'return_value' => 'yes',
3809 ] );
3810
3811 $this->start_popover();
3812
3813 $this->add_responsive_control( "{$form_type}_fhc_width", [
3814 'label' => esc_html__( 'Header width', 'essential-addons-for-elementor-lite' ),
3815 'type' => Controls_Manager::SLIDER,
3816 'size_units' => [
3817 'px',
3818 'rem',
3819 '%',
3820 ],
3821 'range' => [
3822 'px' => [
3823 'min' => 0,
3824 'max' => 1000,
3825 'step' => 5,
3826 ],
3827 'rem' => [
3828 'min' => 0,
3829 'max' => 10,
3830 'step' => .5,
3831 ],
3832 '%' => [
3833 'min' => 0,
3834 'max' => 100,
3835 ],
3836 ],
3837 'default' => [
3838 'unit' => '%',
3839 'size' => 100,
3840 ],
3841 'selectors' => [
3842 $header_selector => 'width: {{SIZE}}{{UNIT}};',
3843 ],
3844 'condition' => [
3845 "{$form_type}_fhc_po_toggle" => 'yes',
3846 ],
3847 ] );
3848 $this->add_responsive_control( "{$form_type}_fhc_height", [
3849 'label' => esc_html__( 'Header height', 'essential-addons-for-elementor-lite' ),
3850 'type' => Controls_Manager::SLIDER,
3851 'size_units' => [
3852 'px',
3853 'rem',
3854 '%',
3855 ],
3856 'range' => [
3857 'px' => [
3858 'min' => 0,
3859 'max' => 1000,
3860 'step' => 5,
3861 ],
3862 'rem' => [
3863 'min' => 0,
3864 'max' => 10,
3865 'step' => .5,
3866 ],
3867 '%' => [
3868 'min' => 0,
3869 'max' => 100,
3870 ],
3871 ],
3872 'selectors' => [
3873 $header_selector => 'height: {{SIZE}}{{UNIT}};',
3874 ],
3875 'condition' => [
3876 "{$form_type}_fhc_po_toggle" => 'yes',
3877 ],
3878 ] );
3879 $this->add_responsive_control( "{$form_type}_fhc_margin", [
3880 'label' => __( 'Header Margin', 'essential-addons-for-elementor-lite' ),
3881 'type' => Controls_Manager::DIMENSIONS,
3882 'size_units' => [
3883 'px',
3884 'em',
3885 '%',
3886 ],
3887 'selectors' => [
3888 $header_selector => $this->apply_dim( 'margin' ),
3889 ],
3890 'condition' => [
3891 "{$form_type}_fhc_po_toggle" => 'yes',
3892 ],
3893 ] );
3894 $this->add_responsive_control( "{$form_type}_fhc_padding", [
3895 'label' => __( 'Header Padding', 'essential-addons-for-elementor-lite' ),
3896 'type' => Controls_Manager::DIMENSIONS,
3897 'size_units' => [
3898 'px',
3899 'em',
3900 '%',
3901 ],
3902 'selectors' => [
3903 $header_selector => $this->apply_dim( 'padding' ),
3904 ],
3905 'condition' => [
3906 "{$form_type}_fhc_po_toggle" => 'yes',
3907 ],
3908 ] );
3909
3910
3911 $this->add_group_control( Group_Control_Border::get_type(), [
3912 'name' => "{$form_type}_fhc_border",
3913 'selector' => $header_selector,
3914 'condition' => [
3915 "{$form_type}_fhc_po_toggle" => 'yes',
3916 ],
3917 ] );
3918 $this->add_control( "{$form_type}_fhc_border_radius", [
3919 'label' => __( 'Border Radius', 'essential-addons-for-elementor-lite' ),
3920 'type' => Controls_Manager::DIMENSIONS,
3921 'size_units' => [
3922 'px',
3923 '%',
3924 ],
3925 'selectors' => [
3926 $header_selector => $this->apply_dim( 'border-radius' ),
3927 ],
3928 'condition' => [
3929 "{$form_type}_fhc_po_toggle" => 'yes',
3930 ],
3931 ] );
3932 $this->add_group_control( Group_Control_Background::get_type(), [
3933 'name' => "{$form_type}_form_header_bg",
3934 'label' => __( 'Background Color', 'essential-addons-for-elementor-lite' ),
3935 'types' => [
3936 'classic',
3937 'gradient',
3938 ],
3939 'selector' => $header_selector,
3940 'condition' => [
3941 "{$form_type}_fhc_po_toggle" => 'yes',
3942 ],
3943 ] );
3944 $this->end_popover();
3945
3946
3947 $this->add_control( "{$form_type}_form_img_po_toggle", [
3948 'label' => __( 'Form Illustration', 'essential-addons-for-elementor-lite' ),
3949 'type' => Controls_Manager::POPOVER_TOGGLE,
3950 'label_off' => __( 'Default', 'essential-addons-for-elementor-lite' ),
3951 'label_on' => __( 'Custom', 'essential-addons-for-elementor-lite' ),
3952 'return_value' => 'yes',
3953 'separator' => 'before',
3954 ] );
3955 $this->start_popover();
3956 $this->add_responsive_control( "{$form_type}_form_img_width", [
3957 'label' => esc_html__( 'Width', 'essential-addons-for-elementor-lite' ),
3958 'type' => Controls_Manager::SLIDER,
3959 'size_units' => [
3960 'px',
3961 'rem',
3962 '%',
3963 ],
3964 'range' => [
3965 'px' => [
3966 'min' => 0,
3967 'max' => 1000,
3968 'step' => 5,
3969 ],
3970 'rem' => [
3971 'min' => 0,
3972 'max' => 10,
3973 'step' => .5,
3974 ],
3975 '%' => [
3976 'min' => 0,
3977 'max' => 100,
3978 ],
3979 ],
3980 'desktop_default' => [
3981 'unit' => '%',
3982 'size' => 50,
3983 ],
3984 'tablet_default' => [
3985 'unit' => '%',
3986 'size' => 100,
3987 ],
3988 'mobile_default' => [
3989 'unit' => '%',
3990 'size' => 100,
3991 ],
3992 'selectors' => [
3993 $illustration_selector => 'width: {{SIZE}}{{UNIT}};',
3994 ],
3995 'condition' => [
3996 "{$form_type}_form_img_po_toggle" => 'yes',
3997 ],
3998 ] );
3999 $this->add_responsive_control( "{$form_type}_form_img_height", [
4000 'label' => esc_html__( 'Height', 'essential-addons-for-elementor-lite' ),
4001 'type' => Controls_Manager::SLIDER,
4002 'size_units' => [
4003 'px',
4004 'rem',
4005 ],
4006 'range' => [
4007 'px' => [
4008 'min' => 0,
4009 'max' => 1000,
4010 'step' => 5,
4011 ],
4012 'rem' => [
4013 'min' => 0,
4014 'max' => 10,
4015 'step' => .5,
4016 ],
4017 ],
4018 'desktop_default' => [
4019 'unit' => 'px',
4020 'size' => 375,
4021 ],
4022 'tablet_default' => [
4023 'unit' => 'px',
4024 'size' => 375,
4025 ],
4026 'mobile_default' => [
4027 'unit' => 'px',
4028 'size' => 375,
4029 ],
4030 'selectors' => [
4031 $illustration_selector => 'height: {{SIZE}}{{UNIT}};',
4032 ],
4033 'condition' => [
4034 "{$form_type}_form_img_po_toggle" => 'yes',
4035 ],
4036 ] );
4037 $this->add_control( "{$form_type}_form_img_margin", [
4038 'label' => __( 'Margin', 'essential-addons-for-elementor-lite' ),
4039 'type' => Controls_Manager::DIMENSIONS,
4040 'size_units' => [
4041 'px',
4042 'em',
4043 '%',
4044 ],
4045 'selectors' => [
4046 $illustration_selector => $this->apply_dim( 'margin' ),
4047 ],
4048 'condition' => [
4049 "{$form_type}_form_img_po_toggle" => 'yes',
4050 ],
4051 ] );
4052 $this->add_control( "{$form_type}_form_img_padding", [
4053 'label' => __( 'Padding', 'essential-addons-for-elementor-lite' ),
4054 'type' => Controls_Manager::DIMENSIONS,
4055 'size_units' => [
4056 'px',
4057 'em',
4058 '%',
4059 ],
4060 'selectors' => [
4061 $illustration_selector => $this->apply_dim( 'padding' ),
4062 ],
4063 'condition' => [
4064 "{$form_type}_form_img_po_toggle" => 'yes',
4065 ],
4066 ] );
4067 $this->add_group_control( Group_Control_Border::get_type(), [
4068 'name' => "{$form_type}_form_img_border",
4069 'selector' => $illustration_selector,
4070 'condition' => [
4071 "{$form_type}_form_img_po_toggle" => 'yes',
4072 ],
4073 ] );
4074 $this->add_control( "{$form_type}_form_img_border_radius", [
4075 'label' => __( 'Border Radius', 'essential-addons-for-elementor-lite' ),
4076 'type' => Controls_Manager::DIMENSIONS,
4077 'size_units' => [
4078 'px',
4079 '%',
4080 ],
4081 'selectors' => [
4082 $illustration_selector => $this->apply_dim( 'border-radius' ),
4083 ],
4084 'condition' => [
4085 "{$form_type}_form_img_po_toggle" => 'yes',
4086 ],
4087 ] );
4088 $this->end_popover();
4089 $this->add_group_control( Group_Control_Box_Shadow::get_type(), [
4090 'label' => __( 'Illustration Shadow', 'essential-addons-for-elementor-lite' ),
4091 'name' => "{$form_type}_form_img_shadow",
4092 'selector' => $illustration_selector,
4093 'exclude' => [
4094 'box_shadow_position',
4095 ],
4096 ] );
4097 $this->add_control( "{$form_type}_form_logo_po_toggle", [
4098 'label' => __( 'Form Logo', 'essential-addons-for-elementor-lite' ),
4099 'type' => Controls_Manager::POPOVER_TOGGLE,
4100 'label_off' => __( 'Default', 'essential-addons-for-elementor-lite' ),
4101 'label_on' => __( 'Custom', 'essential-addons-for-elementor-lite' ),
4102 'return_value' => 'yes',
4103 'separator' => 'before',
4104 ] );
4105 $this->start_popover();
4106 $this->add_responsive_control( "{$form_type}_form_logo_width", [
4107 'label' => esc_html__( 'width', 'essential-addons-for-elementor-lite' ),
4108 'type' => Controls_Manager::SLIDER,
4109 'size_units' => [
4110 'px',
4111 'rem',
4112 '%',
4113 ],
4114 'range' => [
4115 'px' => [
4116 'min' => 0,
4117 'max' => 1000,
4118 'step' => 5,
4119 ],
4120 'rem' => [
4121 'min' => 0,
4122 'max' => 10,
4123 'step' => .5,
4124 ],
4125 '%' => [
4126 'min' => 0,
4127 'max' => 100,
4128 ],
4129 ],
4130 'default' => [
4131 'unit' => 'px',
4132 'size' => 100,
4133 ],
4134 'selectors' => [
4135 $logo_selector => 'width: {{SIZE}}{{UNIT}};',
4136 ],
4137 'condition' => [
4138 "{$form_type}_form_logo_po_toggle" => 'yes',
4139 ],
4140 ] );
4141 $this->add_responsive_control( "{$form_type}_form_logo_height", [
4142 'label' => esc_html__( 'height', 'essential-addons-for-elementor-lite' ),
4143 'type' => Controls_Manager::SLIDER,
4144 'size_units' => [
4145 'px',
4146 'rem',
4147 '%',
4148 ],
4149 'range' => [
4150 'px' => [
4151 'min' => 0,
4152 'max' => 1000,
4153 'step' => 5,
4154 ],
4155 'rem' => [
4156 'min' => 0,
4157 'max' => 10,
4158 'step' => .5,
4159 ],
4160 '%' => [
4161 'min' => 0,
4162 'max' => 100,
4163 ],
4164 ],
4165 'default' => [
4166 'unit' => 'px',
4167 'size' => 100,
4168 ],
4169 'selectors' => [
4170 $logo_selector => 'height: {{SIZE}}{{UNIT}};',
4171 ],
4172 'condition' => [
4173 "{$form_type}_form_logo_po_toggle" => 'yes',
4174 ],
4175 ] );
4176 $this->add_responsive_control( "{$form_type}_form_logo_margin", [
4177 'label' => __( 'Margin', 'essential-addons-for-elementor-lite' ),
4178 'type' => Controls_Manager::DIMENSIONS,
4179 'size_units' => [
4180 'px',
4181 'em',
4182 '%',
4183 ],
4184 'selectors' => [
4185 $logo_selector => $this->apply_dim( 'margin' ),
4186 ],
4187 'condition' => [
4188 "{$form_type}_form_logo_po_toggle" => 'yes',
4189 ],
4190 ] );
4191 $this->add_responsive_control( "{$form_type}_form_logo_padding", [
4192 'label' => __( 'Padding', 'essential-addons-for-elementor-lite' ),
4193 'type' => Controls_Manager::DIMENSIONS,
4194 'size_units' => [
4195 'px',
4196 'em',
4197 '%',
4198 ],
4199 'selectors' => [
4200 $logo_selector => $this->apply_dim( 'padding' ),
4201 ],
4202 'condition' => [
4203 "{$form_type}_form_logo_po_toggle" => 'yes',
4204 ],
4205 ] );
4206
4207 $this->add_group_control( Group_Control_Border::get_type(), [
4208 'name' => "{$form_type}_form_logo_border",
4209 'selector' => $logo_selector,
4210 'condition' => [
4211 "{$form_type}_form_logo_po_toggle" => 'yes',
4212 ],
4213 ] );
4214 $this->add_control( "{$form_type}_form_logo_border_radius", [
4215 'label' => __( 'Border Radius', 'essential-addons-for-elementor-lite' ),
4216 'type' => Controls_Manager::DIMENSIONS,
4217 'size_units' => [
4218 'px',
4219 '%',
4220 ],
4221 'selectors' => [
4222 $logo_selector => $this->apply_dim( 'border-radius' ),
4223 ],
4224 'condition' => [
4225 "{$form_type}_form_logo_po_toggle" => 'yes',
4226 ],
4227 ] );
4228 $this->end_popover();
4229 $this->add_group_control( Group_Control_Box_Shadow::get_type(), [
4230 'label' => __( 'Logo Shadow', 'essential-addons-for-elementor-lite' ),
4231 'name' => "{$form_type}_form_logo_shadow",
4232 'selector' => $logo_selector,
4233 'exclude' => [
4234 'box_shadow_position',
4235 ],
4236 ] );
4237
4238
4239 /*-- Title Typography --*/
4240 $this->add_control( "{$form_type}_form_title_po_toggle", [
4241 'label' => __( 'Title', 'essential-addons-for-elementor-lite' ),
4242 'type' => Controls_Manager::POPOVER_TOGGLE,
4243 'label_off' => __( 'Default', 'essential-addons-for-elementor-lite' ),
4244 'label_on' => __( 'Custom', 'essential-addons-for-elementor-lite' ),
4245 'return_value' => 'yes',
4246 'separator' => 'before',
4247 ] );
4248 $this->start_popover();
4249 $this->add_responsive_control( "{$form_type}_form_title_margin", [
4250 'label' => __( 'Margin', 'essential-addons-for-elementor-lite' ),
4251 'type' => Controls_Manager::DIMENSIONS,
4252 'size_units' => [
4253 'px',
4254 'em',
4255 '%',
4256 ],
4257 'selectors' => [
4258 $title_selector => $this->apply_dim( 'margin' ),
4259 ],
4260 'condition' => [
4261 "{$form_type}_form_title_po_toggle" => 'yes',
4262 ],
4263 ] );
4264 $this->add_responsive_control( "{$form_type}_form_title_padding", [
4265 'label' => __( 'Padding', 'essential-addons-for-elementor-lite' ),
4266 'type' => Controls_Manager::DIMENSIONS,
4267 'size_units' => [
4268 'px',
4269 'em',
4270 '%',
4271 ],
4272 'selectors' => [
4273 $title_selector => $this->apply_dim( 'padding' ),
4274 ],
4275 'condition' => [
4276 "{$form_type}_form_title_po_toggle" => 'yes',
4277 ],
4278 ] );
4279 $this->add_control( "{$form_type}_form_title_color", [
4280 'label' => __( 'Color', 'essential-addons-for-elementor-lite' ),
4281 'type' => Controls_Manager::COLOR,
4282 'selectors' => [
4283 $title_selector => 'color: {{VALUE}};',
4284 ],
4285 'condition' => [
4286 "{$form_type}_form_title_po_toggle" => 'yes',
4287 ],
4288 ] );
4289 $this->add_control( "{$form_type}_form_title_bg_color", [
4290 'label' => __( 'Background Color', 'essential-addons-for-elementor-lite' ),
4291 'type' => Controls_Manager::COLOR,
4292 'selectors' => [
4293 $title_selector => 'background: {{VALUE}};',
4294 ],
4295 'condition' => [
4296 "{$form_type}_form_title_po_toggle" => 'yes',
4297 ],
4298 ] );
4299
4300
4301 $this->add_group_control( Group_Control_Border::get_type(), [
4302 'name' => "{$form_type}_form_title_border",
4303 'selector' => $title_selector,
4304 'condition' => [
4305 "{$form_type}_form_title_po_toggle" => 'yes',
4306 ],
4307 ] );
4308 $this->add_control( "{$form_type}_form_title_border_radius", [
4309 'label' => __( 'Border Radius', 'essential-addons-for-elementor-lite' ),
4310 'type' => Controls_Manager::DIMENSIONS,
4311 'size_units' => [
4312 'px',
4313 '%',
4314 ],
4315 'selectors' => [
4316 $title_selector => $this->apply_dim( 'border-radius' ),
4317 ],
4318 'condition' => [
4319 "{$form_type}_form_title_po_toggle" => 'yes',
4320 ],
4321 ] );
4322
4323 $this->end_popover();
4324 $this->add_group_control( Group_Control_Typography::get_type(), [
4325 'name' => "{$form_type}_form_title_typo",
4326 'label' => __( 'Title Typography', 'essential-addons-for-elementor-lite' ),
4327 'selector' => $title_selector,
4328 ] );
4329
4330 /*Subtitle----*/
4331 $this->add_control( "{$form_type}_form_subtitle_po_toggle", [
4332 'label' => __( 'Subtitle', 'essential-addons-for-elementor-lite' ),
4333 'type' => Controls_Manager::POPOVER_TOGGLE,
4334 'label_off' => __( 'Default', 'essential-addons-for-elementor-lite' ),
4335 'label_on' => __( 'Custom', 'essential-addons-for-elementor-lite' ),
4336 'return_value' => 'yes',
4337 'separator' => 'before',
4338 ] );
4339 $this->start_popover();
4340 $this->add_responsive_control( "{$form_type}_form_subtitle_margin", [
4341 'label' => __( 'Margin', 'essential-addons-for-elementor-lite' ),
4342 'type' => Controls_Manager::DIMENSIONS,
4343 'size_units' => [
4344 'px',
4345 'em',
4346 '%',
4347 ],
4348 'selectors' => [
4349 $subtitle_selector => $this->apply_dim( 'margin' ),
4350 ],
4351 'condition' => [
4352 "{$form_type}_form_subtitle_po_toggle" => 'yes',
4353 ],
4354 ] );
4355 $this->add_responsive_control( "{$form_type}_form_subtitle_padding", [
4356 'label' => __( 'Padding', 'essential-addons-for-elementor-lite' ),
4357 'type' => Controls_Manager::DIMENSIONS,
4358 'size_units' => [
4359 'px',
4360 'em',
4361 '%',
4362 ],
4363 'selectors' => [
4364 $subtitle_selector => $this->apply_dim( 'padding' ),
4365 ],
4366 'condition' => [
4367 "{$form_type}_form_subtitle_po_toggle" => 'yes',
4368 ],
4369 ] );
4370 $this->add_control( "{$form_type}_form_subtitle_color", [
4371 'label' => __( 'Color', 'essential-addons-for-elementor-lite' ),
4372 'type' => Controls_Manager::COLOR,
4373 'selectors' => [
4374 $subtitle_selector => 'color: {{VALUE}};',
4375 ],
4376 'condition' => [
4377 "{$form_type}_form_subtitle_po_toggle" => 'yes',
4378 ],
4379 ] );
4380 $this->add_control( "{$form_type}_form_subtitle_bg_color", [
4381 'label' => __( 'Background Color', 'essential-addons-for-elementor-lite' ),
4382 'type' => Controls_Manager::COLOR,
4383 'selectors' => [
4384 $subtitle_selector => 'background: {{VALUE}};',
4385 ],
4386 'condition' => [
4387 "{$form_type}_form_subtitle_po_toggle" => 'yes',
4388 ],
4389 ] );
4390
4391
4392 $this->add_group_control( Group_Control_Border::get_type(), [
4393 'name' => "{$form_type}_form_subtitle_border",
4394 'selector' => $subtitle_selector,
4395 'condition' => [
4396 "{$form_type}_form_subtitle_po_toggle" => 'yes',
4397 ],
4398 ] );
4399 $this->add_control( "{$form_type}_form_subtitle_border_radius", [
4400 'label' => __( 'Border Radius', 'essential-addons-for-elementor-lite' ),
4401 'type' => Controls_Manager::DIMENSIONS,
4402 'size_units' => [
4403 'px',
4404 '%',
4405 ],
4406 'selectors' => [
4407 $subtitle_selector => $this->apply_dim( 'border-radius' ),
4408 ],
4409 'condition' => [
4410 "{$form_type}_form_subtitle_po_toggle" => 'yes',
4411 ],
4412 ] );
4413
4414 $this->end_popover();
4415 $this->add_group_control( Group_Control_Typography::get_type(), [
4416 'name' => "{$form_type}_form_subtitle_typo",
4417 'label' => __( 'Subtitle Typography', 'essential-addons-for-elementor-lite' ),
4418 'selector' => $subtitle_selector,
4419 ] );
4420
4421 $this->end_controls_section();
4422 }
4423
4424 protected function init_style_input_fields_controls() {
4425 $this->start_controls_section( 'section_style_form_fields', [
4426 'label' => __( 'Form Fields', 'essential-addons-for-elementor-lite' ),
4427 'tab' => Controls_Manager::TAB_STYLE,
4428 ] );
4429 $this->add_control( 'eael_form_field_po_toggle', [
4430 'label' => __( 'Spacing', 'essential-addons-for-elementor-lite' ),
4431 'type' => Controls_Manager::POPOVER_TOGGLE,
4432 'label_off' => __( 'Default', 'essential-addons-for-elementor-lite' ),
4433 'label_on' => __( 'Custom', 'essential-addons-for-elementor-lite' ),
4434 'return_value' => 'yes',
4435 ] );
4436
4437 $this->start_popover();
4438 $this->add_control( 'eael_form_input_fields_heading', [
4439 'type' => Controls_Manager::HEADING,
4440 'label' => __( 'Form Input Fields', 'essential-addons-for-elementor-lite' ),
4441 ] );
4442 $this->add_responsive_control( "eael_form_field_margin", [
4443 'label' => __( 'Margin', 'essential-addons-for-elementor-lite' ),
4444 'type' => Controls_Manager::DIMENSIONS,
4445 'size_units' => [
4446 'px',
4447 'em',
4448 '%',
4449 ],
4450 'selectors' => [
4451 "{{WRAPPER}} .lr-form-wrapper .eael-lr-form-group" => $this->apply_dim( 'margin' ),
4452 ],
4453 'condition' => [
4454 'eael_form_field_po_toggle' => 'yes',
4455 ],
4456 ] );
4457 $this->add_responsive_control( "eael_form_field_padding", [
4458 'label' => __( 'Padding', 'essential-addons-for-elementor-lite' ),
4459 'type' => Controls_Manager::DIMENSIONS,
4460 'size_units' => [
4461 'px',
4462 'em',
4463 '%',
4464 ],
4465 'selectors' => [
4466 "{{WRAPPER}} .lr-form-wrapper .eael-lr-form-control" => $this->apply_dim( 'padding' ),
4467 ],
4468 'condition' => [
4469 'eael_form_field_po_toggle' => 'yes',
4470 ],
4471 ] );
4472
4473 $this->add_control( 'eael_form_tc_fields_heading', [
4474 'type' => Controls_Manager::HEADING,
4475 'label' => __( 'Terms & Condition Field', 'essential-addons-for-elementor-lite' ),
4476 'separator' => 'before',
4477 ] );
4478 $this->add_responsive_control( "eael_form_tc_field_margin", [
4479 'label' => __( 'Margin', 'essential-addons-for-elementor-lite' ),
4480 'type' => Controls_Manager::DIMENSIONS,
4481 'size_units' => [
4482 'px',
4483 'em',
4484 '%',
4485 ],
4486 'selectors' => [
4487 "{{WRAPPER}} .lr-form-wrapper .eael_accept_tnc_wrap" => $this->apply_dim( 'margin' ),
4488 ],
4489 'condition' => [
4490 'eael_form_field_po_toggle' => 'yes',
4491 ],
4492 ] );
4493 $this->add_responsive_control( "eael_form_tc_field_padding", [
4494 'label' => __( 'Padding', 'essential-addons-for-elementor-lite' ),
4495 'type' => Controls_Manager::DIMENSIONS,
4496 'size_units' => [
4497 'px',
4498 'em',
4499 '%',
4500 ],
4501 'selectors' => [
4502 "{{WRAPPER}} .lr-form-wrapper .eael_accept_tnc_wrap" => $this->apply_dim( 'padding' ),
4503 ],
4504 'condition' => [
4505 'eael_form_field_po_toggle' => 'yes',
4506 ],
4507 ] );
4508 $this->end_popover();
4509 $this->add_group_control( Group_Control_Typography::get_type(), [
4510 'name' => "eael_fields_typography",
4511 'selector' => "{{WRAPPER}} .lr-form-wrapper .eael-lr-form-control",
4512 ] );
4513 $this->add_responsive_control( "ph_align", [
4514 'label' => __( 'Text Alignment', 'essential-addons-for-elementor-lite' ),
4515 'type' => Controls_Manager::CHOOSE,
4516 'options' => [
4517 'left' => [
4518 'title' => __( 'Left', 'essential-addons-for-elementor-lite' ),
4519 'icon' => 'eicon-h-align-left',
4520 ],
4521 'center' => [
4522 'title' => __( 'Center', 'essential-addons-for-elementor-lite' ),
4523 'icon' => 'eicon-h-align-center',
4524 ],
4525 'right' => [
4526 'title' => __( 'Right', 'essential-addons-for-elementor-lite' ),
4527 'icon' => 'eicon-h-align-right',
4528 ],
4529 ],
4530 'default' => 'left',
4531 'selectors' => [
4532 "{{WRAPPER}} .lr-form-wrapper .eael-lr-form-control" => 'text-align: {{VALUE}};',
4533 ],
4534 ] );
4535 $this->add_control( 'eael_form_label_colors_heading', [
4536 'type' => Controls_Manager::HEADING,
4537 'label' => __( 'Colors & Border', 'essential-addons-for-elementor-lite' ),
4538 'separator' => 'before',
4539 ] );
4540 $this->start_controls_tabs( "tabs_form_fields_style" );
4541
4542 /*-----Form Input Fields NORMAL state------ */
4543 $this->start_controls_tab( "tab_form_field_style_normal", [
4544 'label' => __( 'Normal', 'essential-addons-for-elementor-lite' ),
4545 ] );
4546 $this->add_control( 'eael_field_color', [
4547 'label' => __( 'Text Color', 'essential-addons-for-elementor-lite' ),
4548 'type' => Controls_Manager::COLOR,
4549 'selectors' => [
4550 "{{WRAPPER}} .lr-form-wrapper .eael-lr-form-control" => 'color: {{VALUE}};',
4551 ],
4552 ] );
4553 $this->add_control( 'eael_field_placeholder_color', [
4554 'label' => __( 'Placeholder Color', 'essential-addons-for-elementor-lite' ),
4555 'type' => Controls_Manager::COLOR,
4556 'selectors' => [
4557 "{{WRAPPER}} .lr-form-wrapper input.eael-lr-form-control::placeholder" => 'color: {{VALUE}};',
4558 ],
4559 ] );
4560 $this->add_control( 'eael_field_bg_color', [
4561 'label' => __( 'Background Color', 'essential-addons-for-elementor-lite' ),
4562 'type' => Controls_Manager::COLOR,
4563 'default' => '#ffffff',
4564 'selectors' => [
4565 "{{WRAPPER}} .lr-form-wrapper .eael-lr-form-control" => 'background-color: {{VALUE}};',
4566 ],
4567 ] );
4568
4569 $this->add_group_control( Group_Control_Border::get_type(), [
4570 'name' => "eael_field_border",
4571 'selector' => "{{WRAPPER}} .lr-form-wrapper .eael-lr-form-control",
4572 ] );
4573 $this->add_control( "eael_field_border_radius", [
4574 'label' => __( 'Border Radius', 'essential-addons-for-elementor-lite' ),
4575 'type' => Controls_Manager::DIMENSIONS,
4576 'size_units' => [
4577 'px',
4578 '%',
4579 ],
4580 'selectors' => [
4581 "{{WRAPPER}} .lr-form-wrapper .eael-lr-form-control" => $this->apply_dim( 'border-radius' ),
4582 ],
4583 ] );
4584
4585 $this->end_controls_tab();
4586
4587 $this->start_controls_tab( "tab_form_field_style_active", [
4588 'label' => __( 'Focus', 'essential-addons-for-elementor-lite' ),
4589 ] );
4590
4591 $this->add_control( 'eael_field_placeholder_color_active', [
4592 'label' => __( 'Placeholder Color', 'essential-addons-for-elementor-lite' ),
4593 'type' => Controls_Manager::COLOR,
4594 'selectors' => [
4595 "{{WRAPPER}} .lr-form-wrapper input.eael-lr-form-control:focus::placeholder" => 'color: {{VALUE}};',
4596 ],
4597 ] );
4598 $this->add_control( 'eael_field_bg_color_active', [
4599 'label' => __( 'Background Color', 'essential-addons-for-elementor-lite' ),
4600 'type' => Controls_Manager::COLOR,
4601 'default' => '#ffffff',
4602 'selectors' => [
4603 "{{WRAPPER}} .lr-form-wrapper .eael-lr-form-control:focus" => 'background-color: {{VALUE}};',
4604 ],
4605 ] );
4606 $this->add_group_control( Group_Control_Border::get_type(), [
4607 'name' => "eael_field_border_focus",
4608 'selector' => "{{WRAPPER}} .lr-form-wrapper .eael-lr-form-control:focus",
4609 ] );
4610 $this->add_control( "eael_field_border_radius_focus", [
4611 'label' => __( 'Border Radius', 'essential-addons-for-elementor-lite' ),
4612 'type' => Controls_Manager::DIMENSIONS,
4613 'size_units' => [
4614 'px',
4615 '%',
4616 ],
4617 'selectors' => [
4618 "{{WRAPPER}} .lr-form-wrapper .eael-lr-form-control:focus" => $this->apply_dim( 'border-radius' ),
4619 ],
4620 ] );
4621 $this->end_controls_tab();
4622 $this->end_controls_tabs();
4623 $this->end_controls_section();
4624 }
4625
4626 protected function init_style_input_labels_controls() {
4627 $this->start_controls_section( 'section_style_form_labels', [
4628 'label' => __( 'Form Labels', 'essential-addons-for-elementor-lite' ),
4629 'tab' => Controls_Manager::TAB_STYLE,
4630 ] );
4631 $this->add_control( 'eael_form_label_po_toggle', [
4632 'label' => __( 'Spacing', 'essential-addons-for-elementor-lite' ),
4633 'type' => Controls_Manager::POPOVER_TOGGLE,
4634 'label_off' => __( 'Default', 'essential-addons-for-elementor-lite' ),
4635 'label_on' => __( 'Custom', 'essential-addons-for-elementor-lite' ),
4636 'return_value' => 'yes',
4637 ] );
4638
4639 $this->start_popover();
4640 $this->add_responsive_control( "eael_form_label_margin", [
4641 'label' => __( 'Margin', 'essential-addons-for-elementor-lite' ),
4642 'type' => Controls_Manager::DIMENSIONS,
4643 'size_units' => [
4644 'px',
4645 'em',
4646 '%',
4647 ],
4648 'selectors' => [
4649 "{{WRAPPER}} .lr-form-wrapper .eael-field-label" => $this->apply_dim( 'margin' ),
4650 ],
4651 'condition' => [
4652 'eael_form_label_po_toggle' => 'yes',
4653 ],
4654 ] );
4655 $this->add_responsive_control( "eael_form_label_padding", [
4656 'label' => __( 'Padding', 'essential-addons-for-elementor-lite' ),
4657 'type' => Controls_Manager::DIMENSIONS,
4658 'size_units' => [
4659 'px',
4660 'em',
4661 '%',
4662 ],
4663 'selectors' => [
4664 "{{WRAPPER}} .lr-form-wrapper .eael-field-label" => $this->apply_dim( 'padding' ),
4665 ],
4666 'condition' => [
4667 'eael_form_label_po_toggle' => 'yes',
4668 ],
4669 ] );
4670 $this->end_popover();
4671 $this->add_group_control( Group_Control_Typography::get_type(), [
4672 'name' => "eael_label_typography",
4673 'selector' => "{{WRAPPER}} .lr-form-wrapper .eael-field-label",
4674 ] );
4675
4676 $this->add_control( 'eael_form_label_c_po_toggle', [
4677 'label' => __( 'Colors', 'essential-addons-for-elementor-lite' ),
4678 'type' => Controls_Manager::POPOVER_TOGGLE,
4679 'label_off' => __( 'Default', 'essential-addons-for-elementor-lite' ),
4680 'label_on' => __( 'Custom', 'essential-addons-for-elementor-lite' ),
4681 'return_value' => 'yes',
4682 ] );
4683
4684 $this->start_popover();
4685 $this->add_control( 'eael_label_color', [
4686 'label' => __( 'Text Color', 'essential-addons-for-elementor-lite' ),
4687 'type' => Controls_Manager::COLOR,
4688 'selectors' => [
4689 "{{WRAPPER}} .lr-form-wrapper .eael-field-label" => 'color: {{VALUE}};',
4690 ],
4691 'condition' => [
4692 'eael_form_label_c_po_toggle' => 'yes',
4693 ],
4694 ] );
4695 $this->add_control( 'eael_label_bg_color', [
4696 'label' => __( 'Background Color', 'essential-addons-for-elementor-lite' ),
4697 'type' => Controls_Manager::COLOR,
4698 'default' => '#ffffff',
4699 'selectors' => [
4700 "{{WRAPPER}} .lr-form-wrapper .eael-field-label" => 'background-color: {{VALUE}};',
4701 ],
4702 'condition' => [
4703 'eael_form_label_c_po_toggle' => 'yes',
4704 ],
4705 ] );
4706 $this->end_popover();
4707
4708 $this->add_control( 'eael_form_label_b_po_toggle', [
4709 'label' => __( 'Border', 'essential-addons-for-elementor-lite' ),
4710 'type' => Controls_Manager::POPOVER_TOGGLE,
4711 'label_off' => __( 'Default', 'essential-addons-for-elementor-lite' ),
4712 'label_on' => __( 'Custom', 'essential-addons-for-elementor-lite' ),
4713 'return_value' => 'yes',
4714 ] );
4715
4716 $this->start_popover();
4717 $this->add_group_control( Group_Control_Border::get_type(), [
4718 'name' => "eael_label_border",
4719 'selector' => "{{WRAPPER}} .lr-form-wrapper .eael-field-label",
4720 'condition' => [
4721 'eael_form_label_b_po_toggle' => 'yes',
4722 ],
4723 ] );
4724 $this->add_control( "eael_label_border_radius", [
4725 'label' => __( 'Border Radius', 'essential-addons-for-elementor-lite' ),
4726 'type' => Controls_Manager::DIMENSIONS,
4727 'size_units' => [
4728 'px',
4729 '%',
4730 ],
4731 'selectors' => [
4732 "{{WRAPPER}} .lr-form-wrapper .eael-field-label" => $this->apply_dim( 'border-radius' ),
4733 ],
4734 'condition' => [
4735 'eael_form_label_b_po_toggle' => 'yes',
4736 ],
4737 ] );
4738 $this->end_popover();
4739
4740 $this->add_control( 'rmark_po_toggle', [
4741 'label' => __( 'Required Mark Style', 'essential-addons-for-elementor-lite' ),
4742 'type' => Controls_Manager::POPOVER_TOGGLE,
4743 'condition' => [
4744 'show_labels' => 'yes',
4745 'mark_required' => 'yes',
4746 ],
4747 ] );
4748
4749 $this->start_popover();
4750 $this->add_control( 'rmark_sign', [
4751 'label' => __( 'Mark Sign', 'essential-addons-for-elementor-lite' ),
4752 'type' => Controls_Manager::TEXT,
4753 'default' => '*',
4754 'placeholder' => 'Enter * or (required) etc.',
4755 'selectors' => [
4756 "{{WRAPPER}} .eael-lr-form-wrapper .eael-lr-form-group label.mark-required:after" => 'content: "{{VALUE}}";',
4757 ],
4758 'condition' => [
4759 'rmark_po_toggle' => 'yes',
4760 ],
4761 'ai' => [
4762 'active' => true,
4763 ],
4764 ] );
4765 $this->add_control( "rmark_size", [
4766 'label' => esc_html__( 'Size', 'essential-addons-for-elementor-lite' ),
4767 'type' => Controls_Manager::SLIDER,
4768 'size_units' => [
4769 'px',
4770 'rem',
4771 '%',
4772 ],
4773 'range' => [
4774 'px' => [
4775 'min' => 0,
4776 'max' => 50,
4777 'step' => 1,
4778 ],
4779 ],
4780 'selectors' => [
4781 "{{WRAPPER}} .eael-lr-form-wrapper .eael-lr-form-group label.mark-required:after" => 'font-size: {{SIZE}}{{UNIT}};',
4782 ],
4783 'condition' => [
4784 'rmark_po_toggle' => 'yes',
4785 ],
4786 ] );
4787 $this->add_control( "rmakr_color", [
4788 'label' => __( 'Color', 'essential-addons-for-elementor-lite' ),
4789 'type' => Controls_Manager::COLOR,
4790 'selectors' => [
4791 "{{WRAPPER}} .eael-lr-form-wrapper .eael-lr-form-group label.mark-required:after" => 'color: {{VALUE}};',
4792 ],
4793 'condition' => [
4794 'rmark_po_toggle' => 'yes',
4795 ],
4796 ] );
4797
4798 $this->add_responsive_control( "rmark_valign", [
4799 'label' => esc_html__( 'Vertical Alignment', 'essential-addons-for-elementor-lite' ),
4800 'type' => Controls_Manager::SLIDER,
4801 'range' => [
4802 'px' => [
4803 'min' => - 50,
4804 'max' => 50,
4805 'step' => 0,
4806 ],
4807 ],
4808 'default' => [
4809 'unit' => 'px',
4810 'size' => 17,
4811 ],
4812 'selectors' => [
4813 "{{WRAPPER}} .eael-lr-form-wrapper .eael-lr-form-group label.mark-required:after" => 'top: {{SIZE}}px;',
4814 ],
4815 'condition' => [
4816 'rmark_po_toggle' => 'yes',
4817 ],
4818 ] );
4819 $this->add_responsive_control( "rmark_halign", [
4820 'label' => esc_html__( 'Horizontal Alignment', 'essential-addons-for-elementor-lite' ),
4821 'type' => Controls_Manager::SLIDER,
4822 'range' => [
4823 'px' => [
4824 'min' => - 50,
4825 'max' => 50,
4826 'step' => 0,
4827 ],
4828 ],
4829 'default' => [
4830 'unit' => 'px',
4831 'size' => - 10,
4832 ],
4833 'selectors' => [
4834 "{{WRAPPER}} .eael-lr-form-wrapper .eael-lr-form-group label.mark-required:after" => 'right: {{SIZE}}px;',
4835 ],
4836 'condition' => [
4837 'rmark_po_toggle' => 'yes',
4838 ],
4839 ] );
4840
4841 $this->end_popover();
4842 $this->add_control( 'lpv_po_toggle', [
4843 'label' => __( 'Password Visibility', 'essential-addons-for-elementor-lite' ),
4844 'type' => Controls_Manager::POPOVER_TOGGLE,
4845 'condition' => [
4846 'password_toggle' => 'yes',
4847 ],
4848 ] );
4849 $this->start_popover();
4850
4851 $this->add_responsive_control( "lpv_size", [
4852 'label' => esc_html__( 'Icon Size', 'essential-addons-for-elementor-lite' ),
4853 'type' => Controls_Manager::SLIDER,
4854 'size_units' => [
4855 'px',
4856 'rem',
4857 '%',
4858 ],
4859 'range' => [
4860 'px' => [
4861 'min' => 0,
4862 'max' => 50,
4863 'step' => 1,
4864 ],
4865 ],
4866 'selectors' => [
4867 "{{WRAPPER}} .eael-lr-form-wrapper.eael-login-form-wrapper .eael-lr-form-group .dashicons" => 'font-size: {{SIZE}}{{UNIT}}; height: {{SIZE}}{{UNIT}}; width: {{SIZE}}{{UNIT}}',
4868 ],
4869 'condition' => [
4870 'lpv_po_toggle' => 'yes',
4871 ],
4872 ] );
4873 $this->add_control( "lvp_open_color", [
4874 'label' => __( 'Open Eye Color', 'essential-addons-for-elementor-lite' ),
4875 'type' => Controls_Manager::COLOR,
4876 'selectors' => [
4877 "{{WRAPPER}} .eael-lr-form-wrapper.eael-login-form-wrapper .eael-lr-form-group .dashicons-visibility" => 'color: {{VALUE}};',
4878 ],
4879 'condition' => [
4880 'lpv_po_toggle' => 'yes',
4881 ],
4882 ] );
4883 $this->add_control( "lvp_close_color", [
4884 'label' => __( 'Close Eye Color', 'essential-addons-for-elementor-lite' ),
4885 'type' => Controls_Manager::COLOR,
4886 'selectors' => [
4887 "{{WRAPPER}} .eael-lr-form-wrapper.eael-login-form-wrapper .eael-lr-form-group .dashicons-hidden" => 'color: {{VALUE}};',
4888 ],
4889 'condition' => [
4890 'lpv_po_toggle' => 'yes',
4891 ],
4892 ] );
4893
4894 $this->add_responsive_control( "lpv_valign", [
4895 'label' => esc_html__( 'Vertical Alignment', 'essential-addons-for-elementor-lite' ),
4896 'type' => Controls_Manager::SLIDER,
4897 'range' => [
4898 'px' => [
4899 'min' => - 50,
4900 'max' => 50,
4901 'step' => 1,
4902 ],
4903 ],
4904 'default' => [
4905 'unit' => 'px',
4906 'size' => 0.73,
4907 ],
4908 'selectors' => [
4909 "{{WRAPPER}} .eael-lr-form-wrapper.eael-login-form-wrapper .eael-lr-form-group .wp-hide-pw" => 'top: {{SIZE}}px;',
4910 ],
4911 'condition' => [
4912 'lpv_po_toggle' => 'yes',
4913 ],
4914 ] );
4915 $this->add_responsive_control( "lpv_halign", [
4916 'label' => esc_html__( 'Horizontal Alignment', 'essential-addons-for-elementor-lite' ),
4917 'type' => Controls_Manager::SLIDER,
4918 'range' => [
4919 'px' => [
4920 'min' => - 50,
4921 'max' => 50,
4922 'step' => 1,
4923 ],
4924 ],
4925 'default' => [
4926 'unit' => 'px',
4927 'size' => - 27,
4928 ],
4929 'selectors' => [
4930 "{{WRAPPER}} .eael-lr-form-wrapper.eael-login-form-wrapper .eael-lr-form-group .wp-hide-pw" => 'right: {{SIZE}}px;',
4931 ],
4932 'condition' => [
4933 'lpv_po_toggle' => 'yes',
4934 ],
4935 ] );
4936
4937 $this->end_popover();
4938
4939 $this->add_control( 'lpv_po_toggle_register', [
4940 'label' => __( 'Register Password Visibility Style', 'essential-addons-for-elementor-lite' ),
4941 'type' => Controls_Manager::POPOVER_TOGGLE,
4942 'condition' => [
4943 'password_toggle_register' => 'yes',
4944 ],
4945 ] );
4946 $this->start_popover();
4947
4948 $this->add_responsive_control( "lpv_size_register", [
4949 'label' => esc_html__( 'Icon Size', 'essential-addons-for-elementor-lite' ),
4950 'type' => Controls_Manager::SLIDER,
4951 'size_units' => [
4952 'px',
4953 'rem',
4954 '%',
4955 ],
4956 'range' => [
4957 'px' => [
4958 'min' => 0,
4959 'max' => 50,
4960 'step' => 1,
4961 ],
4962 ],
4963 'selectors' => [
4964 "{{WRAPPER}} .eael-lr-form-wrapper.eael-register-form-wrapper .eael-lr-form-group .dashicons" => 'font-size: {{SIZE}}{{UNIT}}; height: {{SIZE}}{{UNIT}}; width: {{SIZE}}{{UNIT}}',
4965 ],
4966 'condition' => [
4967 'lpv_po_toggle_register' => 'yes',
4968 ],
4969 ] );
4970 $this->add_control( "lvp_open_color_register", [
4971 'label' => __( 'Open Eye Color', 'essential-addons-for-elementor-lite' ),
4972 'type' => Controls_Manager::COLOR,
4973 'selectors' => [
4974 "{{WRAPPER}} .eael-lr-form-wrapper.eael-register-form-wrapper .eael-lr-form-group .dashicons-visibility" => 'color: {{VALUE}};',
4975 ],
4976 'condition' => [
4977 'lpv_po_toggle_register' => 'yes',
4978 ],
4979 ] );
4980 $this->add_control( "lvp_close_color_register", [
4981 'label' => __( 'Close Eye Color', 'essential-addons-for-elementor-lite' ),
4982 'type' => Controls_Manager::COLOR,
4983 'selectors' => [
4984 "{{WRAPPER}} .eael-lr-form-wrapper.eael-register-form-wrapper .eael-lr-form-group .dashicons-hidden" => 'color: {{VALUE}};',
4985 ],
4986 'condition' => [
4987 'lpv_po_toggle_register' => 'yes',
4988 ],
4989 ] );
4990
4991 $this->add_responsive_control( "lpv_valign_register", [
4992 'label' => esc_html__( 'Vertical Alignment', 'essential-addons-for-elementor-lite' ),
4993 'type' => Controls_Manager::SLIDER,
4994 'range' => [
4995 'px' => [
4996 'min' => - 50,
4997 'max' => 50,
4998 'step' => 1,
4999 ],
5000 ],
5001 'default' => [
5002 'unit' => 'px',
5003 'size' => 0.73,
5004 ],
5005 'selectors' => [
5006 "{{WRAPPER}} .eael-lr-form-wrapper.eael-register-form-wrapper .eael-lr-form-group .wp-hide-pw" => 'top: {{SIZE}}px;',
5007 ],
5008 'condition' => [
5009 'lpv_po_toggle_register' => 'yes',
5010 ],
5011 ] );
5012 $this->add_responsive_control( "lpv_halign_register", [
5013 'label' => esc_html__( 'Horizontal Alignment', 'essential-addons-for-elementor-lite' ),
5014 'type' => Controls_Manager::SLIDER,
5015 'range' => [
5016 'px' => [
5017 'min' => - 50,
5018 'max' => 50,
5019 'step' => 1,
5020 ],
5021 ],
5022 'default' => [
5023 'unit' => 'px',
5024 'size' => - 27,
5025 ],
5026 'selectors' => [
5027 "{{WRAPPER}} .eael-lr-form-wrapper.eael-register-form-wrapper .eael-lr-form-group .wp-hide-pw" => 'right: {{SIZE}}px;',
5028 ],
5029 'condition' => [
5030 'lpv_po_toggle_register' => 'yes',
5031 ],
5032 ] );
5033
5034 $this->end_popover();
5035
5036 $this->add_control( 'lpv_po_toggle_resetpassword', [
5037 'label' => __( 'Reset Password Visibility', 'essential-addons-for-elementor-lite' ),
5038 'type' => Controls_Manager::POPOVER_TOGGLE,
5039 'condition' => [
5040 'password_toggle_resetpassword' => 'yes',
5041 ],
5042 ] );
5043 $this->start_popover();
5044
5045 $this->add_responsive_control( "lpv_size_resetpassword", [
5046 'label' => esc_html__( 'Icon Size', 'essential-addons-for-elementor-lite' ),
5047 'type' => Controls_Manager::SLIDER,
5048 'size_units' => [
5049 'px',
5050 'rem',
5051 '%',
5052 ],
5053 'range' => [
5054 'px' => [
5055 'min' => 0,
5056 'max' => 50,
5057 'step' => 1,
5058 ],
5059 ],
5060 'selectors' => [
5061 "{{WRAPPER}} .eael-lr-form-wrapper.eael-resetpassword-form-wrapper .eael-lr-form-group .dashicons" => 'font-size: {{SIZE}}{{UNIT}}; height: {{SIZE}}{{UNIT}}; width: {{SIZE}}{{UNIT}}',
5062 ],
5063 'condition' => [
5064 'lpv_po_toggle_resetpassword' => 'yes',
5065 ],
5066 ] );
5067 $this->add_control( "lvp_open_color_resetpassword", [
5068 'label' => __( 'Open Eye Color', 'essential-addons-for-elementor-lite' ),
5069 'type' => Controls_Manager::COLOR,
5070 'selectors' => [
5071 "{{WRAPPER}} .eael-lr-form-wrapper.eael-resetpassword-form-wrapper .eael-lr-form-group .dashicons-visibility" => 'color: {{VALUE}};',
5072 ],
5073 'condition' => [
5074 'lpv_po_toggle_resetpassword' => 'yes',
5075 ],
5076 ] );
5077 $this->add_control( "lvp_close_color_resetpassword", [
5078 'label' => __( 'Close Eye Color', 'essential-addons-for-elementor-lite' ),
5079 'type' => Controls_Manager::COLOR,
5080 'selectors' => [
5081 "{{WRAPPER}} .eael-lr-form-wrapper.eael-resetpassword-form-wrapper .eael-lr-form-group .dashicons-hidden" => 'color: {{VALUE}};',
5082 ],
5083 'condition' => [
5084 'lpv_po_toggle_resetpassword' => 'yes',
5085 ],
5086 ] );
5087
5088 $this->add_responsive_control( "lpv_valign_resetpassword", [
5089 'label' => esc_html__( 'Vertical Alignment', 'essential-addons-for-elementor-lite' ),
5090 'type' => Controls_Manager::SLIDER,
5091 'range' => [
5092 'px' => [
5093 'min' => - 50,
5094 'max' => 50,
5095 'step' => 1,
5096 ],
5097 ],
5098 'default' => [
5099 'unit' => 'px',
5100 'size' => 0.73,
5101 ],
5102 'selectors' => [
5103 "{{WRAPPER}} .eael-lr-form-wrapper.eael-resetpassword-form-wrapper .eael-lr-form-group .wp-hide-pw" => 'top: {{SIZE}}px;',
5104 ],
5105 'condition' => [
5106 'lpv_po_toggle_resetpassword' => 'yes',
5107 ],
5108 ] );
5109 $this->add_responsive_control( "lpv_halign_resetpassword", [
5110 'label' => esc_html__( 'Horizontal Alignment', 'essential-addons-for-elementor-lite' ),
5111 'type' => Controls_Manager::SLIDER,
5112 'range' => [
5113 'px' => [
5114 'min' => - 50,
5115 'max' => 50,
5116 'step' => 1,
5117 ],
5118 ],
5119 'default' => [
5120 'unit' => 'px',
5121 'size' => - 27,
5122 ],
5123 'selectors' => [
5124 "{{WRAPPER}} .eael-lr-form-wrapper.eael-resetpassword-form-wrapper .eael-lr-form-group .wp-hide-pw" => 'right: {{SIZE}}px;',
5125 ],
5126 'condition' => [
5127 'lpv_po_toggle_resetpassword' => 'yes',
5128 ],
5129 ] );
5130
5131 $this->end_popover();
5132
5133 //Remember Me Style
5134 $this->add_control( 'eael_form_rm_fields_heading', [
5135 'type' => Controls_Manager::HEADING,
5136 'label' => __( 'Remember Me', 'essential-addons-for-elementor-lite' ),
5137 'separator' => 'before',
5138 ] );
5139 $this->add_control( 'remember_me_style_pot', [
5140 'label' => __( 'Style', 'essential-addons-for-elementor-lite' ),
5141 'type' => Controls_Manager::POPOVER_TOGGLE,
5142 'label_off' => __( 'Default', 'essential-addons-for-elementor-lite' ),
5143 'label_on' => __( 'Custom', 'essential-addons-for-elementor-lite' ),
5144 'return_value' => 'yes',
5145 'condition' => [
5146 'login_show_remember_me' => 'yes',
5147 ],
5148 ] );
5149
5150 $this->start_popover();
5151 $this->add_control( 'remember_me_style', [
5152 'label' => __( 'Style', 'essential-addons-for-elementor-lite' ),
5153 'type' => Controls_Manager::SELECT,
5154 'default' => 'lr-checkbox',
5155 'options' => [
5156 'lr-checkbox' => __( 'Checkbox', 'essential-addons-for-elementor-lite' ),
5157 'lr-toggle' => __( 'Toggle', 'essential-addons-for-elementor-lite' ),
5158 ],
5159 'condition' => [
5160 'remember_me_style_pot' => 'yes',
5161 ],
5162 'separator' => 'before',
5163 ] );
5164
5165 $this->add_responsive_control( "eael_form_rm_field_margin", [
5166 'label' => __( 'Container Margin', 'essential-addons-for-elementor-lite' ),
5167 'type' => Controls_Manager::DIMENSIONS,
5168 'size_units' => [
5169 'px',
5170 'em',
5171 '%',
5172 ],
5173 'selectors' => [
5174 "{{WRAPPER}} .lr-form-wrapper .eael-forever-forget" => $this->apply_dim( 'margin' ),
5175 ],
5176 'condition' => [
5177 'remember_me_style_pot' => 'yes',
5178 ],
5179 ] );
5180 $this->add_responsive_control( "eael_form_rm_field_padding", [
5181 'label' => __( 'Container Padding', 'essential-addons-for-elementor-lite' ),
5182 'type' => Controls_Manager::DIMENSIONS,
5183 'size_units' => [
5184 'px',
5185 'em',
5186 '%',
5187 ],
5188 'selectors' => [
5189 "{{WRAPPER}} .lr-form-wrapper .eael-forever-forget" => $this->apply_dim( 'padding' ),
5190 ],
5191 'condition' => [
5192 'remember_me_style_pot' => 'yes',
5193 ],
5194 ] );
5195 $this->add_responsive_control( "eael_form_rm_lbl_margin", [
5196 'label' => __( 'Label Margin', 'essential-addons-for-elementor-lite' ),
5197 'type' => Controls_Manager::DIMENSIONS,
5198 'size_units' => [
5199 'px',
5200 'em',
5201 '%',
5202 ],
5203 'selectors' => [
5204 "{{WRAPPER}} .lr-form-wrapper .forget-menot label" => $this->apply_dim( 'margin' ),
5205 ],
5206 'condition' => [
5207 'remember_me_style_pot' => 'yes',
5208 ],
5209 ] );
5210 $this->add_responsive_control( "eael_form_rm_lbl_padding", [
5211 'label' => __( 'Label Padding', 'essential-addons-for-elementor-lite' ),
5212 'type' => Controls_Manager::DIMENSIONS,
5213 'size_units' => [
5214 'px',
5215 'em',
5216 '%',
5217 ],
5218 'selectors' => [
5219 "{{WRAPPER}} .lr-form-wrapper .forget-menot" => $this->apply_dim( 'padding' ),
5220 ],
5221 'condition' => [
5222 'remember_me_style_pot' => 'yes',
5223 ],
5224 ] );
5225
5226 $this->add_responsive_control( "eael_form_rm_checkbox_margin", [
5227 'label' => __( 'Checkbox Margin', 'essential-addons-for-elementor-lite' ),
5228 'type' => Controls_Manager::DIMENSIONS,
5229 'size_units' => [
5230 'px',
5231 'em',
5232 '%',
5233 ],
5234 'selectors' => [
5235 "{{WRAPPER}} .lr-form-wrapper .forget-menot input" => $this->apply_dim( 'margin' ),
5236 ],
5237 'condition' => [
5238 'remember_me_style_pot' => 'yes',
5239 ],
5240 ] );
5241
5242 $this->add_control( 'eael_rm_label_color', [
5243 'label' => __( 'Text Color', 'essential-addons-for-elementor-lite' ),
5244 'type' => Controls_Manager::COLOR,
5245 'selectors' => [
5246 "{{WRAPPER}} .lr-form-wrapper .forget-menot" => 'color: {{VALUE}};',
5247 ],
5248 'condition' => [
5249 'remember_me_style_pot' => 'yes',
5250 ],
5251 ] );
5252 $this->add_control( 'eael_rm_label_bg_color', [
5253 'label' => __( 'Text Background', 'essential-addons-for-elementor-lite' ),
5254 'type' => Controls_Manager::COLOR,
5255 'default' => '#ffffff',
5256 'selectors' => [
5257 "{{WRAPPER}} .lr-form-wrapper .forget-menot" => 'background-color: {{VALUE}};',
5258 ],
5259 'condition' => [
5260 'remember_me_style_pot' => 'yes',
5261 ],
5262 ] );
5263 $this->add_control( 'eael_rm_checkbox_color', [
5264 'label' => __( 'Checkbox | Toggle Color', 'essential-addons-for-elementor-lite' ),
5265 'type' => Controls_Manager::COLOR,
5266 'selectors' => [
5267 "{{WRAPPER}} .lr-form-wrapper .eael-forever-forget .forget-menot input[type=checkbox]:checked" => 'border-color: {{VALUE}} !important;background: {{VALUE}} !important;',
5268 "{{WRAPPER}} .lr-form-wrapper .eael-forever-forget input[type=checkbox]:hover:not(:checked):not(:disabled)" => 'border-color: {{VALUE}} !important;',
5269 ],
5270 'condition' => [
5271 'remember_me_style_pot' => 'yes',
5272 ],
5273 ] );
5274 $this->end_popover();
5275 $this->add_group_control( Group_Control_Typography::get_type(), [
5276 'label' => __( 'Typography', 'essential-addons-for-elementor-lite' ),
5277 'name' => "eael_rm_label_typography",
5278 'selector' => "{{WRAPPER}} .lr-form-wrapper .forget-menot, {{WRAPPER}} .lr-form-wrapper .forget-menot label",
5279 ] );
5280
5281 //Forget Password Style
5282 $this->add_control( 'eael_form_forget_pass_fields_heading', [
5283 'type' => Controls_Manager::HEADING,
5284 'label' => __( 'Forgot Password', 'essential-addons-for-elementor-lite' ),
5285 'separator' => 'before',
5286 ] );
5287 $this->add_control( 'forget_pass_style_pot', [
5288 'label' => __( 'Style', 'essential-addons-for-elementor-lite' ),
5289 'type' => Controls_Manager::POPOVER_TOGGLE,
5290 'label_off' => __( 'Default', 'essential-addons-for-elementor-lite' ),
5291 'label_on' => __( 'Custom', 'essential-addons-for-elementor-lite' ),
5292 'return_value' => 'yes',
5293 ] );
5294
5295 $this->start_popover();
5296
5297 $this->add_responsive_control( "eael_form_forget_pass_field_margin", [
5298 'label' => __( 'Container Margin', 'essential-addons-for-elementor-lite' ),
5299 'type' => Controls_Manager::DIMENSIONS,
5300 'size_units' => [
5301 'px',
5302 'em',
5303 '%',
5304 ],
5305 'selectors' => [
5306 "{{WRAPPER}} .lr-form-wrapper .eael-forever-forget" => $this->apply_dim( 'margin' ),
5307 ],
5308 'condition' => [
5309 'forget_pass_style_pot' => 'yes',
5310 ],
5311 ] );
5312 $this->add_responsive_control( "eael_form_forget_pass_field_padding", [
5313 'label' => __( 'Container Padding', 'essential-addons-for-elementor-lite' ),
5314 'type' => Controls_Manager::DIMENSIONS,
5315 'size_units' => [
5316 'px',
5317 'em',
5318 '%',
5319 ],
5320 'selectors' => [
5321 "{{WRAPPER}} .lr-form-wrapper .eael-forever-forget" => $this->apply_dim( 'padding' ),
5322 ],
5323 'condition' => [
5324 'forget_pass_style_pot' => 'yes',
5325 ],
5326 ] );
5327 $this->add_responsive_control( "eael_form_forget_pass_lbl_margin", [
5328 'label' => __( 'Label Margin', 'essential-addons-for-elementor-lite' ),
5329 'type' => Controls_Manager::DIMENSIONS,
5330 'size_units' => [
5331 'px',
5332 'em',
5333 '%',
5334 ],
5335 'selectors' => [
5336 "{{WRAPPER}} .lr-form-wrapper .forget-pass" => $this->apply_dim( 'margin' ),
5337 ],
5338 'condition' => [
5339 'forget_pass_style_pot' => 'yes',
5340 ],
5341 ] );
5342 $this->add_responsive_control( "eael_form_forget_pass_lbl_padding", [
5343 'label' => __( 'Label Padding', 'essential-addons-for-elementor-lite' ),
5344 'type' => Controls_Manager::DIMENSIONS,
5345 'size_units' => [
5346 'px',
5347 'em',
5348 '%',
5349 ],
5350 'selectors' => [
5351 "{{WRAPPER}} .lr-form-wrapper .forget-pass" => $this->apply_dim( 'padding' ),
5352 ],
5353 'condition' => [
5354 'forget_pass_style_pot' => 'yes',
5355 ],
5356 ] );
5357
5358 $this->add_control( 'eael_forget_pass_label_color_normal', [
5359 'label' => __( 'Color', 'essential-addons-for-elementor-lite' ),
5360 'type' => Controls_Manager::COLOR,
5361 'selectors' => [
5362 "{{WRAPPER}} .lr-form-wrapper .forget-pass a" => 'color: {{VALUE}};',
5363 ],
5364 'separator' => 'before',
5365 'condition' => [
5366 'forget_pass_style_pot' => 'yes',
5367 ],
5368 ] );
5369 $this->add_control( 'eael_forget_pass_label_bg_color_normal', [
5370 'label' => __( 'Background Color', 'essential-addons-for-elementor-lite' ),
5371 'type' => Controls_Manager::COLOR,
5372 'default' => '#ffffff',
5373 'selectors' => [
5374 "{{WRAPPER}} .lr-form-wrapper .forget-pass" => 'background-color: {{VALUE}};',
5375 ],
5376 'condition' => [
5377 'forget_pass_style_pot' => 'yes',
5378 ],
5379 ] );
5380
5381 $this->add_control( 'eael_forget_pass_label_color_hover', [
5382 'label' => __( 'Hover Color', 'essential-addons-for-elementor-lite' ),
5383 'type' => Controls_Manager::COLOR,
5384 'selectors' => [
5385 "{{WRAPPER}} .lr-form-wrapper .forget-pass:hover a" => 'color: {{VALUE}};',
5386 ],
5387 'condition' => [
5388 'forget_pass_style_pot' => 'yes',
5389 ],
5390 ] );
5391 $this->add_control( 'eael_forget_pass_label_bg_color_hover', [
5392 'label' => __( 'Background Hover Color', 'essential-addons-for-elementor-lite' ),
5393 'type' => Controls_Manager::COLOR,
5394 'default' => '#ffffff',
5395 'selectors' => [
5396 "{{WRAPPER}} .lr-form-wrapper .forget-pass:hover" => 'background-color: {{VALUE}};',
5397 ],
5398 'condition' => [
5399 'forget_pass_style_pot' => 'yes',
5400 ],
5401 ] );
5402
5403 $this->end_popover();
5404 $this->add_group_control( Group_Control_Typography::get_type(), [
5405 'label' => __( 'Typography', 'essential-addons-for-elementor-lite' ),
5406 'name' => "eael_forget_pass_label_typography",
5407 'selector' => "{{WRAPPER}} .lr-form-wrapper .forget-pass a",
5408 ] );
5409
5410 //Terms & Conditions Style
5411 $this->add_control( 'eael_form_terms_fields_heading', [
5412 'type' => Controls_Manager::HEADING,
5413 'label' => __( 'Terms & Conditions', 'essential-addons-for-elementor-lite' ),
5414 'separator' => 'before',
5415 ] );
5416 $this->add_control( 'terms_conditions_style_pot', [
5417 'label' => __( 'Style', 'essential-addons-for-elementor-lite' ),
5418 'type' => Controls_Manager::POPOVER_TOGGLE,
5419 'label_off' => __( 'Default', 'essential-addons-for-elementor-lite' ),
5420 'label_on' => __( 'Custom', 'essential-addons-for-elementor-lite' ),
5421 'return_value' => 'yes',
5422 'condition' => [
5423 'show_terms_conditions' => 'yes',
5424 ],
5425 ] );
5426
5427 $this->start_popover();
5428 $this->add_responsive_control( "eael_form_terms_field_margin", [
5429 'label' => __( 'Container Margin', 'essential-addons-for-elementor-lite' ),
5430 'type' => Controls_Manager::DIMENSIONS,
5431 'size_units' => [
5432 'px',
5433 'em',
5434 '%',
5435 ],
5436 'selectors' => [
5437 "{{WRAPPER}} .lr-form-wrapper .eael_accept_tnc_wrap" => $this->apply_dim( 'margin' ),
5438 ],
5439 'condition' => [
5440 'terms_conditions_style_pot' => 'yes',
5441 ],
5442 ] );
5443 $this->add_responsive_control( "eael_form_terms_field_padding", [
5444 'label' => __( 'Container Padding', 'essential-addons-for-elementor-lite' ),
5445 'type' => Controls_Manager::DIMENSIONS,
5446 'size_units' => [
5447 'px',
5448 'em',
5449 '%',
5450 ],
5451 'selectors' => [
5452 "{{WRAPPER}} .lr-form-wrapper .eael_accept_tnc_wrap" => $this->apply_dim( 'padding' ),
5453 ],
5454 'condition' => [
5455 'terms_conditions_style_pot' => 'yes',
5456 ],
5457 ] );
5458 $this->add_responsive_control( "eael_form_terms_lbl_margin", [
5459 'label' => __( 'Label Margin', 'essential-addons-for-elementor-lite' ),
5460 'type' => Controls_Manager::DIMENSIONS,
5461 'size_units' => [
5462 'px',
5463 'em',
5464 '%',
5465 ],
5466 'selectors' => [
5467 "{{WRAPPER}} .lr-form-wrapper .eael_accept_tnc_wrap label" => $this->apply_dim( 'margin' ),
5468 "{{WRAPPER}} .lr-form-wrapper .eael_accept_tnc_wrap a" => $this->apply_dim( 'margin' ),
5469 ],
5470 'condition' => [
5471 'terms_conditions_style_pot' => 'yes',
5472 ],
5473 ] );
5474 $this->add_responsive_control( "eael_form_terms_lbl_padding", [
5475 'label' => __( 'Label Padding', 'essential-addons-for-elementor-lite' ),
5476 'type' => Controls_Manager::DIMENSIONS,
5477 'size_units' => [
5478 'px',
5479 'em',
5480 '%',
5481 ],
5482 'selectors' => [
5483 "{{WRAPPER}} .lr-form-wrapper .eael_accept_tnc_wrap label" => $this->apply_dim( 'padding' ),
5484 "{{WRAPPER}} .lr-form-wrapper .eael_accept_tnc_wrap a" => $this->apply_dim( 'padding' ),
5485 ],
5486 'condition' => [
5487 'terms_conditions_style_pot' => 'yes',
5488 ],
5489 ] );
5490
5491 $this->add_responsive_control( "eael_form_terms_checkbox_margin", [
5492 'label' => __( 'Checkbox Margin', 'essential-addons-for-elementor-lite' ),
5493 'type' => Controls_Manager::DIMENSIONS,
5494 'size_units' => [
5495 'px',
5496 'em',
5497 '%',
5498 ],
5499 'selectors' => [
5500 "{{WRAPPER}} .lr-form-wrapper .eael_accept_tnc_wrap input" => $this->apply_dim( 'margin' ),
5501 ],
5502 'condition' => [
5503 'terms_conditions_style_pot' => 'yes',
5504 ],
5505 ] );
5506
5507 $this->add_control( 'eael_terms_label_color', [
5508 'label' => __( 'Color', 'essential-addons-for-elementor-lite' ),
5509 'type' => Controls_Manager::COLOR,
5510 'selectors' => [
5511 "{{WRAPPER}} .lr-form-wrapper .eael_accept_tnc_wrap" => 'color: {{VALUE}};',
5512 ],
5513 'condition' => [
5514 'terms_conditions_style_pot' => 'yes',
5515 ],
5516 ] );
5517
5518 $this->add_control( 'eael_terms_label_link_color', [
5519 'label' => __( 'Link Color', 'essential-addons-for-elementor-lite' ),
5520 'type' => Controls_Manager::COLOR,
5521 'selectors' => [
5522 "{{WRAPPER}} .lr-form-wrapper .eael_accept_tnc_wrap a" => 'color: {{VALUE}};',
5523 ],
5524 'condition' => [
5525 'terms_conditions_style_pot' => 'yes',
5526 ],
5527 ] );
5528
5529 $this->add_control( 'eael_terms_label_bg_color', [
5530 'label' => __( 'Background Color', 'essential-addons-for-elementor-lite' ),
5531 'type' => Controls_Manager::COLOR,
5532 'default' => '#ffffff',
5533 'selectors' => [
5534 "{{WRAPPER}} .lr-form-wrapper .eael_accept_tnc_wrap" => 'background-color: {{VALUE}};',
5535 ],
5536 'condition' => [
5537 'terms_conditions_style_pot' => 'yes',
5538 ],
5539 ] );
5540 $this->add_control( 'eael_terms_checkbox_color', [
5541 'label' => __( 'Checkbox | Toggle Color', 'essential-addons-for-elementor-lite' ),
5542 'type' => Controls_Manager::COLOR,
5543 'selectors' => [
5544 "{{WRAPPER}} .lr-form-wrapper .eael_accept_tnc_wrap input[type=checkbox]:checked" => 'border-color: {{VALUE}} !important; background: {{VALUE}} !important;',
5545 "{{WRAPPER}} .lr-form-wrapper .eael_accept_tnc_wrap input[type=checkbox]:hover:not(:checked):not(:disabled)" => 'border-color: {{VALUE}} !important;',
5546 ],
5547 'condition' => [
5548 'terms_conditions_style_pot' => 'yes',
5549 ],
5550 ] );
5551 $this->end_popover();
5552 $this->add_group_control( Group_Control_Typography::get_type(), [
5553 'label' => __( 'Typography', 'essential-addons-for-elementor-lite' ),
5554 'name' => "eael_terms_label_typography",
5555 'selector' => "{{WRAPPER}} .lr-form-wrapper .eael_accept_tnc_wrap, {{WRAPPER}} .lr-form-wrapper .eael_accept_tnc_wrap label",
5556 ] );
5557
5558 $this->end_controls_section();
5559 }
5560
5561 protected function init_style_login_button_controls() {
5562 $this->_init_button_style( 'login' );
5563 }
5564
5565 protected function init_style_register_button_controls() {
5566 $this->_init_button_style( 'register' );
5567 }
5568
5569 protected function init_style_lostpassword_button_controls() {
5570 $this->_init_button_style( 'lostpassword' );
5571 }
5572
5573 protected function init_style_resetpassword_button_controls() {
5574 $this->_init_button_style( 'resetpassword' );
5575 }
5576
5577 protected function init_style_login_link_controls() {
5578 $this->_init_link_style( 'login' );
5579 }
5580
5581 protected function init_style_register_link_controls() {
5582 $link_section_conditions = [
5583 'relation' => 'or',
5584 'terms' => [
5585 [
5586 'name' => 'show_register_link',
5587 'value' => 'yes',
5588 ],
5589 [
5590 'relation' => 'and',
5591 'terms' => [
5592 [
5593 'name' => 'show_lost_password',
5594 'value' => 'yes',
5595 ],
5596 [
5597 'name' => 'lost_password_link_type',
5598 'value' => 'form',
5599 ],
5600 [
5601 'name' => 'show_login_link_lostpassword',
5602 'value' => 'yes',
5603 ],
5604 ]
5605 ],
5606 [
5607 'relation' => 'and',
5608 'terms' => [
5609 [
5610 'name' => 'default_form_type',
5611 'value' => 'lostpassword',
5612 ],
5613 [
5614 'name' => 'show_login_link_lostpassword',
5615 'value' => 'yes',
5616 ],
5617 ]
5618 ],
5619
5620 ],
5621 ];
5622
5623 $this->start_controls_section( "section_style_register_link", [
5624 'label' => sprintf(
5625 /* translators: %s: Link label text. */
5626 __( '%s Link', 'essential-addons-for-elementor-lite' ),
5627 esc_html( ucfirst( 'Login' ) )
5628 ),
5629 'tab' => Controls_Manager::TAB_STYLE,
5630 'conditions' => $link_section_conditions,
5631 ] );
5632
5633 if( $this->user_can_register ) {
5634 $this->_init_link_style( 'register', 0 );
5635
5636 $this->add_control('separator_login_link_for_two_forms',
5637 [
5638 'type' => Controls_Manager::RAW_HTML,
5639 'separator' => 'before'
5640 ]);
5641 }
5642
5643 $this->_init_link_style( 'lostpassword', 0 );
5644
5645 $this->end_controls_section();
5646 }
5647
5648 protected function init_style_login_recaptcha_controls() {
5649 $this->_init_recaptcha_style( 'login' );
5650 }
5651
5652 protected function init_style_register_recaptcha_controls() {
5653 $this->_init_recaptcha_style( 'register' );
5654 }
5655
5656 protected function init_style_lostpassword_recaptcha_controls() {
5657 $this->_init_recaptcha_style( 'lostpassword' );
5658 }
5659
5660 /**
5661 * Style controls for the Email OTP Verification UI.
5662 */
5663 protected function init_style_otp_controls() {
5664 $this->start_controls_section( 'section_style_otp', [
5665 'label' => __( 'Email OTP Verification', 'essential-addons-for-elementor-lite' ),
5666 'tab' => Controls_Manager::TAB_STYLE,
5667 'conditions' => [
5668 'relation' => 'or',
5669 'terms' => [
5670 [
5671 'name' => 'enable_login_otp',
5672 'value' => 'yes',
5673 'operator' => '===',
5674 ],
5675 [
5676 'name' => 'enable_register_otp',
5677 'value' => 'yes',
5678 'operator' => '===',
5679 ],
5680 ],
5681 ],
5682 ] );
5683
5684 /*
5685 * Editor-only preview switcher.
5686 *
5687 * Login and register share the same OTP UI component, so one switcher drives both.
5688 * `render_type => 'template'` re-renders the widget when toggled. The value is
5689 * persisted by Elementor but deliberately ignored on the live frontend
5690 * (see eael_otp_active_flow() — gated by `$this->in_editor`), so even though it's
5691 * saved to the database it has zero effect outside the editor canvas.
5692 *
5693 * In the editor canvas, when this is on, the OTP UI is revealed for whichever form
5694 * is currently visible: the configured default form first, then any form that has
5695 * its own OTP toggle on.
5696 */
5697 $this->add_control( 'otp_preview', [
5698 'label' => __( 'Preview OTP Field', 'essential-addons-for-elementor-lite' ),
5699 'description' => __( 'Editor only — force the OTP verification field to be visible so you can style it without triggering a real email. Reveals the OTP UI on whichever form is currently visible. Has no effect on the live site.', 'essential-addons-for-elementor-lite' ),
5700 'type' => Controls_Manager::SWITCHER,
5701 'label_on' => __( 'On', 'essential-addons-for-elementor-lite' ),
5702 'label_off' => __( 'Off', 'essential-addons-for-elementor-lite' ),
5703 'return_value' => 'yes',
5704 'default' => '',
5705 'render_type' => 'template',
5706 ] );
5707
5708 $this->add_responsive_control( 'otp_container_padding', [
5709 'label' => __( 'Container Padding', 'essential-addons-for-elementor-lite' ),
5710 'type' => Controls_Manager::DIMENSIONS,
5711 'size_units' => [ 'px', 'em', '%' ],
5712 'selectors' => [
5713 '{{WRAPPER}} .eael-lr-otp-wrapper' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
5714 ],
5715 ] );
5716
5717 $this->add_control( 'otp_container_bg', [
5718 'label' => __( 'Container Background', 'essential-addons-for-elementor-lite' ),
5719 'type' => Controls_Manager::COLOR,
5720 'selectors' => [
5721 '{{WRAPPER}} .eael-lr-otp-wrapper' => 'background-color: {{VALUE}};',
5722 ],
5723 ] );
5724
5725 $this->add_group_control( Group_Control_Border::get_type(), [
5726 'name' => 'otp_container_border',
5727 'selector' => '{{WRAPPER}} .eael-lr-otp-wrapper',
5728 ] );
5729
5730 $this->add_control( 'otp_title_heading', [
5731 'label' => __( 'Title', 'essential-addons-for-elementor-lite' ),
5732 'type' => Controls_Manager::HEADING,
5733 'separator' => 'before',
5734 ] );
5735
5736 $this->add_control( 'otp_title_color', [
5737 'label' => __( 'Title Color', 'essential-addons-for-elementor-lite' ),
5738 'type' => Controls_Manager::COLOR,
5739 'selectors' => [
5740 '{{WRAPPER}} .eael-lr-otp-title' => 'color: {{VALUE}};',
5741 ],
5742 ] );
5743
5744 $this->add_group_control( Group_Control_Typography::get_type(), [
5745 'name' => 'otp_title_typography',
5746 'selector' => '{{WRAPPER}} .eael-lr-otp-title',
5747 ] );
5748
5749 $this->add_control( 'otp_subtitle_heading', [
5750 'label' => __( 'Subtitle', 'essential-addons-for-elementor-lite' ),
5751 'type' => Controls_Manager::HEADING,
5752 'separator' => 'before',
5753 ] );
5754
5755 $this->add_control( 'otp_subtitle_color', [
5756 'label' => __( 'Subtitle Color', 'essential-addons-for-elementor-lite' ),
5757 'type' => Controls_Manager::COLOR,
5758 'selectors' => [
5759 '{{WRAPPER}} .eael-lr-otp-subtitle' => 'color: {{VALUE}};',
5760 ],
5761 ] );
5762
5763 $this->add_group_control( Group_Control_Typography::get_type(), [
5764 'name' => 'otp_subtitle_typography',
5765 'selector' => '{{WRAPPER}} .eael-lr-otp-subtitle',
5766 ] );
5767
5768 $this->add_control( 'otp_input_heading', [
5769 'label' => __( 'Input Field', 'essential-addons-for-elementor-lite' ),
5770 'type' => Controls_Manager::HEADING,
5771 'separator' => 'before',
5772 ] );
5773
5774 $this->add_control( 'otp_input_color', [
5775 'label' => __( 'Input Text Color', 'essential-addons-for-elementor-lite' ),
5776 'type' => Controls_Manager::COLOR,
5777 'selectors' => [
5778 '{{WRAPPER}} .eael-lr-otp-input' => 'color: {{VALUE}};',
5779 ],
5780 ] );
5781
5782 $this->add_control( 'otp_input_bg', [
5783 'label' => __( 'Input Background', 'essential-addons-for-elementor-lite' ),
5784 'type' => Controls_Manager::COLOR,
5785 'selectors' => [
5786 '{{WRAPPER}} .eael-lr-otp-input' => 'background-color: {{VALUE}};',
5787 ],
5788 ] );
5789
5790 $this->add_group_control( Group_Control_Typography::get_type(), [
5791 'name' => 'otp_input_typography',
5792 'selector' => '{{WRAPPER}} .eael-lr-otp-input',
5793 ] );
5794
5795 $this->add_group_control( Group_Control_Border::get_type(), [
5796 'name' => 'otp_input_border',
5797 'selector' => '{{WRAPPER}} .eael-lr-otp-input',
5798 ] );
5799
5800 $this->add_responsive_control( 'otp_input_padding', [
5801 'label' => __( 'Input Padding', 'essential-addons-for-elementor-lite' ),
5802 'type' => Controls_Manager::DIMENSIONS,
5803 'size_units' => [ 'px', 'em', '%' ],
5804 'selectors' => [
5805 '{{WRAPPER}} .eael-lr-otp-input' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
5806 ],
5807 ] );
5808
5809 $this->add_control( 'otp_button_heading', [
5810 'label' => __( 'Verify Button', 'essential-addons-for-elementor-lite' ),
5811 'type' => Controls_Manager::HEADING,
5812 'separator' => 'before',
5813 ] );
5814
5815 $this->add_control( 'otp_button_color', [
5816 'label' => __( 'Button Text Color', 'essential-addons-for-elementor-lite' ),
5817 'type' => Controls_Manager::COLOR,
5818 'selectors' => [
5819 '{{WRAPPER}} .eael-lr-otp-verify-btn' => 'color: {{VALUE}};',
5820 ],
5821 ] );
5822
5823 $this->add_control( 'otp_button_bg', [
5824 'label' => __( 'Button Background', 'essential-addons-for-elementor-lite' ),
5825 'type' => Controls_Manager::COLOR,
5826 'selectors' => [
5827 '{{WRAPPER}} .eael-lr-otp-verify-btn' => 'background-color: {{VALUE}};',
5828 ],
5829 ] );
5830
5831 $this->add_group_control( Group_Control_Typography::get_type(), [
5832 'name' => 'otp_button_typography',
5833 'selector' => '{{WRAPPER}} .eael-lr-otp-verify-btn',
5834 ] );
5835
5836 $this->add_group_control( Group_Control_Border::get_type(), [
5837 'name' => 'otp_button_border',
5838 'selector' => '{{WRAPPER}} .eael-lr-otp-verify-btn',
5839 ] );
5840
5841 $this->add_responsive_control( 'otp_button_padding', [
5842 'label' => __( 'Button Padding', 'essential-addons-for-elementor-lite' ),
5843 'type' => Controls_Manager::DIMENSIONS,
5844 'size_units' => [ 'px', 'em', '%' ],
5845 'selectors' => [
5846 '{{WRAPPER}} .eael-lr-otp-verify-btn' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
5847 ],
5848 ] );
5849
5850 $this->add_control( 'otp_resend_heading', [
5851 'label' => __( 'Resend Link', 'essential-addons-for-elementor-lite' ),
5852 'type' => Controls_Manager::HEADING,
5853 'separator' => 'before',
5854 ] );
5855
5856 $this->add_control( 'otp_resend_color', [
5857 'label' => __( 'Resend Link Color', 'essential-addons-for-elementor-lite' ),
5858 'type' => Controls_Manager::COLOR,
5859 'selectors' => [
5860 '{{WRAPPER}} .eael-lr-otp-resend' => 'color: {{VALUE}};',
5861 ],
5862 ] );
5863
5864 $this->add_group_control( Group_Control_Typography::get_type(), [
5865 'name' => 'otp_resend_typography',
5866 'selector' => '{{WRAPPER}} .eael-lr-otp-resend',
5867 ] );
5868
5869 $this->end_controls_section();
5870 }
5871
5872 /**
5873 * Print style controls for a specific type of button.
5874 *
5875 * @param string $button_type the type of the button. accepts login or register.
5876 */
5877 protected function _init_button_style( $button_type = 'login' ) {
5878 $button_text = 'lostpassword' === $button_type ? esc_html__('Lost Password', 'essential-addons-for-elementor-lite') : ucfirst( $button_type );
5879 $button_text = 'resetpassword' === $button_type ? esc_html__('Reset Password', 'essential-addons-for-elementor-lite') : $button_text;
5880
5881 $this->start_controls_section( "section_style_{$button_type}_btn", [
5882 'label' => sprintf(
5883 /* translators: %s: Button text to display in the label. */
5884 __( '%s Button', 'essential-addons-for-elementor-lite' ),
5885 esc_html( $button_text )
5886 ),
5887 'tab' => Controls_Manager::TAB_STYLE,
5888 'conditions' => $this->get_form_controls_display_condition( $button_type ),
5889 ] );
5890
5891 $this->add_control( "{$button_type}_button_style_notice", [
5892 'type' => Controls_Manager::RAW_HTML,
5893 'raw' => sprintf(
5894 /* translators: %s: Button text displayed on the form. */
5895 __( 'Here you can style the button displayed on the %s Form', 'essential-addons-for-elementor-lite' ),
5896 esc_html( $button_text )
5897 ),
5898 'content_classes' => 'elementor-panel-alert elementor-panel-alert-info',
5899 ] );
5900
5901 $this->add_control(
5902 "{$button_type}_btn_pot",
5903 [
5904 'label' => __( 'Spacing', 'essential-addons-for-elementor-lite' ),
5905 'type' => Controls_Manager::POPOVER_TOGGLE,
5906 'label_off' => __( 'Default', 'essential-addons-for-elementor-lite' ),
5907 'label_on' => __( 'Custom', 'essential-addons-for-elementor-lite' ),
5908 'return_value' => 'yes',
5909 ] );
5910
5911 $this->start_popover();
5912
5913 $this->add_responsive_control( "{$button_type}_btn_margin", [
5914 'label' => __( 'Margin', 'essential-addons-for-elementor-lite' ),
5915 'type' => Controls_Manager::DIMENSIONS,
5916 'size_units' => [
5917 'px',
5918 'em',
5919 '%',
5920 ],
5921 'selectors' => [
5922 "{{WRAPPER}} .eael-{$button_type}-form .eael-lr-btn" => $this->apply_dim( 'margin' ),
5923 ],
5924 'condition' => [
5925 "{$button_type}_btn_pot" => 'yes',
5926 ],
5927 ] );
5928 $this->add_responsive_control( "{$button_type}_btn_padding", [
5929 'label' => __( 'Padding', 'essential-addons-for-elementor-lite' ),
5930 'type' => Controls_Manager::DIMENSIONS,
5931 'size_units' => [
5932 'px',
5933 'em',
5934 '%',
5935 ],
5936 'selectors' => [
5937 "{{WRAPPER}} .eael-{$button_type}-form .eael-lr-btn" => $this->apply_dim( 'padding' ),
5938 ],
5939 'condition' => [
5940 "{$button_type}_btn_pot" => 'yes',
5941 ],
5942 ] );
5943 $this->end_popover();
5944
5945 $this->add_group_control( Group_Control_Typography::get_type(), [
5946 'name' => "{$button_type}_btn_typography",
5947 'selector' => "{{WRAPPER}} .eael-{$button_type}-form .eael-lr-btn",
5948 ] );
5949
5950 $this->add_control(
5951 "{$button_type}_btn_icon_size",
5952 [
5953 'label' => esc_html__( 'Icon Size', 'essential-addons-for-elementor-lite' ),
5954 'type' => Controls_Manager::SLIDER,
5955 'size_units' => [ 'px', 'em', 'rem' ],
5956 'range' => [
5957 'px' => [
5958 'min' => 0,
5959 'max' => 1000,
5960 'step' => 1,
5961 ],
5962 'em' => [
5963 'min' => 0,
5964 'max' => 500,
5965 'step' => 1,
5966 ],
5967 'rem' => [
5968 'min' => 0,
5969 'max' => 500,
5970 'step' => 1,
5971 ],
5972 ],
5973 'selectors' => [
5974 "{{WRAPPER}} .eael-{$button_type}-form .eael-lr-btn .eael-lr-btn-icon" => 'font-size: {{SIZE}}{{UNIT}};',
5975 "{{WRAPPER}} .eael-{$button_type}-form .eael-lr-btn svg.eael-lr-btn-icon" => 'width: {{SIZE}}{{UNIT}};height: {{SIZE}}{{UNIT}};line-height: {{SIZE}}{{UNIT}};',
5976 ],
5977 ]
5978 );
5979
5980 $this->add_responsive_control( "{$button_type}_btn_d_type", [
5981 'label' => __( 'Display as', 'essential-addons-for-elementor-lite' ),
5982 'type' => Controls_Manager::SELECT,
5983 'options' => [
5984 'row' => __( 'Inline', 'essential-addons-for-elementor-lite' ),
5985 'column' => __( 'Block', 'essential-addons-for-elementor-lite' ),
5986 ],
5987 'default' => 'row',
5988 'selectors' => [
5989 "{{WRAPPER}} .eael-{$button_type}-form .eael-lr-footer" => 'flex-direction: {{VALUE}};',
5990 "{{WRAPPER}} .eael-{$button_type}-form .eael-sign-wrapper" => 'padding-top: 0;',
5991 ],
5992 ] );
5993
5994
5995 $this->add_responsive_control( "{$button_type}_btn_jc", [
5996 'label' => __( 'Justify Content', 'essential-addons-for-elementor-lite' ),
5997 'type' => Controls_Manager::SELECT,
5998 'options' => [
5999 'flex-start' => __( 'Start', 'essential-addons-for-elementor-lite' ),
6000 'flex-end' => __( 'End', 'essential-addons-for-elementor-lite' ),
6001 'center' => __( 'Center', 'essential-addons-for-elementor-lite' ),
6002 'space-between' => __( 'Space Between', 'essential-addons-for-elementor-lite' ),
6003 'space-around' => __( 'Space Around', 'essential-addons-for-elementor-lite' ),
6004 'space-evenly' => __( 'Space Evenly', 'essential-addons-for-elementor-lite' ),
6005 ],
6006 'default' => 'space-between',
6007 'condition' => [
6008 "{$button_type}_btn_d_type" => 'row',
6009 ],
6010 'selectors' => [
6011 "{{WRAPPER}} .eael-{$button_type}-form .eael-lr-footer" => 'justify-content: {{VALUE}};',
6012 ],
6013 ] );
6014 $this->add_responsive_control( "{$button_type}_btn_align", [
6015 'label' => __( 'Alignment', 'essential-addons-for-elementor-lite' ),
6016 'type' => Controls_Manager::CHOOSE,
6017 'options' => [
6018 'mr-auto' => [
6019 'title' => __( 'Left', 'essential-addons-for-elementor-lite' ),
6020 'icon' => 'eicon-h-align-left',
6021 ],
6022 'ml-auto mr-auto' => [
6023 'title' => __( 'Center', 'essential-addons-for-elementor-lite' ),
6024 'icon' => 'eicon-h-align-center',
6025 ],
6026 'ml-auto' => [
6027 'title' => __( 'Right', 'essential-addons-for-elementor-lite' ),
6028 'icon' => 'eicon-h-align-right',
6029 ],
6030 ],
6031 'default' => '',
6032 'condition' => [
6033 "{$button_type}_btn_d_type" => 'column',
6034 ],
6035 ] );
6036 $this->add_control( "tabs_{$button_type}_btn_colors_heading", [
6037 'type' => Controls_Manager::HEADING,
6038 'label' => __( 'Colors & Border', 'essential-addons-for-elementor-lite' ),
6039 'separator' => 'before',
6040 ] );
6041
6042 $this->start_controls_tabs( "tabs_{$button_type}_btn_style" );
6043
6044 /*-----Login Button NORMAL state------ */
6045 $this->start_controls_tab( "tab_{$button_type}_btn_normal", [
6046 'label' => __( 'Normal', 'essential-addons-for-elementor-lite' ),
6047 ] );
6048
6049 $this->add_control(
6050 "{$button_type}_btn_color",
6051 [
6052 'label' => __( 'Text Color', 'essential-addons-for-elementor-lite' ),
6053 'type' => Controls_Manager::COLOR,
6054 'selectors' => [
6055 "{{WRAPPER}} .eael-{$button_type}-form .eael-lr-btn" => 'color: {{VALUE}};',
6056 ],
6057 ]
6058 );
6059
6060 $this->add_control(
6061 "{$button_type}_btn_icon_color",
6062 [
6063 'label' => __( 'Icon Color', 'essential-addons-for-elementor-lite' ),
6064 'type' => Controls_Manager::COLOR,
6065 'selectors' => [
6066 "{{WRAPPER}} .eael-{$button_type}-form .eael-lr-btn .eael-lr-btn-icon" => 'color: {{VALUE}};',
6067 "{{WRAPPER}} .eael-{$button_type}-form .eael-lr-btn svg.eael-lr-btn-icon" => 'fill: {{VALUE}};',
6068 ],
6069 ]
6070 );
6071
6072 $this->add_group_control( Group_Control_Background::get_type(), [
6073 'name' => "{$button_type}_btn_bg_color",
6074 'label' => __( 'Background Color', 'essential-addons-for-elementor-lite' ),
6075 'types' => [
6076 'classic',
6077 'gradient',
6078 ],
6079 'selector' => "{{WRAPPER}} .eael-{$button_type}-form .eael-lr-btn",
6080 ] );
6081
6082 $this->add_group_control( Group_Control_Border::get_type(), [
6083 'name' => "{$button_type}_btn_border",
6084 'selector' => "{{WRAPPER}} .eael-{$button_type}-form .eael-lr-btn",
6085 ] );
6086
6087 $this->add_control( "{$button_type}_btn_border_radius", [
6088 'label' => __( 'Border Radius', 'essential-addons-for-elementor-lite' ),
6089 'type' => Controls_Manager::DIMENSIONS,
6090 'size_units' => [
6091 'px',
6092 '%',
6093 ],
6094 'selectors' => [
6095 "{{WRAPPER}} .eael-{$button_type}-form .eael-lr-btn" => $this->apply_dim( 'border-radius' ),
6096 ],
6097 ] );
6098 $this->end_controls_tab();
6099
6100 /*-----Login Button HOVER state------ */
6101 $this->start_controls_tab( "tab_{$button_type}_button_hover", [
6102 'label' => __( 'Hover', 'essential-addons-for-elementor-lite' ),
6103 ] );
6104
6105 $this->add_control(
6106 "{$button_type}_button_color_hover",
6107 [
6108 'label' => __( 'Text Color', 'essential-addons-for-elementor-lite' ),
6109 'type' => Controls_Manager::COLOR,
6110 'selectors' => [
6111 "{{WRAPPER}} .eael-{$button_type}-form .eael-lr-btn:hover" => 'color: {{VALUE}};',
6112 ],
6113 ]
6114 );
6115
6116 $this->add_control(
6117 "{$button_type}_btn_icon_color_hover",
6118 [
6119 'label' => __( 'Icon Color', 'essential-addons-for-elementor-lite' ),
6120 'type' => Controls_Manager::COLOR,
6121 'selectors' => [
6122 "{{WRAPPER}} .eael-{$button_type}-form .eael-lr-btn:hover .eael-lr-btn-icon" => 'color: {{VALUE}};',
6123 "{{WRAPPER}} .eael-{$button_type}-form .eael-lr-btn:hover svg.eael-lr-btn-icon" => 'fill: {{VALUE}};',
6124 ],
6125 ]
6126 );
6127
6128 $this->add_group_control( Group_Control_Background::get_type(), [
6129 'name' => "{$button_type}_btn_bg_color_hover",
6130 'label' => __( 'Background Color', 'essential-addons-for-elementor-lite' ),
6131 'types' => [
6132 'classic',
6133 'gradient',
6134 ],
6135 'selector' => "{{WRAPPER}} .eael-{$button_type}-form .eael-lr-btn:hover",
6136 ] );
6137
6138 $this->add_group_control( Group_Control_Border::get_type(), [
6139 'name' => "{$button_type}_btn_border_hover",
6140 'selector' => "{{WRAPPER}} .eael-{$button_type}-form .eael-lr-btn:hover",
6141 ] );
6142 $this->add_control( "{$button_type}_btn_border_radius_hover", [
6143 'label' => __( 'Border Radius', 'essential-addons-for-elementor-lite' ),
6144 'type' => Controls_Manager::DIMENSIONS,
6145 'size_units' => [
6146 'px',
6147 '%',
6148 ],
6149 'selectors' => [
6150 "{{WRAPPER}} .eael-{$button_type}-form .eael-lr-btn:hover" => $this->apply_dim( 'border-radius' ),
6151 ],
6152 ] );
6153 $this->end_controls_tab();
6154 $this->end_controls_tabs();
6155 /*-----ends Button tabs--------*/
6156
6157 $this->add_responsive_control( "{$button_type}_btn_width", [
6158 'label' => esc_html__( 'Button width', 'essential-addons-for-elementor-lite' ),
6159 'type' => Controls_Manager::SLIDER,
6160 'size_units' => [
6161 'px',
6162 '%',
6163 ],
6164 'range' => [
6165 'px' => [
6166 'min' => 0,
6167 'max' => 500,
6168 'step' => 5,
6169 ],
6170 '%' => [
6171 'min' => 0,
6172 'max' => 100,
6173 ],
6174 ],
6175 'selectors' => [
6176 // The button is wrapped in .eael-lr-form-loader-wrapper (login/register only), which
6177 // shrink-wraps to the button. Size that wrapper too so % resolves against the form and
6178 // px can't overflow it (max-width:100%). lostpassword/reset have no wrapper → button rule applies.
6179 "{{WRAPPER}} .eael-{$button_type}-form .eael-lr-btn" => 'width: {{SIZE}}{{UNIT}};',
6180 "{{WRAPPER}} .eael-{$button_type}-form .eael-lr-form-loader-wrapper" => 'width: {{SIZE}}{{UNIT}}; max-width: 100%;',
6181 ],
6182 'separator' => 'before',
6183 ] );
6184 $this->add_responsive_control( "{$button_type}_btn_height", [
6185 'label' => esc_html__( 'Button Height', 'essential-addons-for-elementor-lite' ),
6186 'type' => Controls_Manager::SLIDER,
6187 'size_units' => [
6188 'px',
6189 '%',
6190 ],
6191 'range' => [
6192 'px' => [
6193 'min' => 0,
6194 'max' => 500,
6195 'step' => 5,
6196 ],
6197 '%' => [
6198 'min' => 0,
6199 'max' => 100,
6200 ],
6201 ],
6202 'selectors' => [
6203 "{{WRAPPER}} .eael-{$button_type}-form .eael-lr-btn" => 'height: {{SIZE}}{{UNIT}};',
6204 ],
6205 ] );
6206
6207 //Show spinner
6208 do_action( "eael/login-register/after-init-{$button_type}-button-style", $this, $button_type );
6209
6210 if ( !$this->pro_enabled ) {
6211 $this->add_control( "{$button_type}_btn_show_spinner", [
6212 'label' => sprintf(
6213 /* translators: %s: Icon markup for the spinner. */
6214 __( 'Show Spinner %s', 'essential-addons-for-elementor-lite' ),
6215 '<i class="eael-pro-labe eicon-pro-icon"></i>'
6216 ),
6217 'type' => Controls_Manager::SWITCHER,
6218 'classes' => 'eael-pro-control',
6219 ] );
6220 }
6221
6222 $this->end_controls_section();
6223 }
6224
6225 /**
6226 * Print style controls for a specific type of reCAPTCHA.
6227 *
6228 * @param string $form_type the type of the reCAPTCHA. accepts login or register.
6229 */
6230 protected function _init_recaptcha_style( $form_type = 'login' ) {
6231 $form_label = 'lostpassword' === $form_type ? __( 'Lost Password', 'essential-addons-for-elementor-lite' ) : ucfirst( $form_type );
6232
6233 $this->start_controls_section( "section_style_{$form_type}_rc", [
6234 'label' => sprintf(
6235 /* translators: %s: Form label to display in the reCAPTCHA field label. */
6236 __( '%s Form reCAPTCHA', 'essential-addons-for-elementor-lite' ),
6237 esc_html( $form_label )
6238 ),
6239 'tab' => Controls_Manager::TAB_STYLE,
6240 'condition' => [
6241 "enable_{$form_type}_recaptcha" => 'yes',
6242 ],
6243 ] );
6244 $this->add_responsive_control( "{$form_type}_rc_margin", [
6245 'label' => __( 'Margin', 'essential-addons-for-elementor-lite' ),
6246 'type' => Controls_Manager::DIMENSIONS,
6247 'size_units' => [
6248 'px',
6249 'em',
6250 '%',
6251 ],
6252 'selectors' => [
6253 "{{WRAPPER}} .eael-{$form_type}-form .eael-recaptcha-wrapper" => $this->apply_dim( 'margin' ),
6254 ],
6255
6256 ] );
6257
6258 $this->add_control( "{$form_type}_rc_theme", [
6259 'label' => __( 'Theme', 'essential-addons-for-elementor-lite' ),
6260 'type' => Controls_Manager::SELECT,
6261 'options' => [
6262 'light' => __( 'Light', 'essential-addons-for-elementor-lite' ),
6263 'dark' => __( 'Dark', 'essential-addons-for-elementor-lite' ),
6264 ],
6265 'default' => 'light',
6266 ] );
6267
6268 $this->add_control( "{$form_type}_rc_size", [
6269 'label' => __( 'Size', 'essential-addons-for-elementor-lite' ),
6270 'type' => Controls_Manager::SELECT,
6271 'options' => [
6272 'normal' => __( 'Normal', 'essential-addons-for-elementor-lite' ),
6273 'compact' => __( 'Compact', 'essential-addons-for-elementor-lite' ),
6274 ],
6275 'default' => 'normal',
6276 ] );
6277
6278 $this->end_controls_section();
6279 }
6280
6281 /**
6282 * Print style controls for a specific type of link on register or login form.
6283 *
6284 * @param string $form_type the type of form where the link is being shown. accepts login or register.
6285 */
6286 protected function _init_link_style( $form_type = 'login', $show_as_section = 1 ) {
6287 $form_name = 'login' === $form_type ? __( 'Register', 'essential-addons-for-elementor-lite' ) : __( 'Login', 'essential-addons-for-elementor-lite' );
6288 $form_name = 'lostpassword' === $form_type ? __( 'Login (Lost Password)', 'essential-addons-for-elementor-lite' ) : $form_name;
6289 $link_section_condition = [
6290 "show_{$form_type}_link" => 'yes',
6291 ];
6292
6293 if( 'lostpassword' === $form_type ){
6294 $link_section_condition = [
6295 'show_lost_password' => 'yes',
6296 'lost_password_link_type' => 'form',
6297 'show_login_link_lostpassword' => 'yes',
6298 ];
6299 }
6300
6301 if( $show_as_section ){
6302 $this->start_controls_section( "section_style_{$form_type}_link", [
6303 'label' => sprintf(
6304 /* translators: %s: Form name to display in the link label. */
6305 __( '%s Link', 'essential-addons-for-elementor-lite' ),
6306 esc_html( ucfirst( $form_name ) )
6307 ),
6308 'tab' => Controls_Manager::TAB_STYLE,
6309 'condition' => $link_section_condition,
6310 ] );
6311 }
6312
6313 $this->add_control( "{$form_type}_link_style_notice", [
6314 'type' => Controls_Manager::RAW_HTML,
6315 'raw' => sprintf(
6316 /* translators: %1$s: The link label, %2$s: The form type label. */
6317 esc_html__( 'Here you can style the %1$s link displayed on the %2$s Form', 'essential-addons-for-elementor-lite' ),
6318 'lostpassword' === $form_type
6319 ? esc_html__( 'Login', 'essential-addons-for-elementor-lite' )
6320 : esc_html( $form_name ),
6321 'lostpassword' === $form_type
6322 ? esc_html__( 'Lost Password', 'essential-addons-for-elementor-lite' )
6323 : esc_html( ucfirst( $form_type ) )
6324 ),
6325
6326 'content_classes' => 'elementor-panel-alert elementor-panel-alert-info',
6327 ] );
6328 $this->add_control( "{$form_type}_link_pot", [
6329 'label' => __( 'Spacing', 'essential-addons-for-elementor-lite' ),
6330 'type' => Controls_Manager::POPOVER_TOGGLE,
6331 'label_off' => __( 'Default', 'essential-addons-for-elementor-lite' ),
6332 'label_on' => __( 'Custom', 'essential-addons-for-elementor-lite' ),
6333 'return_value' => 'yes',
6334 ] );
6335 $this->start_popover();
6336 $this->add_responsive_control( "{$form_type}_link_margin", [
6337 'label' => __( 'Margin', 'essential-addons-for-elementor-lite' ),
6338 'type' => Controls_Manager::DIMENSIONS,
6339 'size_units' => [
6340 'px',
6341 'em',
6342 '%',
6343 ],
6344 'selectors' => [
6345 "{{WRAPPER}} .eael-{$form_type}-form .eael-lr-link" => $this->apply_dim( 'margin' ),
6346 ],
6347 'condition' => [
6348 "{$form_type}_link_pot" => 'yes',
6349 ],
6350 ] );
6351 $this->add_responsive_control( "{$form_type}_link_padding", [
6352 'label' => __( 'Padding', 'essential-addons-for-elementor-lite' ),
6353 'type' => Controls_Manager::DIMENSIONS,
6354 'size_units' => [
6355 'px',
6356 'em',
6357 '%',
6358 ],
6359 'selectors' => [
6360 "{{WRAPPER}} .eael-{$form_type}-form .eael-lr-link" => $this->apply_dim( 'padding' ),
6361 ],
6362 'condition' => [
6363 "{$form_type}_link_pot" => 'yes',
6364 ],
6365 ] );
6366 $this->end_popover();
6367 $this->add_group_control( Group_Control_Typography::get_type(), [
6368 'name' => "{$form_type}_link_typography",
6369 'selector' => "{{WRAPPER}} .eael-{$form_type}-form .eael-lr-link",
6370 ] );
6371
6372 $this->add_responsive_control( "{$form_type}_link_d_type", [
6373 'label' => __( 'Display as', 'essential-addons-for-elementor-lite' ),
6374 'type' => Controls_Manager::SELECT,
6375 'options' => [
6376 'row' => __( 'Inline', 'essential-addons-for-elementor-lite' ),
6377 'column' => __( 'Block', 'essential-addons-for-elementor-lite' ),
6378 ],
6379 'default' => 'row',
6380 'selectors' => [
6381 "{{WRAPPER}} .eael-{$form_type}-form .eael-sign-wrapper" => 'display:flex; flex-direction: {{VALUE}};',
6382 ],
6383 ] );
6384
6385
6386 $this->add_responsive_control( "{$form_type}_link_jc", [
6387 'label' => __( 'Justify Content', 'essential-addons-for-elementor-lite' ),
6388 'type' => Controls_Manager::SELECT,
6389 'options' => [
6390 'flex-start' => __( 'Start', 'essential-addons-for-elementor-lite' ),
6391 'flex-end' => __( 'End', 'essential-addons-for-elementor-lite' ),
6392 'center' => __( 'Center', 'essential-addons-for-elementor-lite' ),
6393 'space-between' => __( 'Space Between', 'essential-addons-for-elementor-lite' ),
6394 'space-around' => __( 'Space Around', 'essential-addons-for-elementor-lite' ),
6395 'space-evenly' => __( 'Space Evenly', 'essential-addons-for-elementor-lite' ),
6396 ],
6397 'default' => 'center',
6398 'condition' => [
6399 "{$form_type}_link_d_type" => 'row',
6400 ],
6401 'selectors' => [
6402 "{{WRAPPER}} .eael-{$form_type}-form .eael-sign-wrapper" => 'justify-content: {{VALUE}};',
6403 ],
6404 ] );
6405
6406 $this->add_responsive_control( "{$form_type}_link_ai", [
6407 'label' => __( 'Align Items', 'essential-addons-for-elementor-lite' ),
6408 'type' => Controls_Manager::SELECT,
6409 'options' => [
6410 'flex-start' => __( 'Start', 'essential-addons-for-elementor-lite' ),
6411 'flex-end' => __( 'End', 'essential-addons-for-elementor-lite' ),
6412 'center' => __( 'Center', 'essential-addons-for-elementor-lite' ),
6413 'stretch' => __( 'Stretch', 'essential-addons-for-elementor-lite' ),
6414 'baseline' => __( 'Baseline', 'essential-addons-for-elementor-lite' ),
6415 'space-evenly' => __( 'Space Evenly', 'essential-addons-for-elementor-lite' ),
6416 ],
6417 'default' => 'center',
6418 'condition' => [
6419 "{$form_type}_link_d_type" => 'column',
6420 ],
6421 'selectors' => [
6422 "{{WRAPPER}} .eael-{$form_type}-form .eael-sign-wrapper" => 'align-items: {{VALUE}};',
6423 ],
6424 ] );
6425
6426 $this->add_responsive_control( "{$form_type}_link_align", [
6427 'label' => __( 'Alignment', 'essential-addons-for-elementor-lite' ),
6428 'type' => Controls_Manager::CHOOSE,
6429 'options' => [
6430 'mr-auto' => [
6431 'title' => __( 'Left', 'essential-addons-for-elementor-lite' ),
6432 'icon' => 'eicon-h-align-left',
6433 ],
6434 'ml-auto mr-auto' => [
6435 'title' => __( 'Center', 'essential-addons-for-elementor-lite' ),
6436 'icon' => 'eicon-h-align-center',
6437 ],
6438 'ml-auto' => [
6439 'title' => __( 'Right', 'essential-addons-for-elementor-lite' ),
6440 'icon' => 'eicon-h-align-right',
6441 ],
6442 ],
6443 'default' => '',
6444 'condition' => [
6445 "{$form_type}_link_d_type" => 'column',
6446 ],
6447 ] );
6448
6449 $this->add_control( "tabs_{$form_type}_link_colors_heading", [
6450 'type' => Controls_Manager::HEADING,
6451 'label' => __( 'Colors & Border', 'essential-addons-for-elementor-lite' ),
6452 'separator' => 'before',
6453 ] );
6454
6455 $this->start_controls_tabs( "tabs_{$form_type}_link_style" );
6456 /*----- Link NORMAL state------ */
6457 $this->start_controls_tab( "tab_{$form_type}_link_normal", [
6458 'label' => __( 'Normal', 'essential-addons-for-elementor-lite' ),
6459 ] );
6460 $this->add_control( "{$form_type}_link_color", [
6461 'label' => __( 'Text Color', 'essential-addons-for-elementor-lite' ),
6462 'type' => Controls_Manager::COLOR,
6463 'selectors' => [
6464 "{{WRAPPER}} .eael-{$form_type}-form .eael-lr-link" => 'color: {{VALUE}};',
6465 ],
6466 ] );
6467 $this->add_group_control( Group_Control_Background::get_type(), [
6468 'name' => "{$form_type}_link_bg_color",
6469 'label' => __( 'Background Color', 'essential-addons-for-elementor-lite' ),
6470 'types' => [
6471 'classic',
6472 'gradient',
6473 ],
6474 'selector' => "{{WRAPPER}} .eael-{$form_type}-form .eael-lr-link",
6475 ] );
6476 $this->add_group_control( Group_Control_Border::get_type(), [
6477 'name' => "{$form_type}_link_border",
6478 'selector' => "{{WRAPPER}} .eael-{$form_type}-form .eael-lr-link",
6479 ] );
6480 $this->add_control( "{$form_type}_link_border_radius", [
6481 'label' => __( 'Border Radius', 'essential-addons-for-elementor-lite' ),
6482 'type' => Controls_Manager::DIMENSIONS,
6483 'size_units' => [
6484 'px',
6485 '%',
6486 ],
6487 'selectors' => [
6488 "{{WRAPPER}} .eael-{$form_type}-form .eael-lr-link" => $this->apply_dim( 'border-radius' ),
6489 ],
6490 ] );
6491 $this->end_controls_tab();
6492
6493 /*-----Link HOVER state------ */
6494 $this->start_controls_tab( "tab_{$form_type}_link_hover", [
6495 'label' => __( 'Hover', 'essential-addons-for-elementor-lite' ),
6496 ] );
6497 $this->add_control( "{$form_type}_link_color_hover", [
6498 'label' => __( 'Text Color', 'essential-addons-for-elementor-lite' ),
6499 'type' => Controls_Manager::COLOR,
6500 'selectors' => [
6501 "{{WRAPPER}} .eael-{$form_type}-form .eael-lr-link:hover" => 'color: {{VALUE}};',
6502 ],
6503 ] );
6504 $this->add_group_control( Group_Control_Background::get_type(), [
6505 'name' => "{$form_type}_link_bg_color_hover",
6506 'label' => __( 'Background Color', 'essential-addons-for-elementor-lite' ),
6507 'types' => [
6508 'classic',
6509 'gradient',
6510 ],
6511 'selector' => "{{WRAPPER}} .eael-{$form_type}-form .eael-lr-link:hover",
6512 ] );
6513 $this->add_group_control( Group_Control_Border::get_type(), [
6514 'name' => "{$form_type}_link_border_hover",
6515 'selector' => "{{WRAPPER}} .eael-{$form_type}-form .eael-lr-link:hover",
6516 ] );
6517 $this->add_control( "{$form_type}_link_border_radius_hover", [
6518 'label' => __( 'Border Radius', 'essential-addons-for-elementor-lite' ),
6519 'type' => Controls_Manager::DIMENSIONS,
6520 'size_units' => [
6521 'px',
6522 '%',
6523 ],
6524 'selectors' => [
6525 "{{WRAPPER}} .eael-{$form_type}-form .eael-lr-link:hover" => $this->apply_dim( 'border-radius' ),
6526 ],
6527 ] );
6528 $this->end_controls_tab();
6529 $this->end_controls_tabs();
6530 /*-----ends Link tabs--------*/
6531 $this->add_responsive_control( "{$form_type}_link_wrap_width", [
6532 'label' => esc_html__( 'Link Container width', 'essential-addons-for-elementor-lite' ),
6533 'type' => Controls_Manager::SLIDER,
6534 'size_units' => [
6535 'px',
6536 '%',
6537 ],
6538 'range' => [
6539 'px' => [
6540 'min' => 0,
6541 'max' => 500,
6542 'step' => 5,
6543 ],
6544 '%' => [
6545 'min' => 0,
6546 'max' => 100,
6547 ],
6548 ],
6549 'selectors' => [
6550 "{{WRAPPER}} .eael-{$form_type}-form .eael-sign-wrapper" => 'width: {{SIZE}}{{UNIT}};',
6551 ],
6552 'separator' => 'before',
6553 ] );
6554 $this->add_responsive_control( "{$form_type}_link_width", [
6555 'label' => esc_html__( 'Link width', 'essential-addons-for-elementor-lite' ),
6556 'type' => Controls_Manager::SLIDER,
6557 'size_units' => [
6558 'px',
6559 '%',
6560 ],
6561 'range' => [
6562 'px' => [
6563 'min' => 0,
6564 'max' => 500,
6565 'step' => 5,
6566 ],
6567 '%' => [
6568 'min' => 0,
6569 'max' => 100,
6570 ],
6571 ],
6572 'selectors' => [
6573 "{{WRAPPER}} .eael-{$form_type}-form .eael-lr-link" => 'width: {{SIZE}}{{UNIT}};',
6574 ],
6575 ] );
6576
6577 $this->add_responsive_control( "{$form_type}_link_height", [
6578 'label' => esc_html__( 'Link Height', 'essential-addons-for-elementor-lite' ),
6579 'type' => Controls_Manager::SLIDER,
6580 'size_units' => [
6581 'px',
6582 '%',
6583 ],
6584 'range' => [
6585 'px' => [
6586 'min' => 0,
6587 'max' => 500,
6588 'step' => 5,
6589 ],
6590 '%' => [
6591 'min' => 0,
6592 'max' => 100,
6593 ],
6594 ],
6595 'selectors' => [
6596 "{{WRAPPER}} .eael-{$form_type}-form .eael-lr-link" => 'height: {{SIZE}}{{UNIT}};',
6597 ],
6598 ] );
6599
6600 if( $show_as_section ){
6601 $this->end_controls_section();
6602 }
6603 }
6604
6605 /**
6606 * Get conditions for displaying login form and registration
6607 *
6608 * @param string $type
6609 *
6610 * @return array
6611 */
6612 public function get_form_controls_display_condition( $type = 'login' ) {
6613 $type = 'resetpassword' === $type ? esc_html( 'lostpassword' ) : esc_html( $type );
6614
6615 $form_type = in_array( $type, [
6616 'login',
6617 'register',
6618 'lostpassword'
6619 ] ) ? $type : 'login';
6620
6621 $terms_condition = [
6622 [
6623 'name' => 'default_form_type',
6624 'value' => $form_type,
6625 ]
6626 ];
6627
6628 if('lostpassword' === $form_type){
6629 $terms_condition[] = [
6630 'relation' => 'and',
6631 'terms' => [
6632 [
6633 'name' => 'show_lost_password',
6634 'value' => 'yes'
6635 ],
6636 [
6637 'name' => 'lost_password_link_type',
6638 'value' => 'form',
6639 ]
6640 ]
6641 ];
6642 }else {
6643 $terms_condition[] = [
6644 'name' => "show_{$form_type}_link",
6645 'value' => 'yes',
6646 ];
6647 }
6648
6649 $terms_relation_conditions = [
6650 'relation' => 'or',
6651 'terms' => $terms_condition,
6652 ];
6653
6654 return $terms_relation_conditions;
6655 }
6656
6657 public function add_login_register_body_class( $classes ) {
6658 $classes[] = 'eael-login-register-page-body';
6659
6660 return $classes;
6661 }
6662
6663 protected function render() {
6664
6665 if ( ! current_user_can( 'manage_options' ) && 'yes' === $this->get_settings_for_display( 'redirect_for_logged_in_user' ) && is_user_logged_in() ) {
6666 if ( $redirect = $this->get_settings_for_display( 'redirect_url_for_logged_in_user' )['url'] ) {
6667 $redirect = wp_sanitize_redirect( $redirect );
6668 $logged_in_location = wp_validate_redirect( $redirect, site_url() ); ?>
6669 <div class="" data-logged-in-location="<?php echo empty( $logged_in_location ) ? '' : esc_url( $logged_in_location ); ?>"></div>
6670 <?php
6671 }
6672 }
6673
6674 //Note. forms are handled in Login_Registration Trait used in the Bootstrap class.
6675 if ( ! $this->in_editor && 'yes' === $this->get_settings_for_display( 'hide_for_logged_in_user' ) && is_user_logged_in() ) {
6676 return; // do not show any form for already logged in user. but let edit on editor
6677 }
6678
6679 $this->ds = $this->get_settings_for_display();
6680 $this->default_form = $this->get_settings_for_display( 'default_form_type' );
6681 $this->should_print_login_form = ( 'login' === $this->default_form || 'yes' === $this->get_settings_for_display( 'show_login_link' ) || 'yes' === $this->get_settings_for_display( 'show_login_link_lostpassword' ) );
6682 $this->should_print_register_form = ( $this->user_can_register && ( 'register' === $this->get_settings_for_display( 'default_form_type' ) || 'yes' === $this->get_settings_for_display( 'show_register_link' ) ) );
6683 $this->should_print_lostpassword_form = ( 'lostpassword' === $this->default_form || 'yes' === $this->get_settings_for_display( 'show_lost_password' ) );
6684 $this->should_print_resetpassword_form_editor = $this->in_editor && 'yes' === $this->get_settings_for_display( 'preview_reset_password' );
6685
6686 if ( Plugin::$instance->documents->get_current() ) {
6687 $this->page_id = Plugin::$instance->documents->get_current()->get_main_id();
6688 }
6689
6690 // Sync "Show on My Account" fields to option — only writes when something changed.
6691 if ( ! $this->in_editor && $this->page_id ) {
6692 $enabled = [];
6693
6694 foreach ( (array) $this->ds['register_fields'] as $field ) {
6695 if ( ! empty( $field['show_on_my_account'] ) && 'yes' === $field['show_on_my_account'] ) {
6696 $field_type = sanitize_key( $field['field_type'] ?? '' );
6697 if ( $field_type ) {
6698 $enabled[ $field_type ] = wp_strip_all_tags( $field['field_label'] ?? $field_type );
6699 }
6700 }
6701 }
6702 $all = get_option( 'eael_lr_my_account_fields', [] );
6703 if ( ( $all[ $this->page_id ] ?? [] ) !== $enabled ) {
6704 if ( empty( $enabled ) ) {
6705 unset( $all[ $this->page_id ] );
6706 } else {
6707 $all[ $this->page_id ] = $enabled;
6708 }
6709 update_option( 'eael_lr_my_account_fields', $all, false );
6710 }
6711 }
6712
6713 $this->page_id_for_popup = get_queried_object_id();
6714
6715 //handle form illustration
6716 $form_image_id = ! empty( $this->ds['lr_form_image']['id'] ) ? $this->ds['lr_form_image']['id'] : '';
6717 $this->form_illustration_pos = ! empty( $this->ds['lr_form_image_position'] ) ? $this->ds['lr_form_image_position'] : 'left';
6718 $this->form_illustration_url = Group_Control_Image_Size::get_attachment_image_src( $form_image_id, 'lr_form_image', $this->ds );
6719
6720 $form_logo_id = ! empty( $this->ds['lr_form_logo']['id'] ) ? $this->ds['lr_form_logo']['id'] : '';
6721 $this->form_logo = Group_Control_Image_Size::get_attachment_image_src( $form_logo_id, 'lr_form_logo', $this->ds );
6722 $this->form_logo_pos = ! empty( $this->ds['lr_form_logo_position'] ) ? $this->ds['lr_form_logo_position'] : 'inline';
6723 $login_redirect_url = '';
6724 $resetpassword_redirect_url = '';
6725
6726 if ( ! empty( $this->ds['redirect_after_login'] ) && 'yes' === $this->ds['redirect_after_login'] ) {
6727 $login_redirect_url = !empty( $this->ds[ 'redirect_url' ][ 'url' ] ) ? esc_url( $this->ds[ 'redirect_url' ][ 'url' ] ) : '';
6728 }
6729
6730 $this->login_custom_redirect_url = apply_filters( 'eael/login-register/login-redirect-url', $login_redirect_url, $this );
6731
6732 if ( ! empty( $this->ds['redirect_after_resetpassword'] ) && 'yes' === $this->ds['redirect_after_resetpassword'] ) {
6733 $resetpassword_redirect_url = !empty( $this->ds[ 'redirect_url_resetpassword' ][ 'url' ] ) ? esc_url( $this->ds[ 'redirect_url_resetpassword' ][ 'url' ] ) : '';
6734 }
6735
6736 if ( ! empty( $this->ds['lostpassword_email_message_reset_link_in_popup'] ) && 'yes' === $this->ds['lostpassword_email_message_reset_link_in_popup'] ) {
6737 $this->resetpassword_in_popup_selector = ! empty( $this->ds[ 'lostpassword_email_message_reset_link_popup_selector' ] ) ? sanitize_text_field( $this->ds[ 'lostpassword_email_message_reset_link_popup_selector' ] ) : '';
6738 }
6739
6740 $login_recaptcha_version = $register_recaptcha_version = $lostpassword_recaptcha_version = ! empty( $this->ds['login_register_recaptcha_version'] ) ? $this->ds['login_register_recaptcha_version'] : 'v2';
6741
6742 if ( get_option('eael_recaptcha_sitekey_v3') && ( 'v3' === $login_recaptcha_version || 'v3' === $register_recaptcha_version || 'v3' === $lostpassword_recaptcha_version) ) {
6743 $site_key = esc_html( get_option('eael_recaptcha_sitekey_v3') );
6744
6745 if ( $recaptcha_language = esc_html( get_option( 'eael_recaptcha_language_v3' ) ) ) {
6746 $recaptcha_api_args1['hl'] = $recaptcha_language;
6747 }
6748
6749 $recaptcha_api_args1['render'] = $site_key;
6750
6751 $recaptcha_api_args1 = apply_filters( 'eael_lr_recaptcha_api_args_v3', $recaptcha_api_args1 );
6752 $recaptcha_api_args1 = http_build_query( $recaptcha_api_args1 );
6753 wp_register_script('eael-recaptcha-v3', "https://www.recaptcha.net/recaptcha/api.js?{$recaptcha_api_args1}", false, EAEL_PLUGIN_VERSION, false);
6754 wp_enqueue_script('eael-recaptcha-v3');
6755 wp_dequeue_script('eael-recaptcha');
6756 }
6757 ?>
6758 <div class="eael-login-registration-wrapper <?php echo empty( $form_image_id ) ? '' : esc_attr( 'has-illustration' ); ?>"
6759 data-is-ajax="<?php echo esc_attr( $this->get_settings_for_display( 'enable_ajax' ) ); ?>"
6760 data-widget-id="<?php echo esc_attr( $this->get_id() ); ?>"
6761 data-page-id="<?php echo esc_attr( $this->page_id ); ?>"
6762 data-recaptcha-sitekey="<?php echo esc_attr( get_option( 'eael_recaptcha_sitekey' ) ); ?>"
6763 data-recaptcha-sitekey-v3="<?php echo esc_attr( get_option( 'eael_recaptcha_sitekey_v3' ) ); ?>"
6764 data-login-recaptcha-version="<?php echo esc_attr( $login_recaptcha_version ); ?>"
6765 data-register-recaptcha-version="<?php echo esc_attr( $register_recaptcha_version ); ?>"
6766 data-lostpassword-recaptcha-version="<?php echo esc_attr( $lostpassword_recaptcha_version ); ?>"
6767 data-redirect-to="<?php echo esc_attr( $this->login_custom_redirect_url ); ?>"
6768 data-resetpassword-redirect-to="<?php echo esc_attr( $resetpassword_redirect_url ); ?>"
6769 >
6770 <?php
6771 $this->print_resetpassword_form(); // set a new password; user will land on this form via email reset password link.
6772 $this->print_login_form();
6773 $this->print_register_form();
6774 $this->print_lostpassword_form(); //request for a new password.
6775
6776 if ( $this->recaptcha_badge_hide ) {
6777 ?>
6778 <div class="eael-recaptcha-no-branding-wrapper">
6779 <small>
6780 This site is protected by reCAPTCHA and the Google
6781 <a href="https://policies.google.com/privacy">Privacy Policy</a> and
6782 <a href="https://policies.google.com/terms">Terms of Service</a> apply.
6783 </small>
6784 </div>
6785 <?php
6786 }
6787 ?>
6788 </div>
6789
6790 <?php
6791 }
6792
6793 protected function print_login_form() {
6794 // If an OTP challenge is in flight for a DIFFERENT form (e.g. ?eael_otp_flow=register),
6795 // suppress the entire login section so only the OTP UI is visible on the page.
6796 $otp_active_flow = $this->eael_otp_active_flow();
6797 if ( $otp_active_flow && 'login' !== $otp_active_flow ) {
6798 return;
6799 }
6800
6801 if ( $this->should_print_login_form ) {
6802 // prepare all login form related vars
6803 // phpcs:ignore WordPress.Security.NonceVerification.Recommended
6804 $default_hide_class = ( 'register' === $this->default_form || 'lostpassword' === $this->default_form || $this->should_print_resetpassword_form_editor || isset($_GET['eael-register']) || isset($_GET['eael-lostpassword']) || isset($_GET['eael-resetpassword']) ) ? 'eael-lr-d-none' : '';
6805
6806 // Force-show this section if a login OTP challenge is in progress, or the editor preview is on.
6807 if ( $this->eael_otp_should_force_show( 'login' ) ) {
6808 $default_hide_class = '';
6809 }
6810
6811 //Reg link related
6812 $reg_link_action = ! empty( $this->ds['registration_link_action'] ) ? $this->ds['registration_link_action'] : 'form';
6813 $show_reg_link = ( $this->user_can_register && 'yes' === $this->get_settings( 'show_register_link' ) );
6814 $reg_link_text = ! empty( $this->get_settings( 'registration_link_text' ) ) ? HelperCLass::eael_wp_kses($this->get_settings( 'registration_link_text' )) : __( 'Register', 'essential-addons-for-elementor-lite' );
6815 $parts = explode( "\n", $reg_link_text );
6816 $reg_link_text = array_pop( $parts );
6817 $reg_message = array_shift( $parts );
6818
6819 $reg_link_placeholder = '<span class="d-ib">%1$s</span> <a href="%2$s" id="eael-lr-reg-toggle" class="eael-lr-link" data-action="%3$s" %5$s>%4$s</a>';
6820 $reg_atts = $reg_url = '';
6821 switch ( $reg_link_action ) {
6822 case 'custom':
6823 $reg_url = ! empty( $this->ds['custom_register_url']['url'] ) ? $this->ds['custom_register_url']['url'] : '';
6824 $reg_atts = ! empty( $this->ds['custom_register_url']['is_external'] ) ? ' target="_blank"' : '';
6825 $reg_atts .= ! empty( $this->ds['custom_register_url']['nofollow'] ) ? ' rel="nofollow"' : '';
6826 break;
6827 case 'default':
6828 $reg_url = wp_registration_url();
6829 break;
6830 }
6831
6832 $reg_link = sprintf( $reg_link_placeholder, $reg_message, esc_url( $reg_url ), esc_attr( $reg_link_action ), $reg_link_text, $reg_atts );
6833
6834
6835 // login form fields related
6836 $label_type = ! empty( $this->ds['login_label_types'] ) ? $this->ds['login_label_types'] : 'default';
6837 $is_custom_label = ( 'custom' === $label_type );
6838 $display_label = ( 'none' !== $label_type );
6839
6840 //Default label n placeholder
6841 $u_label = $u_ph = __( 'Username or Email Address', 'essential-addons-for-elementor-lite' );
6842 $p_label = $p_ph = __( 'Password', 'essential-addons-for-elementor-lite' );
6843 // custom label n placeholder
6844 if ( $is_custom_label ) {
6845 $u_label = isset( $this->ds['login_user_label'] ) ? $this->ds['login_user_label'] : '';
6846 $p_label = isset( $this->ds['login_password_label'] ) ? $this->ds['login_password_label'] : '';
6847 $u_ph = isset( $this->ds['login_user_placeholder'] ) ? $this->ds['login_user_placeholder'] : '';
6848 $p_ph = isset( $this->ds['login_password_placeholder'] ) ? $this->ds['login_password_placeholder'] : '';
6849 }
6850
6851
6852 $btn_text = ! empty( $this->ds['login_button_text'] ) ? sanitize_text_field( $this->ds['login_button_text'] ) : '';
6853 $btn_icon = ! empty( $this->ds['login_button_icon'] ) ? $this->ds['login_button_icon'] : '';
6854 $btn_icon_position= ! empty( $this->ds['login_button_icon_position'] ) ? sanitize_text_field( $this->ds['login_button_icon_position'] ) : 'left';
6855 $show_logout_link = ( ! empty( $this->ds['show_log_out_message'] ) && 'yes' === $this->ds['show_log_out_message'] );
6856 $show_rememberme = ( ! empty( $this->ds['login_show_remember_me'] ) && 'yes' === $this->ds['login_show_remember_me'] );
6857 $remember_text = isset( $this->ds['remember_text'] ) ? $this->ds['remember_text'] : esc_html__( 'Remember Me', 'essential-addons-for-elementor-lite');
6858 $remember_checked = ( ! empty( $this->ds['login_form_fields_remember_me_checked'] ) && 'yes' === $this->ds['login_form_fields_remember_me_checked'] );
6859 $rm_type = ! empty( $this->ds['remember_me_style'] ) ? $this->ds['remember_me_style'] : '';
6860 $show_pv_icon = ( ! empty( $this->ds['password_toggle'] ) && 'yes' === $this->ds['password_toggle'] );
6861
6862 //Loss password
6863 $show_lp = ( ! empty( $this->ds['show_lost_password'] ) && 'yes' === $this->ds['show_lost_password'] );
6864 $lp_text = ! empty( $this->ds['lost_password_text'] ) ? HelperCLass::eael_wp_kses($this->ds['lost_password_text']) : __( 'Forgot Password?', 'essential-addons-for-elementor-lite' );
6865 $lp_link = sprintf( '<a href="%s">%s</a>', esc_url( wp_lostpassword_url() ), $lp_text );
6866 if ( ! empty( $this->ds['lost_password_link_type'] ) && 'custom' === $this->ds['lost_password_link_type'] ) {
6867 $lp_url = ! empty( $this->ds['lost_password_url']['url'] ) ? $this->ds['lost_password_url']['url'] : wp_lostpassword_url();
6868 $lp_atts = ! empty( $this->ds['lost_password_url']['is_external'] ) ? ' target="_blank"' : '';
6869 $lp_atts .= ! empty( $this->ds['lost_password_url']['nofollow'] ) ? ' rel="nofollow"' : '';
6870 $lp_link = sprintf( '<a href="%s" %s >%s</a>', esc_url( $lp_url ), $lp_atts, $lp_text );
6871 } else if ( ! empty( $this->ds['lost_password_link_type'] ) && 'form' === $this->ds['lost_password_link_type'] ){
6872 $lp_link = sprintf( '<a id="eael-lr-lostpassword-toggle" href="" data-action="form">%s</a>', $lp_text );
6873 }
6874 // btn alignment
6875 $btn_align = isset( $this->ds['login_btn_align'] ) ? $this->ds['login_btn_align'] : '';
6876 // btn alignment
6877 $link_align = isset( $this->ds['login_link_align'] ) ? $this->ds['login_link_align'] : '';
6878 // reCAPTCHA style
6879 $rc_theme = isset( $this->ds['login_rc_theme'] ) ? $this->ds['login_rc_theme'] : 'light';
6880 $rc_size = isset( $this->ds['login_rc_size'] ) ? $this->ds['login_rc_size'] : 'normal';
6881 // input icons
6882 $show_icon = ( $this->pro_enabled && ! empty( $this->ds['show_login_icon'] ) && 'yes' === $this->ds['show_login_icon'] );
6883 $icon_class = $show_icon ? 'lr-icon-showing' : '';
6884
6885 $show_login_spinner = !empty( $this->ds['login_btn_show_spinner'] ) ? $this->ds['login_btn_show_spinner'] : '';
6886 $err_msg_position = $this->ds['err_message_position_login'];
6887 ?>
6888 <?php $otp_active_class = $this->eael_otp_should_force_show( 'login' ) ? ' eael-lr-otp-active' : ''; ?>
6889 <section id="eael-login-form-wrapper" class="<?php echo esc_attr( trim( $default_hide_class . $otp_active_class ) ); ?>" data-recaptcha-theme="<?php echo esc_attr( $rc_theme ); ?>" data-recaptcha-size="<?php echo esc_attr( $rc_size ); ?>">
6890 <div class="eael-login-form-wrapper eael-lr-form-wrapper style-2 <?php echo esc_attr( $icon_class ); ?>">
6891 <?php
6892 if ( $show_logout_link && is_user_logged_in() && ! $this->in_editor ) {
6893 /* translators: %s user display name */
6894 $logout_link_text = ! empty( $this->ds['log_out_link_text'] ) ? $this->ds['log_out_link_text'] : 'You are already logged in as [username]. ([logout_link])';
6895 $logout_link_text = $this->replace_placeholders_logout_link_text($logout_link_text);
6896 echo wp_kses( $logout_link_text, HelperCLass::eael_allowed_tags() );
6897 } else {
6898 if ( 'left' === $this->form_illustration_pos ) {
6899 $this->print_form_illustration();
6900 }
6901 ?>
6902 <div class="lr-form-wrapper">
6903 <?php $this->print_form_header( 'login' ); ?>
6904 <?php do_action( 'eael/login-register/before-login-form', $this ); ?>
6905 <form class="eael-login-form eael-lr-form"
6906 id="eael-login-form"
6907 method="post">
6908 <?php
6909 if ( isset( $this->ds['position_for_login_form'] ) && 'top' === $this->ds['position_for_login_form'] ) {
6910 do_action( 'eael/login-register/render_social_login_for_login_form', $this );
6911 }
6912 do_action( 'eael/login-register/after-login-form-open', $this );
6913
6914 if( 'top' === $err_msg_position ) {
6915 echo '<div class="eael-form-validation-container">';
6916 $this->print_login_validation_errors();
6917 echo '</div>';
6918 }
6919 ?>
6920 <div class="eael-lr-form-group eael-user-login">
6921 <?php if ( $display_label && $u_label ) {
6922 echo '<label for="eael-user-login" class="eael-field-label">' . wp_kses( $u_label, HelperCLass::eael_allowed_tags() ) . '</label>';
6923 } ?>
6924 <input type="text"
6925 name="eael-user-login"
6926 id="eael-user-login"
6927 class="eael-lr-form-control"
6928 placeholder="<?php if ( $display_label && $u_ph ) {
6929 echo esc_attr( $u_ph );
6930 } ?>"
6931 required autocomplete="username email">
6932 <?php
6933 if ( $show_icon ) {
6934 echo '<i class="fas fa-user"></i>';
6935 } ?>
6936 </div>
6937 <div class="eael-lr-form-group eael-user-password">
6938 <?php if ( $display_label && $p_label ) {
6939 echo '<label for="eael-user-password" class="eael-field-label">' . wp_kses( $p_label, HelperCLass::eael_allowed_tags() ) . '</label>';
6940 } ?>
6941 <div class="eael-lr-password-wrapper">
6942 <input type="password"
6943 name="eael-user-password"
6944 class="eael-lr-form-control"
6945 id="eael-user-password"
6946 placeholder="<?php if ( $display_label && $p_ph ) {
6947 echo esc_attr( $p_ph );
6948 } ?>"
6949 required autocomplete="current-password">
6950 <?php if ( $show_pv_icon ) { ?>
6951 <button type="button"
6952 id="wp-hide-pw"
6953 class="wp-hide-pw hide-if-no-js"
6954 aria-label="Show password">
6955 <span class="dashicons dashicons-visibility"
6956 aria-hidden="true"></span>
6957 </button>
6958 <?php } ?>
6959 <?php
6960 if ( $show_icon ) {
6961 echo '<i class="fas fa-lock"></i>';
6962 } ?>
6963 </div>
6964 </div>
6965 <div class="eael-forever-forget eael-lr-form-group">
6966 <?php if ( $show_rememberme && !empty( $remember_text )) { ?>
6967 <p class="forget-menot">
6968 <input name="eael-rememberme" type="checkbox" id="rememberme" <?php if ( $remember_checked ) { echo 'checked'; } ?> class="remember-me <?php echo esc_attr( $rm_type ); ?>" value="forever">
6969 <label for="rememberme" class="eael-checkbox-label rememberme"><?php echo esc_html( $remember_text ); ?></label>
6970 </p>
6971 <?php }
6972 if ( $show_lp ) {
6973 echo '<p class="forget-pass">' . wp_kses( $lp_link, HelperCLass::eael_allowed_tags( [ 'a' => [ 'data-action' => [] ] ] ) ) . '</p>';
6974 } ?>
6975
6976 </div>
6977
6978 <?php
6979 do_action( 'eael/login-register/before-recaptcha', $this );
6980 $this->print_bot_protection_node( 'login' );
6981 do_action( 'eael/login-register/after-recaptcha', $this );
6982 do_action( 'eael/login-register/before-login-footer', $this );
6983 ?>
6984
6985
6986 <div class="eael-lr-footer">
6987 <div class="eael-lr-form-loader-wrapper">
6988 <button type="submit" name="eael-login-submit" id="eael-login-submit" class="g-recaptcha eael-lr-btn eael-lr-btn-block <?php echo esc_attr( $btn_align ); ?>">
6989 <?php
6990 if ( $btn_icon && 'left' === $btn_icon_position ) {
6991 Icons_Manager::render_icon( $btn_icon, [ 'class' => 'eael-lr-btn-icon' ] );
6992 }
6993 echo esc_html( $btn_text );
6994 if ( $btn_icon && 'right' === $btn_icon_position ) {
6995 Icons_Manager::render_icon( $btn_icon, [ 'class' => 'eael-lr-btn-icon' ] );
6996 }
6997 ?>
6998 </button>
6999
7000 <?php if( !empty( $show_login_spinner ) && 'true' === $show_login_spinner ): ?>
7001 <span class="eael-lr-form-loader eael-lr-login-form-loader d-none<?php echo esc_attr($this->in_editor ? '-editor' : '') ?>">
7002 <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><path d="M304 48a48 48 0 1 0 -96 0 48 48 0 1 0 96 0zm0 416a48 48 0 1 0 -96 0 48 48 0 1 0 96 0zM48 304a48 48 0 1 0 0-96 48 48 0 1 0 0 96zm464-48a48 48 0 1 0 -96 0 48 48 0 1 0 96 0zM142.9 437A48 48 0 1 0 75 369.1 48 48 0 1 0 142.9 437zm0-294.2A48 48 0 1 0 75 75a48 48 0 1 0 67.9 67.9zM369.1 437A48 48 0 1 0 437 369.1 48 48 0 1 0 369.1 437z"/></svg>
7003 </span>
7004 <?php endif; ?>
7005
7006 </div>
7007 <?php if ( $show_reg_link ) { ?>
7008 <div class="eael-sign-wrapper <?php echo esc_attr( $link_align ); ?>">
7009 <?php echo wp_kses( $reg_link, HelperCLass::eael_allowed_tags( [ 'a' => [ 'data-action' => [] ] ] ) ); ?>
7010 </div>
7011 <?php } ?>
7012
7013 </div>
7014 <?php
7015 do_action( 'eael/login-register/after-login-footer', $this );
7016 $position_for_login_form = isset( $this->ds['position_for_login_form'] ) ? $this->ds['position_for_login_form'] : 'bottom';
7017 if ( 'bottom' === $position_for_login_form ) {
7018 do_action( 'eael/login-register/render_social_login_for_login_form', $this );
7019 }
7020
7021 if( 'bottom' === $err_msg_position ) {
7022 echo '<div class="eael-form-validation-container">';
7023 $this->print_login_validation_errors();
7024 echo '</div>';
7025 }
7026 $this->print_necessary_hidden_fields( 'login' );
7027
7028 do_action( 'eael/login-register/before-login-form-close', $this );
7029 ?>
7030 </form>
7031 <?php
7032 do_action( 'eael/login-register/after-login-form', $this );
7033 $this->print_otp_form( 'login' );
7034 ?>
7035 </div>
7036 <?php
7037 if ( 'right' === $this->form_illustration_pos ) {
7038 $this->print_form_illustration();
7039 }
7040 }
7041 ?>
7042 </div>
7043
7044 </section>
7045
7046 <script>
7047 jQuery(document).ready(function($){
7048 var eael_get_login_status = localStorage.getItem( 'eael-is-login-form' );
7049 if( eael_get_login_status === 'true' ) {
7050 setTimeout(function() {
7051 var button = jQuery('[eael-login="yes"]');
7052 if( ! button.hasClass('eael-clicked') ) {
7053 button.trigger('click').addClass('eael-clicked');
7054 }
7055 }, 100);
7056
7057 setTimeout(function() {
7058 jQuery('[eael-login="yes"]').removeClass('eael-clicked')
7059 }, 500);
7060 }
7061 });
7062 </script>
7063 <?php
7064 }
7065 }
7066
7067 protected function print_register_form() {
7068 // If an OTP challenge is in flight for a DIFFERENT form (e.g. ?eael_otp_flow=login),
7069 // suppress the entire register section so only the OTP UI is visible on the page.
7070 $otp_active_flow = $this->eael_otp_active_flow();
7071 if ( $otp_active_flow && 'register' !== $otp_active_flow ) {
7072 return;
7073 }
7074
7075 if ( $this->should_print_register_form ) {
7076 //phpcs:ignore WordPress.Security.NonceVerification.Recommended
7077 $default_hide_class = ( 'login' === $this->default_form || 'lostpassword' === $this->default_form || $this->should_print_resetpassword_form_editor || isset($_GET['eael-lostpassword']) || isset($_GET['eael-resetpassword']) ) && !isset($_GET['eael-register']) ? 'eael-lr-d-none' : ''; //eael-register flag for show error/success message when formal form submit
7078
7079 // Force-show this section if a register OTP challenge is in progress, or the editor preview is on.
7080 if ( $this->eael_otp_should_force_show( 'register' ) ) {
7081 $default_hide_class = '';
7082 }
7083 $is_pass_valid = false; // Does the form has a password field?
7084 $is_pass_confirmed = false;
7085 // placeholders to flag if user use one type of field more than once.
7086 $email_exists = 0;
7087 $user_name_exists = 0;
7088 $password_exists = 0;
7089 $confirm_pass_exists = 0;
7090 $first_name_exists = 0;
7091 $last_name_exists = 0;
7092 $website_exists = 0;
7093 $eael_phone_number_exists = 0;
7094 $honeypot_exists = 0;
7095
7096 $f_labels = [
7097 'email' => __( 'Email', 'essential-addons-for-elementor-lite' ),
7098 'password' => __( 'Password', 'essential-addons-for-elementor-lite' ),
7099 'confirm_password' => __( 'Confirm Password', 'essential-addons-for-elementor-lite' ),
7100 'user_name' => __( 'Username', 'essential-addons-for-elementor-lite' ),
7101 'first_name' => __( 'First Name', 'essential-addons-for-elementor-lite' ),
7102 'last_name' => __( 'Last Name', 'essential-addons-for-elementor-lite' ),
7103 'website' => __( 'Website', 'essential-addons-for-elementor-lite' ),
7104 'eael_phone_number' => __( 'Phone', 'essential-addons-for-elementor-lite' ),
7105 'honeypot' => __( 'Honeypot', 'essential-addons-for-elementor-lite' ),
7106 ];
7107
7108 $eael_custom_profile_fields_text = $this->get_eael_custom_profile_fields( 'text' );
7109 $eael_custom_profile_fields_image = $this->get_eael_custom_profile_fields( 'image' );
7110 $eael_custom_profile_fields = array_merge( $eael_custom_profile_fields_text, $eael_custom_profile_fields_image );
7111
7112 $f_labels = array_merge($f_labels, $eael_custom_profile_fields);
7113
7114 foreach( $eael_custom_profile_fields as $eael_custom_profile_field_key => $eael_custom_profile_field_value ) {
7115 $eael_custom_profile_field_key_exists = $eael_custom_profile_field_key . '_exists';
7116 $$eael_custom_profile_field_key_exists = 0; // dynamic variable
7117 }
7118
7119 $repeated_f_labels = [];
7120
7121 //Login link related
7122 $lgn_link_action = ! empty( $this->ds['login_link_action'] ) ? sanitize_text_field( $this->ds['login_link_action'] ) : 'form';
7123 $show_lgn_link = 'yes' === $this->get_settings( 'show_login_link' );
7124 $lgn_link_text = ! empty( $this->get_settings( 'login_link_text' ) ) ? HelperCLass::eael_wp_kses($this->get_settings( 'login_link_text' )) : __( 'Login', 'essential-addons-for-elementor-lite' );
7125 $btn_text = ! empty( $this->ds['reg_button_text'] ) ? sanitize_text_field( $this->ds['reg_button_text'] ) : '';
7126 $btn_icon = ! empty( $this->ds['reg_button_icon'] ) ? $this->ds['reg_button_icon'] : '';
7127 $btn_icon_position= ! empty( $this->ds['reg_button_icon_position'] ) ? sanitize_text_field( $this->ds['reg_button_icon_position'] ) : 'left';
7128
7129 $parts = explode( "\n", $lgn_link_text );
7130 $lgn_link_text = array_pop( $parts );
7131 $lgn_message = array_shift( $parts );
7132 $lgn_link_placeholder = '<span class="d-ib">%1$s</span> <a href="%2$s" id="eael-lr-login-toggle" class="eael-lr-link" data-action="%3$s" %5$s>%4$s</a>';
7133 $lgn_url = $lgn_atts = '';
7134
7135 $show_register_spinner = !empty( $this->ds['register_btn_show_spinner'] ) ? $this->ds['register_btn_show_spinner'] : '';
7136 $show_pv_icon = ( ! empty( $this->ds['password_toggle_register'] ) && 'yes' === $this->ds['password_toggle_register'] );
7137
7138 switch ( $lgn_link_action ) {
7139 case 'custom':
7140 $lgn_url = ! empty( $this->ds['custom_login_url']['url'] ) ? sanitize_url( $this->ds['custom_login_url']['url'] ) : '';
7141 $lgn_atts = ! empty( $this->ds['custom_login_url']['is_external'] ) ? ' target="_blank"' : '';
7142 $lgn_atts .= ! empty( $this->ds['custom_login_url']['nofollow'] ) ? ' rel="nofollow"' : '';
7143 break;
7144 case 'default':
7145 $lgn_url = wp_login_url();
7146 break;
7147 }
7148 $lgn_link = sprintf( $lgn_link_placeholder, $lgn_message, esc_url( $lgn_url ), esc_attr( $lgn_link_action ), $lgn_link_text, $lgn_atts );
7149
7150 // btn alignment
7151 $btn_align = isset( $this->ds['register_btn_align'] ) ? esc_html( $this->ds['register_btn_align'] ) : '';
7152 $link_align = isset( $this->ds['register_link_align'] ) ? esc_html( $this->ds['register_link_align'] ) : '';
7153 // reCAPTCHA style
7154 $rc_theme = isset( $this->ds['register_rc_theme'] ) ? esc_html( $this->ds['register_rc_theme'] ) : 'light';
7155 $rc_size = isset( $this->ds['register_rc_size'] ) ? esc_html( $this->ds['register_rc_size'] ) : 'normal';
7156 // input icons
7157 $show_icon = ( $this->pro_enabled && ! empty( $this->ds['show_register_icon'] ) && 'yes' === $this->ds['show_register_icon'] );
7158 $icon_class = $show_icon ? 'lr-icon-showing' : '';
7159
7160 $use_weak_password = true;
7161 if( isset( $this->ds['use_weak_password'] ) ){
7162 $use_weak_password = !empty( $this->ds['use_weak_password'] ) ? 1 : 0;
7163 }
7164
7165 $password_min_length = !empty( $this->ds['weak_pass_min_char'] ) ? intval( $this->ds['weak_pass_min_char'] ) : '';
7166 $password_one_uppercase = !empty( $this->ds['weak_pass_one_uppercase'] ) ? true : false;
7167 $password_one_lowercase = !empty( $this->ds['weak_pass_one_lowercase'] ) ? true : false;
7168 $password_one_number = !empty( $this->ds['weak_pass_one_number'] ) ? true : false;
7169 $password_one_special = !empty( $this->ds['weak_pass_one_special'] ) ? true : false;
7170 $err_msg_position = $this->ds['err_message_position_registration'];
7171
7172 $otp_active_class = $this->eael_otp_should_force_show( 'register' ) ? ' eael-lr-otp-active' : '';
7173
7174 ob_start();
7175 ?>
7176 <section
7177 id="eael-register-form-wrapper"
7178 class="<?php echo esc_attr( trim( $default_hide_class . $otp_active_class ) ); ?>"
7179 data-recaptcha-theme="<?php echo esc_attr( $rc_theme ); ?>"
7180 data-recaptcha-size="<?php echo esc_attr( $rc_size ); ?>"
7181 data-use-weak-password="<?php echo esc_attr( $use_weak_password ); ?>"
7182 data-password-min-length="<?php echo esc_attr( $password_min_length ); ?>"
7183 data-password-one-uppercase="<?php echo esc_attr( $password_one_uppercase ); ?>"
7184 data-password-one-lowercase="<?php echo esc_attr( $password_one_lowercase ); ?>"
7185 data-password-one-number="<?php echo esc_attr( $password_one_number ); ?>"
7186 data-password-one-special="<?php echo esc_attr( $password_one_special ); ?>"
7187 >
7188 <div class="eael-register-form-wrapper eael-lr-form-wrapper style-2 <?php echo esc_attr( $icon_class ); ?>">
7189 <?php if ( 'left' === $this->form_illustration_pos ) {
7190 $this->print_form_illustration();
7191 } ?>
7192 <div class="lr-form-wrapper">
7193 <?php
7194 $this->print_form_header( 'register' );
7195 do_action( 'eael/login-register/before-register-form', $this );
7196
7197 $has_file_input = 0;
7198 foreach ( $this->ds['register_fields'] as $single_field ) {
7199 $single_field_type = $single_field['field_type'];
7200
7201 if( ! empty( $eael_custom_profile_fields_image[ $single_field_type ] ) ){
7202 $has_file_input = 1;
7203 break;
7204 }
7205 }
7206 ?>
7207 <form class="eael-register-form eael-lr-form"
7208 id="eael-register-form"
7209 method="post"
7210 <?php if ( $has_file_input ) : ?>
7211 enctype="multipart/form-data"
7212 <?php endif; ?>
7213 >
7214 <?php
7215 do_action( 'eael/login-register/after-register-form-open', $this );
7216
7217 $position = isset( $this->ds['position_for_register_form'] ) ?$this->ds['position_for_register_form'] : 'bottom';
7218 if ( 'top' === $position ) {
7219 do_action( 'eael/login-register/render_social_login_for_register_form', $this );
7220 }
7221
7222 if( 'top' === $err_msg_position ) {
7223 echo '<div class="eael-form-validation-container">';
7224 $this->print_validation_message();
7225 echo '</div>';
7226 }
7227 ?>
7228 <?php // Print all dynamic fields
7229 foreach ( $this->ds['register_fields'] as $f_index => $field ) :
7230 $field_type = $field['field_type'];
7231 $dynamic_field_name = "{$field_type}_exists";
7232 if( ! isset( $$dynamic_field_name ) ){
7233 $$dynamic_field_name = 0;
7234 }
7235 $$dynamic_field_name ++; //NOTE, double $$ intentional. Dynamically update the var check eg. $username_exists++ to prevent user from using the same field twice
7236 // is same field repeated?
7237 if ( $$dynamic_field_name > 1 ) {
7238 $repeated_f_labels[] = $f_labels[ $field_type ];
7239 }
7240
7241 if ( 'password' === $field_type ) {
7242 $is_pass_valid = true;
7243 }
7244
7245 $current_field_required = ( ! empty( $field['required'] ) || in_array( $field_type, [
7246 'password',
7247 'confirm_pass',
7248 'email',
7249 ] ) );
7250
7251 //keys for attribute binding
7252 $input_key = "input{$f_index}";
7253 $label_key = "label{$f_index}";
7254 $field_group_key = "field-group{$f_index}";
7255
7256 // determine proper input tag type
7257 switch ( $field_type ) {
7258 case 'eael_phone_number':
7259 case 'user_name':
7260 case 'first_name':
7261 case 'last_name':
7262 case 'honeypot':
7263 $field_input_type = 'text';
7264 break;
7265 case 'confirm_pass':
7266 $field_input_type = 'password';
7267 break;
7268 case 'website':
7269 $field_input_type = 'url';
7270 break;
7271 default:
7272 $field_input_type = $field_type;
7273 }
7274
7275 if( ! empty( $eael_custom_profile_fields_text[ $field_type ] ) ){
7276 $field_input_type = 'text';
7277 }
7278
7279 if( ! empty( $eael_custom_profile_fields_image[ $field_type ] ) ){
7280 $field_input_type = 'file';
7281 }
7282
7283 $field_type_honeypot = 'eaelhoneyp' . esc_attr( $this->get_id() );
7284 $field_type = 'honeypot' === $field_type ? $field_type_honeypot : $field_type;
7285
7286 $this->add_render_attribute( [
7287 $input_key => [
7288 'name' => $field_type,
7289 'type' => $field_input_type,
7290 'placeholder' => $field['placeholder'],
7291 'class' => [
7292 'eael-lr-form-control',
7293 'form-field-' . $field_type,
7294 ],
7295 'id' => 'form-field-' . $field_type,
7296 ],
7297 $label_key => [
7298 'for' => 'form-field-' . $field_type,
7299 'class' => 'eael-field-label',
7300 ],
7301 ] );
7302
7303 // print require field attributes
7304 if ( $current_field_required ) {
7305 $this->add_render_attribute( $input_key, [
7306 'required' => 'required',
7307 'aria-required' => 'true',
7308 ] );
7309 if ( 'yes' === $this->ds['mark_required'] ) {
7310 $this->add_render_attribute( $label_key, [
7311 'class' => 'mark-required',
7312 ] );
7313 }
7314
7315 }
7316
7317
7318 // add css classes to the main input field wrapper.
7319 $field_group_key_array = [
7320 'class' => [
7321 'eael-lr-form-group',
7322 'elementor-repeater-item-'.$field['_id'],
7323 'eael-field-type-' . $field_type,
7324 ],
7325 ];
7326
7327 if ( $field_type_honeypot === $field_type ){
7328 $field_group_key_array['style'] = 'display:none;';
7329 $field['field_label'] = '';
7330 }
7331
7332 $this->add_render_attribute( [
7333 $field_group_key => $field_group_key_array,
7334 ] );
7335
7336 ?>
7337 <div <?php $this->print_render_attribute_string( $field_group_key ) ?>>
7338 <?php
7339 if ( 'yes' === $this->ds['show_labels'] && ! empty( $field['field_label'] ) ) {
7340 echo '<label '; $this->print_render_attribute_string( $label_key ); echo '>' . wp_kses( $field['field_label'], HelperCLass::eael_allowed_tags() ) . '</label>';
7341 }
7342 if( 'password' === $field['field_type'] ){
7343 echo '<div class="eael-lr-password-wrapper-register">';
7344 echo '<input '; $this->print_render_attribute_string( $input_key ); echo '>';
7345
7346 if ( $show_pv_icon ) { ?>
7347 <button type="button"
7348 id="wp-hide-pw-register"
7349 class="wp-hide-pw hide-if-no-js"
7350 aria-label="Show password">
7351 <span class="dashicons dashicons-visibility"
7352 aria-hidden="true"></span>
7353 </button>
7354 <?php }
7355
7356 if ( $show_icon && ! empty( $field['icon'] ) ) {
7357 Icons_Manager::render_icon( $field['icon'], [ 'aria-hidden' => 'true' ] );
7358 }
7359 echo '</div>';
7360 } else {
7361 echo '<input '; $this->print_render_attribute_string( $input_key ); echo '>';
7362
7363 if ( $show_icon && ! empty( $field['icon'] ) ) {
7364 Icons_Manager::render_icon( $field['icon'], [ 'aria-hidden' => 'true' ] );
7365 }
7366 }
7367 ?>
7368
7369 <?php
7370 if ( 'password' === $field['field_type'] ) {
7371 do_action( 'eael/login-register/after-password-field', $this );
7372 }
7373
7374 if ( 'email' === $field['field_type'] ) {
7375 do_action( 'eael/login-register/after-email-field' );
7376 }
7377
7378 echo "</div>";
7379 endforeach;
7380 $this->print_necessary_hidden_fields( 'register' );
7381 do_action( 'eael/login-register/mailchimp_user_consent_field', $this );
7382 $this->print_terms_condition_notice();
7383
7384 do_action( 'eael/login-register/before-register-recaptcha', $this );
7385 $this->print_bot_protection_node( 'register' );
7386 do_action( 'eael/login-register/after-register-recaptcha', $this );
7387 do_action( 'eael/login-register/before-register-footer', $this );
7388 ?>
7389
7390 <div class="eael-lr-footer">
7391 <div class="eael-lr-form-loader-wrapper">
7392 <button type="submit" name="eael-register-submit" id="eael-register-submit" class="eael-lr-btn eael-lr-btn-block<?php echo esc_attr( $btn_align ); ?>">
7393 <?php
7394 if ( $btn_icon && 'left' === $btn_icon_position ) {
7395 Icons_Manager::render_icon( $btn_icon, [ 'class' => 'eael-lr-btn-icon' ] );
7396 }
7397 echo esc_html( $btn_text );
7398 if ( $btn_icon && 'right' === $btn_icon_position ) {
7399 Icons_Manager::render_icon( $btn_icon, [ 'class' => 'eael-lr-btn-icon' ] );
7400 }
7401 ?>
7402 </button>
7403
7404 <?php if( !empty( $show_register_spinner ) && 'true' === $show_register_spinner ): ?>
7405 <span class="eael-lr-form-loader eael-lr-register-form-loader d-none<?php echo esc_attr($this->in_editor ? '-editor' : ''); ?>">
7406 <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><path d="M304 48a48 48 0 1 0 -96 0 48 48 0 1 0 96 0zm0 416a48 48 0 1 0 -96 0 48 48 0 1 0 96 0zM48 304a48 48 0 1 0 0-96 48 48 0 1 0 0 96zm464-48a48 48 0 1 0 -96 0 48 48 0 1 0 96 0zM142.9 437A48 48 0 1 0 75 369.1 48 48 0 1 0 142.9 437zm0-294.2A48 48 0 1 0 75 75a48 48 0 1 0 67.9 67.9zM369.1 437A48 48 0 1 0 437 369.1 48 48 0 1 0 369.1 437z"/></svg>
7407 </span>
7408 <?php endif; ?>
7409
7410 </div>
7411 <?php if ( $show_lgn_link ) { ?>
7412 <div class="eael-sign-wrapper <?php echo esc_attr( $link_align ); ?>">
7413 <?php echo wp_kses( $lgn_link, HelperCLass::eael_allowed_tags( [ 'a' => [ 'data-action' => [] ] ] ) ); ?>
7414 </div>
7415 <?php } ?>
7416 </div>
7417
7418 <?php
7419 do_action( 'eael/login-register/after-register-footer', $this );
7420 $position = isset( $this->ds['position_for_register_form'] ) ? $this->ds['position_for_register_form'] : 'bottom';
7421 if ( 'bottom' === $position ) {
7422 do_action( 'eael/login-register/render_social_login_for_register_form', $this );
7423 }
7424
7425 if( 'bottom' === $err_msg_position ) {
7426 echo '<div class="eael-form-validation-container">';
7427 $this->print_validation_message();
7428 echo '</div>';
7429 }
7430 ?>
7431 <?php
7432 do_action( 'eael/login-register/before-register-form-close', $this );
7433 ?>
7434 </form>
7435 <?php
7436 do_action( 'eael/login-register/after-register-form', $this );
7437 $this->print_otp_form( 'register' );
7438 ?>
7439 </div>
7440 <?php if ( 'right' === $this->form_illustration_pos ) {
7441 $this->print_form_illustration();
7442 } ?>
7443 </div>
7444 </section>
7445 <?php
7446 $form_markup = apply_filters( 'eael/login-register/register-form-markup', ob_get_clean() );
7447 // if we are in the editor then show error related to different input field.
7448 if ( $this->in_editor ) {
7449 $repeated = $this->print_error_for_repeated_fields( $repeated_f_labels );
7450 $email_field_missing = $this->print_error_for_missing_email_field( $email_exists );
7451 $pass_missing = $this->print_error_for_missing_password_field( $password_exists, $confirm_pass_exists );
7452 if ( $repeated || $email_field_missing || $pass_missing ) {
7453 return false; // error found, exit, dont show form.
7454 }
7455 // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
7456 echo $form_markup; //XSS OK, data sanitized already.
7457 } else {
7458 // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
7459 echo $form_markup; //XSS OK, data sanitized already.
7460 }
7461 }
7462 }
7463
7464 protected function print_lostpassword_form(){
7465 // Suppress this section entirely while any OTP challenge is in flight.
7466 if ( $this->eael_otp_active_flow() ) {
7467 return;
7468 }
7469
7470 if ( $this->should_print_lostpassword_form ) {
7471 $form_not_enabled = ! ( 'lostpassword' === $this->default_form || ( 'yes' === $this->get_settings_for_display( 'show_lost_password' ) && 'form' === $this->get_settings_for_display( 'lost_password_link_type' ) ) );
7472
7473 //phpcs:ignore WordPress.Security.NonceVerification.Recommended
7474 if( $form_not_enabled && isset( $_GET['eael-lostpassword'] ) ){
7475 wp_safe_redirect( remove_query_arg( array( 'eael-lostpassword' ) ) );
7476 exit;
7477 }
7478
7479 // prepare all lostpassword form related vars
7480 //phpcs:ignore WordPress.Security.NonceVerification.Recommended
7481 $default_hide_class = ( 'register' === $this->default_form || 'login' === $this->default_form || $this->should_print_resetpassword_form_editor || isset($_GET['eael-register']) || isset($_GET['eael-resetpassword']) ) && !isset($_GET['eael-lostpassword']) ? 'eael-lr-d-none' : '';
7482
7483 //Login link related
7484 $login_link_action_lostpassword = ! empty( $this->ds['login_link_action_lostpassword'] ) ? esc_html( $this->ds['login_link_action_lostpassword'] ) : 'form';
7485 $show_login_link_lostpassword = ( 'yes' === $this->get_settings( 'show_login_link_lostpassword' ) );
7486 $login_link_text_lostpassword = ! empty( $this->get_settings( 'login_link_text_lostpassword' ) ) ? HelperCLass::eael_wp_kses($this->get_settings( 'login_link_text_lostpassword' )) : __( 'Login', 'essential-addons-for-elementor-lite' );
7487 $parts = explode( "\n", $login_link_text_lostpassword );
7488 $login_link_text_lostpassword = array_pop( $parts );
7489 $login_message_lostpassword = array_shift( $parts );
7490
7491 $success_key = 'eael_lostpassword_success_' . esc_attr( $this->get_id() );
7492 $lostpassword_success = apply_filters( 'eael/login-register/lostpassword-success-message', get_option( $success_key ) );
7493 $hide_class_after_submission = ! empty( $lostpassword_success ) ? 'eael-d-none' : '';
7494
7495 $login_link_placeholder_lostpassword = '<span class="d-ib">%1$s</span> <a href="%2$s" id="eael-lr-login-toggle-lostpassword" class="eael-lr-link" data-action="%3$s" %5$s %6$s>%4$s</a>';
7496 $login_atts_lostpassword = $login_url_lostpassword = '';
7497 switch ( $login_link_action_lostpassword ) {
7498 case 'custom':
7499 $login_url_lostpassword = ! empty( $this->ds['custom_login_url_lostpass']['url'] ) ? esc_url_raw( $this->ds['custom_login_url_lostpass']['url'] ) : '';
7500 $login_atts_lostpassword = ! empty( $this->ds['custom_login_url_lostpass']['is_external'] ) ? ' target="_blank"' : '';
7501 $login_atts_lostpassword .= ! empty( $this->ds['custom_login_url_lostpass']['nofollow'] ) ? ' rel="nofollow"' : '';
7502 $this->add_link_attributes( 'login_button_lostpassword', $this->ds['custom_login_url_lostpass'] );
7503 break;
7504 case 'default':
7505 $login_url_lostpassword = wp_login_url();
7506 break;
7507 }
7508
7509 $login_link_lostpassword = sprintf( $login_link_placeholder_lostpassword, $login_message_lostpassword, esc_url( $login_url_lostpassword ), esc_attr( $login_link_action_lostpassword ), $login_link_text_lostpassword, $login_atts_lostpassword, $this->get_render_attribute_string( 'login_button_lostpassword' ) );
7510
7511 // lost password form fields related
7512 $label_type = ! empty( $this->ds['lostpassword_label_types'] ) ? esc_html( $this->ds['lostpassword_label_types'] ) : 'default';
7513 $is_custom_label = ( 'custom' === $label_type );
7514 $display_label = ( 'none' !== $label_type );
7515
7516 //Default label n placeholder
7517 $u_label = $u_ph = esc_html__( 'Username or Email Address', 'essential-addons-for-elementor-lite' );
7518
7519 // custom label n placeholder
7520 if ( $is_custom_label ) {
7521 $u_label = isset( $this->ds['lostpassword_user_label'] ) ? esc_html( wp_strip_all_tags( $this->ds['lostpassword_user_label'] ) ) : '';
7522 $u_ph = isset( $this->ds['lostpassword_user_placeholder'] ) ? esc_html( wp_strip_all_tags( $this->ds['lostpassword_user_placeholder'] ) ) : '';
7523 }
7524 $btn_text = ! empty( $this->ds['lostpassword_button_text'] ) ? sanitize_text_field( $this->ds['lostpassword_button_text'] ) : '';
7525
7526 // btn alignment
7527 $btn_align = isset( $this->ds['lostpassword_btn_align'] ) ? esc_html( $this->ds['lostpassword_btn_align'] ) : '';
7528 // link alignment
7529 $link_align = isset( $this->ds['lostpassword_link_align'] ) ? esc_html( $this->ds['lostpassword_link_align'] ) : '';
7530
7531 // reCAPTCHA style
7532 $rc_theme = isset( $this->ds['lostpassword_rc_theme'] ) ? esc_html( $this->ds['lostpassword_rc_theme'] ) : 'light';
7533 $rc_size = isset( $this->ds['lostpassword_rc_size'] ) ? esc_html( $this->ds['lostpassword_rc_size'] ) : 'normal';
7534
7535 // input icons
7536 $show_icon = ( $this->pro_enabled && ! empty( $this->ds['show_lostpassword_icon'] ) && 'yes' === esc_html( $this->ds['show_lostpassword_icon'] ) );
7537 $icon_class = $show_icon ? 'lr-icon-showing' : '';
7538 $err_msg_position = ! empty( $this->ds['err_message_position_lostpassword'] ) ? $this->ds['err_message_position_lostpassword'] : 'top';
7539 $btn_icon = ! empty( $this->ds['lost_pass_button_icon'] ) ? $this->ds['lost_pass_button_icon'] : '';
7540 $btn_icon_position= ! empty( $this->ds['lost_pass_button_icon_position'] ) ? sanitize_text_field( $this->ds['lost_pass_button_icon_position'] ) : 'left';
7541 ?>
7542 <section
7543 id="eael-lostpassword-form-wrapper"
7544 class="<?php echo esc_attr( $default_hide_class ); ?>"
7545 data-recaptcha-theme="<?php echo esc_attr( $rc_theme ); ?>"
7546 data-recaptcha-size="<?php echo esc_attr( $rc_size ); ?>"
7547 >
7548 <div class="eael-lostpassword-form-wrapper eael-lr-form-wrapper style-2 <?php echo esc_attr( $icon_class ); ?>">
7549 <?php
7550 if ( 'left' === $this->form_illustration_pos ) {
7551 $this->print_form_illustration('lostpassword');
7552 }
7553
7554 ?>
7555 <div class="lr-form-wrapper">
7556 <?php $this->print_form_header( 'lostpassword' ); ?>
7557 <?php do_action( 'eael/login-register/before-lostpassword-form', $this ); ?>
7558 <form class="eael-lostpassword-form eael-lr-form" id="eael-lostpassword-form" method="post">
7559 <?php do_action( 'eael/login-register/after-lostpassword-form-open', $this );
7560 if( 'top' === $err_msg_position ) {
7561 echo '<div class="eael-form-validation-container">';
7562 $this->print_lostpassword_validation_errors();
7563 echo '</div>';
7564 $this->print_lostpassword_validation_errors();
7565 }
7566 ?>
7567 <div class="eael-lr-form-group <?php echo esc_attr( $hide_class_after_submission ); ?>">
7568 <?php if ( $display_label && $u_label ) {
7569 printf( '<label for="eael-user-lostpassword" class="eael-field-label">%s</label>', esc_html( $u_label ) );
7570 } ?>
7571 <input type="text" name="eael-user-lostpassword" id="eael-user-lostpassword" class="eael-lr-form-control" placeholder="<?php if ( $display_label && $u_ph ) { echo esc_attr( $u_ph ); } ?>" required>
7572 <?php
7573 if ( $show_icon ) {
7574 echo '<i class="fas fa-user"></i>';
7575 } ?>
7576 </div>
7577
7578 <?php
7579 if( empty( $lostpassword_success ) ){
7580 do_action( 'eael/login-register/before-lostpassword-recaptcha', $this );
7581 $this->print_bot_protection_node( 'lostpassword' );
7582 do_action( 'eael/login-register/after-lostpassword-recaptcha', $this );
7583 }
7584 do_action( 'eael/login-register/before-lostpassword-footer', $this );
7585 ?>
7586
7587 <div class="eael-lr-footer">
7588 <button type="submit" name="eael-lostpassword-submit" id="eael-lostpassword-submit" class="g-recaptcha eael-lr-btn eael-lr-btn-block <?php echo esc_attr( $btn_align ); ?> <?php echo esc_attr( $hide_class_after_submission ); ?>"><?php
7589 if ( $btn_icon && 'left' === $btn_icon_position ) {
7590 Icons_Manager::render_icon( $btn_icon, [ 'class' => 'eael-lr-btn-icon' ] );
7591 }
7592 echo esc_html( $btn_text );
7593 if ( $btn_icon && 'right' === $btn_icon_position ) {
7594 Icons_Manager::render_icon( $btn_icon, [ 'class' => 'eael-lr-btn-icon' ] );
7595 }
7596 ?></button>
7597 <?php if ( $show_login_link_lostpassword ) { ?>
7598 <div class="eael-sign-wrapper <?php echo esc_attr( $link_align ); ?>">
7599 <?php echo wp_kses( $login_link_lostpassword, HelperCLass::eael_allowed_tags( [ 'a' => [ 'data-action' => [] ] ] ) ); ?>
7600 </div>
7601 <?php } ?>
7602
7603 </div>
7604 <?php do_action( 'eael/login-register/after-lostpassword-footer', $this );
7605 if( 'bottom' === $err_msg_position ) {
7606 echo '<div class="eael-form-validation-container">';
7607 $this->print_lostpassword_validation_errors();
7608 echo '</div>';
7609 }
7610 $this->print_necessary_hidden_fields( 'lostpassword' );
7611
7612 do_action( 'eael/login-register/before-lostpassword-form-close', $this );
7613 ?>
7614 </form>
7615 <?php do_action( 'eael/login-register/after-lostpassword-form', $this ); ?>
7616 </div>
7617 <?php
7618 if ( 'right' === $this->form_illustration_pos ) {
7619 $this->print_form_illustration('lostpassword');
7620 }
7621 ?>
7622 </div>
7623
7624 </section>
7625 <?php
7626 }
7627 }
7628
7629 protected function print_resetpassword_form(){
7630 // Suppress this section entirely while any OTP challenge is in flight.
7631 if ( $this->eael_otp_active_flow() ) {
7632 return;
7633 }
7634
7635 //phpcs:ignore WordPress.Security.NonceVerification.Recommended
7636 $default_hide_class = ( 'register' === $this->default_form || 'login' === $this->default_form || 'lostpassword' === $this->default_form || isset($_GET['eael-register']) || isset($_GET['eael-lostpassword']) ) && !isset($_GET['eael-resetpassword']) ? 'eael-lr-d-none' : '';
7637 $default_hide_class = $this->should_print_resetpassword_form_editor ? '' : $default_hide_class;
7638 $rp_page_url = ! empty( $this->page_id_for_popup ) ? get_permalink( $this->page_id_for_popup ) : get_permalink( $this->page_id );
7639
7640 if( isset( $this->ds['enable_reset_password'] ) && 'yes' === $this->ds['enable_reset_password'] ){
7641 update_option( 'eael_lr_resetpassword_form_info', [
7642 'page_id' => get_the_ID(),
7643 'widget_id' => $this->get_id(),
7644 'link_text' => !empty( $this->ds['lostpassword_email_message_reset_link_text'] ) ? HelperCLass::eael_wp_kses( $this->ds['lostpassword_email_message_reset_link_text'] ) : __( 'Click here to reset your password', 'essential-addons-for-elementor-lite' )
7645 ] );
7646 } else {
7647 delete_option( 'eael_lr_resetpassword_form_info' );
7648 }
7649
7650 if ( $this->should_print_resetpassword_form_editor || ( ! empty( $_GET['eael-resetpassword'] ) ) ) { //phpcs:ignore WordPress.Security.NonceVerification.Recommended
7651 $show_resetpassword_on_form_submit = get_option('eael_show_reset_password_on_form_submit_' . $this->get_id());
7652
7653 $validation_required = true;
7654 if ( $this->should_print_resetpassword_form_editor || $show_resetpassword_on_form_submit ) {
7655 $validation_required = false;
7656 }
7657
7658 $rp_data['rp_login'] = ! empty( $_GET['eael_login'] ) ? sanitize_text_field( wp_unslash( $_GET['eael_login'] ) ) : ''; //phpcs:ignore WordPress.Security.NonceVerification.Recommended
7659 $rp_data['rp_key'] = ! empty( $_GET['eael_key'] ) ? sanitize_text_field( wp_unslash( $_GET['eael_key'] ) ) : ''; //phpcs:ignore WordPress.Security.NonceVerification.Recommended
7660
7661 //phpcs:ignore WordPress.Security.NonceVerification.Recommended, WordPress.Security.NonceVerification.Missing
7662 if( $validation_required && ! isset( $_POST['eael-resetpassword-submit'] ) ){
7663 $user = check_password_reset_key( $rp_data['rp_key'], $rp_data['rp_login'] );
7664
7665 if ( empty( $rp_data['rp_key'] ) || ! $user || is_wp_error( $user ) ) {
7666 $rp_err_msg = ! empty( $this->ds['err_reset_password_key_expired'] ) ? esc_html( wp_strip_all_tags( $this->ds['err_reset_password_key_expired'] ) ) : __( 'Your password reset link appears to be invalid. Please request a new link.', 'essential-addons-for-elementor-lite' );
7667 update_option( 'eael_lostpassword_error_' . esc_attr( $this->get_id() ), $rp_err_msg, false );
7668
7669 $resetpassword_redirect_url = esc_url_raw( $rp_page_url . '?eael-lostpassword=1&error=expiredkey' );
7670
7671 if( ! empty( $this->resetpassword_in_popup_selector ) ){
7672 $resetpassword_redirect_url = esc_url_raw( $rp_page_url . '?eael-lostpassword=1&error=expiredkey&popup-selector=' . $this->resetpassword_in_popup_selector );
7673 }
7674 ?>
7675 <script type="text/javascript">
7676 document.location.href = <?php echo json_encode( $resetpassword_redirect_url ); ?>;
7677 </script>
7678 <?php
7679 exit;
7680 }
7681 }
7682
7683 delete_option('eael_show_reset_password_on_form_submit_' . $this->get_id());
7684
7685 // lost password form fields related
7686 $label_type = ! empty( $this->ds['resetpassword_label_types'] ) ? esc_html( $this->ds['resetpassword_label_types'] ) : 'default';
7687 $is_custom_label = ( 'custom' === $label_type );
7688 $display_label = ( 'none' !== $label_type );
7689
7690 $success_key = 'eael_resetpassword_success_' . esc_attr( $this->get_id() );
7691 $resetpassword_success = apply_filters( 'eael/login-register/resetpassword-success-message', get_option( $success_key ) );
7692 $hide_class_after_submission = ! empty( $resetpassword_success ) ? 'eael-d-none' : '';
7693
7694 //Default label
7695 $password_label = __( 'New Password', 'essential-addons-for-elementor-lite' );
7696 $confirm_password_label = __( 'Confirm New Password', 'essential-addons-for-elementor-lite' );
7697
7698 $password_placeholder = __( 'New Password', 'essential-addons-for-elementor-lite' );
7699 $confirm_password_placeholder = __( 'Confirm New Password', 'essential-addons-for-elementor-lite' );
7700
7701 // custom label n placeholder
7702 if ( $is_custom_label ) {
7703 $password_label = isset( $this->ds['resetpassword_password_label'] ) ? $this->ds['resetpassword_password_label'] : '';
7704 $confirm_password_label = isset( $this->ds['resetpassword_confirm_password_label'] ) ? $this->ds['resetpassword_confirm_password_label'] : '';
7705
7706 $password_placeholder = isset( $this->ds['resetpassword_password_placeholder'] ) ? $this->ds['resetpassword_password_placeholder'] : '';
7707 $confirm_password_placeholder = isset( $this->ds['resetpassword_confirm_password_placeholder'] ) ? $this->ds['resetpassword_confirm_password_placeholder'] : '';
7708 }
7709
7710 $btn_text = ! empty( $this->ds['resetpassword_button_text'] ) ? sanitize_text_field( $this->ds['resetpassword_button_text'] ) : '';
7711
7712 // btn alignment
7713 $btn_align = isset( $this->ds['resetpassword_btn_align'] ) ? esc_html( $this->ds['resetpassword_btn_align'] ) : '';
7714 // input icons
7715 $show_icon = ( $this->pro_enabled && ! empty( $this->ds['show_resetpassword_icon'] ) && 'yes' === esc_html( $this->ds['show_resetpassword_icon'] ) );
7716 $icon_class = $show_icon ? 'lr-icon-showing' : '';
7717
7718 $show_pv_icon = ( ! empty( $this->ds['password_toggle_resetpassword'] ) && 'yes' === $this->ds['password_toggle_resetpassword'] );
7719 $err_msg_position = !empty( $this->ds['err_message_position_reset'] ) ? $this->ds['err_message_position_reset'] : 'bottom';
7720 ?>
7721 <section id="eael-resetpassword-form-wrapper" class="<?php echo esc_attr( $default_hide_class ); ?>" >
7722 <div class="eael-resetpassword-form-wrapper eael-lr-form-wrapper style-2 <?php echo esc_attr( $icon_class ); ?>">
7723 <?php
7724 if ( 'left' === $this->form_illustration_pos ) {
7725 $this->print_form_illustration('resetpassword');
7726 }
7727 ?>
7728 <div class="lr-form-wrapper">
7729 <?php $this->print_form_header( 'resetpassword' ); ?>
7730 <?php do_action( 'eael/login-register/before-resetpassword-form', $this ); ?>
7731 <form class="eael-resetpassword-form eael-lr-form"
7732 id="eael-resetpassword-form"
7733 method="post">
7734 <?php do_action( 'eael/login-register/after-resetpassword-form-open', $this );
7735 if( 'top' === $err_msg_position ) {
7736 echo '<div class="eael-form-validation-container sss">';
7737 $this->print_resetpassword_validation_errors();
7738 echo '</div>';
7739 }
7740 ?>
7741 <div class="eael-lr-form-group <?php echo esc_attr( $hide_class_after_submission ); ?>">
7742 <?php if ( $display_label && $password_label ) {
7743 printf( '<label for="eael-pass1" class="eael-field-label">%s</label>', esc_html( wp_strip_all_tags( $password_label ) ) );
7744 } ?>
7745 <div class="eael-lr-password-wrapper eael-lr-resetpassword-wrapper eael-lr-resetpassword1-wrapper">
7746 <input type="password"
7747 name="eael-pass1"
7748 id="eael-pass1"
7749 class="eael-lr-form-control"
7750 placeholder="<?php echo esc_html( wp_strip_all_tags( $password_placeholder ) ); ?>"
7751 required>
7752
7753 <?php if ( $show_pv_icon ) { ?>
7754 <button type="button"
7755 id="wp-hide-pw1"
7756 class="wp-hide-pw hide-if-no-js"
7757 aria-label="Show password">
7758 <span class="dashicons dashicons-visibility"
7759 aria-hidden="true"></span>
7760 </button>
7761 <?php } ?>
7762
7763 <?php
7764 if ( $show_icon ) {
7765 echo '<i class="fas fa-lock"></i>';
7766 } ?>
7767 </div>
7768 </div>
7769
7770 <div class="eael-lr-form-group <?php echo esc_attr( $hide_class_after_submission ); ?>">
7771 <?php if ( $display_label && $confirm_password_label ) {
7772 printf( '<label for="eael-pass2" class="eael-field-label">%s</label>', esc_html( wp_strip_all_tags( $confirm_password_label ) ) );
7773 } ?>
7774 <div class="eael-lr-password-wrapper eael-lr-resetpassword-wrapper eael-lr-resetpassword2-wrapper">
7775 <input type="password"
7776 name="eael-pass2"
7777 id="eael-pass2"
7778 class="eael-lr-form-control"
7779 placeholder="<?php echo esc_html( wp_strip_all_tags( $confirm_password_placeholder ) ); ?>"
7780 required>
7781
7782 <?php if ( $show_pv_icon ) { ?>
7783 <button type="button"
7784 id="wp-hide-pw2"
7785 class="wp-hide-pw hide-if-no-js eael-d-none"
7786 aria-label="Show password">
7787 <span class="dashicons dashicons-visibility"
7788 aria-hidden="true"></span>
7789 </button>
7790 <?php } ?>
7791
7792 <?php
7793 if ( $show_icon ) {
7794 echo '<i class="fas fa-lock"></i>';
7795 } ?>
7796 </div>
7797 </div>
7798
7799 <?php
7800 do_action( 'eael/login-register/before-resetpassword-footer', $this );
7801 ?>
7802
7803 <div class="eael-lr-footer">
7804 <input type="hidden" name="rp_key" value="<?php echo esc_attr( !empty( $rp_data['rp_key'] ) ? esc_html( $rp_data['rp_key'] ) : '' ); ?>" />
7805 <input type="hidden" name="rp_login" value="<?php echo esc_attr( !empty( $rp_data['rp_login'] ) ? esc_html( $rp_data['rp_login'] ) : '' ); ?>" />
7806
7807 <input type="submit"
7808 name="eael-resetpassword-submit"
7809 id="eael-resetpassword-submit"
7810 class="eael-lr-btn eael-lr-btn-block <?php echo esc_attr( $btn_align ); ?> <?php echo esc_attr( $hide_class_after_submission ); ?>"
7811 value="<?php echo esc_attr( $btn_text ); ?>"/>
7812 </div>
7813 <?php do_action( 'eael/login-register/after-resetpassword-footer', $this );
7814 if( 'bottom' === $err_msg_position ) {
7815 echo '<div class="eael-form-validation-container ddd">';
7816 $this->print_resetpassword_validation_errors();
7817 echo '</div>';
7818 }
7819
7820 $this->print_necessary_hidden_fields( 'resetpassword' );
7821
7822 do_action( 'eael/login-register/before-resetpassword-form-close', $this );
7823 ?>
7824 </form>
7825 <?php do_action( 'eael/login-register/after-resetpassword-form', $this ); ?>
7826 </div>
7827 <?php
7828 if ( 'right' === $this->form_illustration_pos ) {
7829 $this->print_form_illustration('resetpassword');
7830 }
7831 ?>
7832 </div>
7833
7834 </section>
7835 <?php
7836 }
7837 }
7838
7839 protected function print_form_illustration($form_type = 'login') {
7840 $show_form_image_class = '';
7841 if( 'lostpassword' === $form_type || 'resetpassword' === $form_type ){
7842 $show_form_image_class = ! empty( $this->ds['show_image_on_lostpassword_form'] ) && 'yes' === $this->ds['show_image_on_lostpassword_form'] ? '' : 'eael-d-none';
7843 }
7844
7845 if ( ! empty( $this->form_illustration_url ) ) { ?>
7846 <div class="lr-form-illustration lr-img-pos-<?php echo esc_attr( $this->form_illustration_pos ); ?> <?php echo esc_attr( $show_form_image_class ); ?>"
7847 style="background-image: url('<?php echo esc_attr( esc_url( $this->form_illustration_url ) ); ?>');"></div>
7848 <?php }
7849 }
7850
7851 /**
7852 * @param string $form_type the type of form. Available values: login and register
7853 */
7854 protected function print_form_header( $form_type = 'login' ) {
7855 $title = ! empty( $this->ds["{$form_type}_form_title"] ) ? wp_strip_all_tags( $this->ds["{$form_type}_form_title"] ) : '';
7856 $subtitle = ! empty( $this->ds["{$form_type}_form_subtitle"] ) ? $this->ds["{$form_type}_form_subtitle"] : '';
7857
7858 $show_form_logo_class = '';
7859 if( 'lostpassword' === $form_type || 'resetpassword' === $form_type ){
7860 $show_form_logo_class = ! empty( $this->ds['show_logo_on_lostpassword_form'] ) && 'yes' === $this->ds['show_logo_on_lostpassword_form'] ? '' : 'eael-d-none';
7861 }
7862
7863 if ( empty( $this->form_logo ) && empty( $title ) && empty( $subtitle ) ) {
7864 return;
7865 }
7866
7867 ?>
7868 <div class="lr-form-header header-<?php echo esc_attr( $this->form_logo_pos ); ?>">
7869 <?php if ( ! empty( $this->form_logo ) ) { ?>
7870 <div class="form-logo <?php echo esc_attr( $show_form_logo_class ); ?>">
7871 <img src="<?php echo esc_url( $this->form_logo ); ?>"
7872 alt="<?php esc_attr_e( 'Form Logo Image', 'essential-addons-for-elementor-lite' ); ?>">
7873 </div>
7874 <?php } ?>
7875
7876 <?php if ( ! empty( $title ) || ! empty( $subtitle ) ) { ?>
7877 <div class="form-dsc">
7878 <?php
7879 if ( ! empty( $title ) ) {
7880 echo "<h4>" . esc_html( $title ) . "</h4>"; // data escaped already.
7881 }
7882
7883 if ( ! empty( $subtitle ) ) {
7884 echo "<p>" . wp_kses( $subtitle, HelperCLass::eael_allowed_tags() ) . "</p>"; // data escaped already.
7885 } ?>
7886 </div>
7887 <?php } ?>
7888 </div>
7889 <?php
7890 }
7891
7892 /**
7893 * Print the Email OTP Verification UI for the given form type.
7894 * It's hidden by default; the frontend JS reveals it after the form submission triggers an OTP step.
7895 *
7896 * @param string $form_type 'login' or 'register'
7897 */
7898 protected function print_otp_form( $form_type = 'login' ) {
7899 $prefix = ( 'login' === $form_type ) ? 'login' : 'register';
7900 $enabled = ! empty( $this->ds[ "enable_{$prefix}_otp" ] ) && 'yes' === $this->ds[ "enable_{$prefix}_otp" ];
7901
7902 // Always render the OTP wrapper — even when the OTP toggle is off — so the DOM anchor
7903 // exists for the pending-registration intercept: if a user registered with OTP required
7904 // but never verified, `log_user_in()` blocks the login and returns `otp_required: true`.
7905 // Without the wrapper the JS has nowhere to inject the OTP screen and silently does nothing.
7906 // The wrapper starts `eael-d-none` and is only revealed by JS on demand.
7907
7908 $title = ! empty( $this->ds[ "{$prefix}_otp_title_text" ] ) ? $this->ds[ "{$prefix}_otp_title_text" ] : __( 'Verify Your Email', 'essential-addons-for-elementor-lite' );
7909 $subtitle = ! empty( $this->ds[ "{$prefix}_otp_subtitle_text" ] ) ? $this->ds[ "{$prefix}_otp_subtitle_text" ] : __( 'We have sent a 6-digit verification code to your email. Please enter it below to continue.', 'essential-addons-for-elementor-lite' );
7910 $verify_text = ! empty( $this->ds[ "{$prefix}_otp_verify_button_text" ] ) ? $this->ds[ "{$prefix}_otp_verify_button_text" ] : __( 'Verify', 'essential-addons-for-elementor-lite' );
7911 $resend_text = ! empty( $this->ds[ "{$prefix}_otp_resend_text" ] ) ? $this->ds[ "{$prefix}_otp_resend_text" ] : __( 'Resend Code', 'essential-addons-for-elementor-lite' );
7912 $cooldown = ! empty( $this->ds[ "{$prefix}_otp_resend_cooldown" ] ) ? (int) $this->ds[ "{$prefix}_otp_resend_cooldown" ] : 60;
7913
7914 // Hydrate the OTP token. Two sources are accepted:
7915 // 1. ?eael_otp=<token>&eael_otp_flow=<flow> — links emailed to the user
7916 // 2. eael_lr_otp_token_<wid> cookie — same-device fallback after non-AJAX submit
7917 $widget_id = $this->get_id();
7918 $cookie_name = 'eael_lr_otp_token_' . $widget_id;
7919 $cookie_value = isset( $_COOKIE[ $cookie_name ] ) ? sanitize_text_field( wp_unslash( $_COOKIE[ $cookie_name ] ) ) : '';
7920 $cookie_token = '';
7921 $cookie_flow = '';
7922 if ( $cookie_value && strpos( $cookie_value, '|' ) !== false ) {
7923 list( $cookie_token, $cookie_flow ) = array_map( 'sanitize_text_field', explode( '|', $cookie_value, 2 ) );
7924 }
7925
7926 //phpcs:ignore WordPress.Security.NonceVerification.Recommended
7927 if ( ! empty( $_GET['eael_otp'] ) && ! empty( $_GET['eael_otp_flow'] ) ) {
7928 //phpcs:ignore WordPress.Security.NonceVerification.Recommended
7929 $query_flow = sanitize_text_field( wp_unslash( $_GET['eael_otp_flow'] ) );
7930 if ( $query_flow === $form_type ) {
7931 //phpcs:ignore WordPress.Security.NonceVerification.Recommended
7932 $cookie_token = sanitize_text_field( wp_unslash( $_GET['eael_otp'] ) );
7933 $cookie_flow = $query_flow;
7934 }
7935 }
7936
7937 $auto_show = ( $cookie_token && $cookie_flow === $form_type );
7938 $editor_preview = ( $enabled && $this->in_editor && ! empty( $this->ds['otp_preview'] ) && 'yes' === $this->ds['otp_preview'] && $this->eael_otp_active_flow() === $form_type );
7939 $visible = ( $auto_show || $editor_preview );
7940
7941 // Compute the remaining resend cooldown server-side from the OTP transient so the
7942 // countdown survives page reloads. The transient (eael_lr_otp_<token>) is the canonical
7943 // store and is deleted on verify-success or on expiry, so we don't need any usermeta.
7944 $initial_remaining_cooldown = 0;
7945 if ( $cookie_token ) {
7946 // Hardcoded prefix mirrors Login_Registration::$otp_transient_prefix to avoid pulling
7947 // the trait into the widget class.
7948 $session = get_transient( 'eael_lr_otp_' . $cookie_token );
7949 if ( is_array( $session ) && ! empty( $session['last_sent'] ) && ! empty( $session['cooldown'] ) ) {
7950 $elapsed = time() - (int) $session['last_sent'];
7951 $initial_remaining_cooldown = max( 0, (int) $session['cooldown'] - $elapsed );
7952 }
7953 }
7954 ?>
7955 <div class="eael-lr-otp-wrapper<?php echo $visible ? '' : ' eael-d-none'; ?><?php echo $editor_preview ? ' eael-lr-otp-editor-preview' : ''; ?>"
7956 data-remaining-cooldown="<?php echo esc_attr( $initial_remaining_cooldown ); ?>"
7957 data-flow="<?php echo esc_attr( $form_type ); ?>"
7958 data-widget-id="<?php echo esc_attr( $widget_id ); ?>"
7959 data-cooldown="<?php echo esc_attr( $cooldown ); ?>"
7960 data-otp-nonce="<?php echo esc_attr( wp_create_nonce( 'eael_lr_otp' ) ); ?>"
7961 data-ajax-url="<?php echo esc_url( admin_url( 'admin-ajax.php' ) ); ?>">
7962 <h3 class="eael-lr-otp-title"><?php echo esc_html( $title ); ?></h3>
7963 <p class="eael-lr-otp-subtitle"><?php echo esc_html( $subtitle ); ?></p>
7964 <input type="hidden" class="eael-lr-otp-token" value="<?php echo esc_attr( $cookie_token ); ?>">
7965 <div class="eael-lr-otp-input-row">
7966 <input type="text"
7967 inputmode="numeric"
7968 autocomplete="one-time-code"
7969 maxlength="6"
7970 pattern="[0-9]{6}"
7971 class="eael-lr-otp-input"
7972 placeholder="------">
7973 </div>
7974 <button type="button" class="eael-lr-otp-verify-btn eael-lr-btn eael-lr-btn-block">
7975 <?php echo esc_html( $verify_text ); ?>
7976 </button>
7977 <div class="eael-lr-otp-resend-row">
7978 <a href="#" class="eael-lr-otp-resend"><?php echo esc_html( $resend_text ); ?></a>
7979 <span class="eael-lr-otp-cooldown-text"></span>
7980 </div>
7981 <div class="eael-lr-otp-message" aria-live="polite"></div>
7982 </div>
7983 <?php
7984 // Note: the auto-show cookie is short-lived (its lifetime equals the OTP expiry) and is also
7985 // cleared client-side by the OTP JS once the UI is shown, so a refresh after success won't replay it.
7986 }
7987
7988 protected function print_necessary_hidden_fields( $form_type = 'login' ) {
7989 if ( 'login' === $form_type ) {
7990 if ( ! empty( $this->ds['redirect_after_login'] ) && 'yes' === $this->ds['redirect_after_login'] ) {
7991 ?>
7992 <input type="hidden"
7993 name="redirect_to"
7994 value="<?php echo esc_attr( $this->login_custom_redirect_url ); ?>">
7995 <?php }
7996
7997 if ( ! empty( $this->ds['redirect_based_on_roles'] ) && 'yes' === $this->ds['redirect_based_on_roles'] ) {
7998 $user_roles = $this->eael_get_role_names();
7999
8000 if( ! empty( $user_roles ) && is_array( $user_roles ) && count( $user_roles ) ){
8001 foreach( $user_roles as $user_role_key => $user_role_value ){
8002 $login_redirect_url = ! empty( $this->ds['redirect_url_' . esc_html( $user_role_key ) ]['url'] ) ? esc_url( $this->ds['redirect_url_' . esc_html( $user_role_key )]['url'] ) : '';
8003 ?>
8004 <input type="hidden"
8005 name="redirect_to_<?php echo esc_html( $user_role_key ); ?>"
8006 value="<?php echo esc_attr( $login_redirect_url ); ?>">
8007 <?php
8008 }
8009 }
8010 }
8011
8012 if ( ! empty( $this->ds['login_redirect_url_prev_page'] ) && 'yes' === $this->ds['login_redirect_url_prev_page'] ) {
8013 $login_redirect_url_prev_page = ! empty( $_SERVER['HTTP_REFERER'] ) ? esc_url_raw( $_SERVER['HTTP_REFERER'] ) : ''; //phpcs:ignore WordPress.Security.ValidatedSanitizedInput.MissingUnslash
8014 ?>
8015 <input type="hidden"
8016 name="redirect_to_prev_page_login"
8017 value="<?php echo esc_attr( $login_redirect_url_prev_page ); ?>">
8018 <?php }
8019 }
8020
8021 if ( 'register' === $form_type ) {
8022 if ( ! empty( $this->ds['register_redirect_url_prev_page'] ) && 'yes' === $this->ds['register_redirect_url_prev_page'] ) {
8023 $register_redirect_url_prev_page = ! empty( $_SERVER['HTTP_REFERER'] ) ? esc_url_raw( $_SERVER['HTTP_REFERER'] ) : ''; //phpcs:ignore WordPress.Security.ValidatedSanitizedInput.MissingUnslash
8024 ?>
8025 <input type="hidden"
8026 name="redirect_to_prev_page"
8027 value="<?php echo esc_attr( $register_redirect_url_prev_page ); ?>">
8028 <?php }
8029 }
8030
8031 if ( 'resetpassword' === $form_type ) {
8032 if ( ! empty( $this->ds['redirect_after_resetpassword'] ) && 'yes' === $this->ds['redirect_after_resetpassword'] ) {
8033 $resetpassword_redirect_url = ! empty( $this->ds['redirect_url_resetpassword']['url'] ) ? esc_url( $this->ds['redirect_url_resetpassword']['url'] ) : '';
8034 ?>
8035 <input type="hidden"
8036 name="resetpassword_redirect_to"
8037 value="<?php echo esc_attr( $resetpassword_redirect_url ); ?>">
8038 <?php }
8039 }
8040
8041 // add login security nonce
8042 wp_nonce_field( "eael-{$form_type}-action", "eael-{$form_type}-nonce" );
8043 ?>
8044 <input type="hidden"
8045 name="page_id"
8046 value="<?php echo esc_attr( $this->page_id ); ?>">
8047 <input type="hidden"
8048 name="page_id_for_popup"
8049 value="<?php echo esc_attr( ! empty( $this->page_id_for_popup ) ? $this->page_id_for_popup : $this->page_id ); ?>">
8050 <input type="hidden"
8051 name="resetpassword_in_popup_selector"
8052 value="<?php echo esc_attr( ! empty( $this->resetpassword_in_popup_selector ) ? $this->resetpassword_in_popup_selector : '' ); ?>">
8053 <input type="hidden"
8054 name="widget_id"
8055 value="<?php echo esc_attr( $this->get_id() ); ?>">
8056 <?php
8057 }
8058
8059 protected function print_terms_condition_notice() {
8060 if ( empty( $this->ds['show_terms_conditions'] ) || 'yes' !== $this->ds['show_terms_conditions'] ) {
8061 return;
8062 }
8063 $l = isset( $this->ds['acceptance_label'] ) ? HelperCLass::eael_wp_kses($this->ds['acceptance_label']) : '';
8064 $parts = explode( "\n", $l );
8065 $label = array_shift( $parts );
8066 $link_text = array_pop( $parts );
8067 $source = isset( $this->ds['acceptance_text_source'] ) ? $this->ds['acceptance_text_source'] : 'editor';
8068 $tc_text = isset( $this->ds['acceptance_text'] ) ? $this->ds['acceptance_text'] : '';
8069 $tc_link = '<a href="#" id="eael-lr-tnc-link" class="eael-lr-tnc-link">' . esc_html( $link_text ) . '</a>';
8070 if ( 'custom' === $source ) {
8071 $tc_url = ! empty( $this->ds['acceptance_text_url']['url'] ) ? esc_url( $this->ds['acceptance_text_url']['url'] ) : esc_url( get_the_permalink( get_option( 'wp_page_for_privacy_policy' ) ) );
8072 $tc_atts = ! empty( $this->ds['acceptance_text_url']['is_external'] ) ? ' target="_blank"' : '';
8073 $tc_atts .= ! empty( $this->ds['acceptance_text_url']['nofollow'] ) ? ' rel="nofollow"' : '';
8074 $tc_link = sprintf( '<a href="%1$s" id="eael-lr-tnc-link" class="eael-lr-tnc-link" %2$s>%3$s</a>', esc_url( $tc_url ), $tc_atts, $link_text );
8075 }
8076 $lrtoggle = ! empty( $this->ds['eael_terms_conditions_field_type'] ) && 'toggle' === $this->ds['eael_terms_conditions_field_type'] ? 'lr-toggle' : '';
8077 ?>
8078 <div class="eael_accept_tnc_wrap">
8079 <input type="hidden"
8080 name="eael_tnc_active"
8081 value="1">
8082 <input type="checkbox"
8083 name="eael_accept_tnc"
8084 class="eael_accept_tnc <?php echo esc_attr($lrtoggle); ?>"
8085 value="1"
8086 id="eael_accept_tnc">
8087 <label for="eael_accept_tnc"
8088 class="eael-checkbox-label check-accept">
8089 <?php
8090 echo esc_html( $label );
8091 ?>
8092 </label>
8093 <?php
8094 echo wp_kses( $tc_link, HelperCLass::eael_allowed_tags( [ 'a' => [ 'data-action' => [] ] ] ) );
8095 ?>
8096 </div>
8097
8098 <?php
8099 $tc = '<div class="eael-lr-tnc-wrap">';
8100 $tc .= $this->parse_text_editor( wp_kses( $tc_text, HelperCLass::eael_allowed_tags() ) );
8101 $tc .= '</div>';
8102 echo wp_kses( $tc, HelperCLass::eael_allowed_tags() );
8103
8104
8105 }
8106
8107 protected function print_login_validation_errors() {
8108 $resetpassword_success_key = 'eael_resetpassword_success_' . $this->get_id();
8109 $resetpassword_success = apply_filters( 'eael/login-register/resetpassword-success-message', json_decode( get_option( $resetpassword_success_key ) ) );
8110
8111 if ( ! empty( $resetpassword_success ) && 'register' !== $this->ds['default_form_type'] ) {
8112 $this->print_resetpassword_success_message( $resetpassword_success );
8113 }
8114 }
8115
8116 protected function print_lostpassword_validation_errors() {
8117 $error_key = 'eael_lostpassword_error_' . esc_attr( $this->get_id() );
8118 $error_key_show = $error_key . '_show';
8119
8120 $success_key = 'eael_lostpassword_success_' . esc_attr( $this->get_id() );
8121
8122 if ( intval( get_option( $error_key_show ) ) ) {
8123 $rp_err_msg = isset( $this->ds['err_reset_password_key_expired'] ) ? esc_html( $this->ds['err_reset_password_key_expired'] ) : esc_html__( 'Hey Your password reset link appears to be invalid. Please request a new link.', 'essential-addons-for-elementor-lite' );
8124 ?>
8125 <p class="eael-form-msg invalid">
8126 <?php echo esc_html( $rp_err_msg ); ?>
8127 </p>
8128 <?php
8129 delete_option( $error_key_show );
8130 }
8131
8132 if ( $lostpassword_error = apply_filters( 'eael/login-register/lostpassword-error-message', get_option( $error_key ) ) ) {
8133 do_action( 'eael/login-register/before-showing-lostpassword-error', $lostpassword_error, $this );
8134 ?>
8135 <p class="eael-form-msg invalid">
8136 <?php echo wp_kses( $lostpassword_error, HelperCLass::eael_allowed_tags() ); ?>
8137 </p>
8138 <?php
8139 do_action( 'eael/login-register/after-showing-login-error', $lostpassword_error, $this );
8140
8141 delete_option( $error_key );
8142 }
8143
8144 if ( $lostpassword_success = apply_filters( 'eael/login-register/lostpassword-success-message', get_option( $success_key ) ) ) {
8145 do_action( 'eael/login-register/before-showing-lostpassword-success', $lostpassword_success, $this );
8146 ?>
8147 <p class="eael-form-msg valid">
8148 <?php echo esc_html( $lostpassword_success ); ?>
8149 </p>
8150 <?php
8151 do_action( 'eael/login-register/after-showing-login-success', $lostpassword_success, $this );
8152
8153 delete_option( $success_key );
8154 }
8155 }
8156
8157 protected function print_resetpassword_validation_errors() {
8158 $error_key = 'eael_resetpassword_error_' . $this->get_id();
8159
8160 if ( $resetpassword_error = apply_filters( 'eael/login-register/resetpassword-error-message', json_decode( get_option( $error_key ), true ) ) ) {
8161 do_action( 'eael/login-register/before-showing-resetpassword-error', $resetpassword_error, $this );
8162 ?>
8163 <div class="eael-form-msg invalid">
8164 <?php
8165 if( is_array( $resetpassword_error ) ) {
8166 if( count( $resetpassword_error ) ){
8167 echo "<ol>";
8168 foreach( $resetpassword_error as $error ) {
8169 echo "<li>" . esc_html( $error ) . "</li>";
8170 }
8171 echo "</ol>";
8172 }
8173 } else {
8174 echo esc_html( $resetpassword_error );
8175 }
8176 ?>
8177 </div>
8178 <?php
8179 do_action( 'eael/login-register/after-showing-login-error', $resetpassword_error, $this );
8180
8181 delete_option( $error_key );
8182 }
8183
8184 $success_key = 'eael_resetpassword_success_' . esc_attr( $this->get_id() );
8185 $resetpassword_success = apply_filters( 'eael/login-register/resetpassword-success-message', json_decode( get_option( $success_key ) ) );
8186 if ( ! empty( $resetpassword_success ) ) {
8187 $this->print_resetpassword_success_message( $resetpassword_success );
8188 }
8189 }
8190
8191 protected function print_bot_protection_node( $form_type = 'login' ) {
8192 if ( 'yes' === $this->get_settings_for_display( "enable_{$form_type}_recaptcha" ) || 'v3' === $this->ds["login_register_recaptcha_version"] ) {
8193 $id = "{$form_type}-recaptcha-node-" . esc_attr( $this->get_id() );
8194 echo "<input type='hidden' name='g-recaptcha-enabled' value='1'/><div id='" . esc_attr( $id ) . "' class='eael-recaptcha-wrapper'></div>";
8195
8196 if( 'v3' === $this->ds["login_register_recaptcha_version"] && ( ! $this->ds[ 'enable_ajax' ] ) ){
8197 echo "<input type='hidden' name='action' value='eael_login_register_form'/>";
8198 }
8199 }
8200
8201 if ( ! empty( $this->cloudflare_turnstile_sitekey ) && 'yes' === $this->get_settings_for_display( "enable_cloudflare_turnstile" ) && ( 'yes' === $this->get_settings_for_display( "enable_cloudflare_turnstile_on_{$form_type}" ) ) ) {
8202 $id = "eael-{$form_type}-cloudflare-turnstile-" . esc_attr( $this->get_id() );
8203 wp_enqueue_script( 'eael-cloudflare' );
8204 echo "<div class='cf-turnstile' data-theme='" . esc_attr( $this->ds['cloudflare_turnstile_theme'] ) . "' data-sitekey='" . esc_attr( $this->cloudflare_turnstile_sitekey ) . "'></div>";
8205 }
8206 }
8207
8208 protected function print_error_for_repeated_fields( $repeated_fields ) {
8209 if ( ! empty( $repeated_fields ) ) {
8210 $error_fields = '<strong>' . implode( "</strong>, <strong>", $repeated_fields ) . '</strong>';
8211 ?>
8212 <p class='eael-register-form-error elementor-alert elementor-alert-warning'>
8213 <?php
8214 /* translators: %s: Error fields */
8215 $error_msg = sprintf( __( 'Error! you seem to have added %s field in the form more than once.', 'essential-addons-for-elementor-lite' ), $error_fields );
8216 echo wp_kses( $error_msg, HelperCLass::eael_allowed_tags() );
8217 ?>
8218 </p>
8219 <?php
8220 return true;
8221 }
8222
8223 return false;
8224 }
8225
8226 protected function print_error_for_missing_email_field( $email_exist ) {
8227 if ( empty( $email_exist ) ) {
8228 ?>
8229 <p class='eael-register-form-error elementor-alert elementor-alert-warning'>
8230 <?php
8231 // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
8232 printf(
8233 /* translators: %s: Error String */
8234 esc_html__( 'Error! It is required to use %s field.', 'essential-addons-for-elementor-lite' ),
8235 '<strong>Email</strong>'
8236 );
8237 ?>
8238
8239 </p>
8240 <?php
8241 return true;
8242 }
8243
8244 return false;
8245 }
8246
8247 /**
8248 * It shows error if Confirm Password Field is used without using Password Field.
8249 *
8250 * @param $password_exist
8251 * @param $confirm_pass_exist
8252 *
8253 * @return bool
8254 */
8255 protected function print_error_for_missing_password_field( $password_exist, $confirm_pass_exist ) {
8256 if ( empty( $password_exist ) && ! empty( $confirm_pass_exist ) ) {
8257 ?>
8258 <p class='eael-register-form-error elementor-alert elementor-alert-warning'>
8259 <?php
8260 // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
8261 printf(
8262 /* translators: 1: Password fßield label, 2: Password Confirmation field label. */
8263 esc_html__( 'Error! It is required to use %1$s field with %2$s Field.', 'essential-addons-for-elementor-lite' ),
8264 '<strong>Password</strong>',
8265 '<strong>Password Confirmation</strong>'
8266 );
8267 ?>
8268 </p>
8269 <?php
8270 return true;
8271 }
8272
8273 return false;
8274 }
8275
8276 protected function print_validation_message() {
8277 $errors = get_option( 'eael_register_errors_' . $this->get_id() );
8278 $success = get_option( 'eael_register_success_' . $this->get_id() );
8279 $resetpassword_success_key = 'eael_resetpassword_success_' . $this->get_id();
8280 $resetpassword_success = apply_filters( 'eael/login-register/resetpassword-success-message', get_option( $resetpassword_success_key ) );
8281
8282 if ( empty( $errors ) && empty( $success ) && empty( $resetpassword_success ) ) {
8283 return;
8284 }
8285 if ( ! empty( $errors ) && is_array( $errors ) ) {
8286 $this->print_registration_errors_message( $errors );
8287 } else if( ! empty ( $success ) ) {
8288 $this->print_registration_success_message( $success );
8289 } else if( !empty( $resetpassword_success ) && 'register' === $this->ds['default_form_type'] ){
8290 $this->print_resetpassword_success_message( $resetpassword_success );
8291 }
8292 }
8293
8294 protected function print_registration_errors_message( $errors ) {
8295 ?>
8296 <div class="eael-form-msg invalid">
8297 <?php
8298 if ( ! empty( $this->ds['err_unknown'] ) ) {
8299 // printf( '<p>%s</p>', esc_html( $this->ds['err_unknown'] ) );
8300 }
8301 ?>
8302 <ol>
8303 <?php
8304 foreach ( $errors as $register_error ) {
8305 printf( '<li>%s</li>', esc_html( $register_error ) );
8306 }
8307 ?>
8308 </ol>
8309 </div>
8310 <?php
8311 delete_option( 'eael_register_errors_' . $this->get_id() );
8312 }
8313
8314 protected function print_registration_success_message( $success ) {
8315
8316 if ( $success ) {
8317 $message = '<p class="eael-form-msg valid">' . esc_html( $this->get_settings_for_display( 'success_register' ) ) . '</p>';
8318 // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
8319 echo apply_filters( 'eael/login-register/registration-success-msg', $message, $success );
8320
8321 delete_option( 'eael_register_success_' . $this->get_id() );
8322
8323 return true; // it will help in case we wanna know if error is printed.
8324 }
8325
8326 return false;
8327 }
8328
8329 protected function print_resetpassword_success_message( $resetpassword_success ) {
8330 $resetpassword_success_key = 'eael_resetpassword_success_' . $this->get_id();
8331
8332 do_action( 'eael/login-register/before-showing-resetpassword-success', $resetpassword_success, $this );
8333 ?>
8334 <div class="eael-form-msg valid">
8335 <?php
8336 echo esc_html( $resetpassword_success );
8337 ?>
8338 </div>
8339 <?php
8340 do_action( 'eael/login-register/after-showing-resetpassword-success', $resetpassword_success, $this );
8341
8342 delete_option( $resetpassword_success_key );
8343 }
8344
8345 /**
8346 * It will apply value like Elementor's dimension control to a property and return it.
8347 *
8348 * @param string $css_property CSS property name
8349 *
8350 * @return string
8351 */
8352 public function apply_dim( $css_property ) {
8353 return "{$css_property}: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};";
8354 }
8355
8356 }
8357