PluginProbe
Loginizer / 1.8.3
Loginizer v1.8.3
2.1.0 2.0.9 2.0.8 1.9.8 1.9.9 2.0.0 2.0.1 2.0.2 2.0.3 2.0.4 2.0.5 2.0.6 2.0.7 trunk 1.0 1.0.1 1.0.2 1.1.0 1.1.1 1.2.0 1.3.0 1.3.1 1.3.2 1.3.3 1.3.4 All 74 releases
loginizer / main / settings / passwordless.php

passwordless.php in Loginizer 1.8.3, at main/settings/passwordless.php

199 lines 7.6 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 if(!defined('ABSPATH')){
4 die('Hacking Attempt!');
5 }
6
7 // Loginizer - PasswordLess Page
8 function loginizer_page_passwordless(){
9
10 global $loginizer, $lz_error, $lz_env;
11
12 if(!current_user_can('manage_options')){
13 wp_die('Sorry, but you do not have permissions to change settings.');
14 }
15
16 if(!loginizer_is_premium() && count($_POST) > 0){
17 $lz_error['not_in_free'] = __('This feature is not available in the Free version. <a href="'.LOGINIZER_PRICING_URL.'" target="_blank" style="text-decoration:none; color:green;"><b>Upgrade to Pro</b></a>', 'loginizer');
18 return loginizer_page_passwordless_T();
19 }
20
21 /* Make sure post was from this page */
22 if(count($_POST) > 0){
23 check_admin_referer('loginizer-options');
24 }
25
26 if(isset($_POST['save_lz'])){
27
28 // In the future there can be more settings
29 $option['email_pass_less'] = (int) lz_optpost('email_pass_less');
30 $option['passwordless_sub'] = @stripslashes($_POST['lz_passwordless_sub']);
31 $option['passwordless_msg'] = @stripslashes($_POST['lz_passwordless_msg']);
32 $option['passwordless_html'] = (int) lz_optpost('lz_passwordless_html');
33 $option['passwordless_redirect'] = esc_url_raw($_POST['lz_passwordless_redirect']);
34 $option['passwordless_redirect_for'] = map_deep($_POST['lz_passwordless_redirect_for'], 'sanitize_text_field');
35
36 // Is there an error ?
37 if(!empty($lz_error)){
38 return loginizer_page_passwordless_T();
39 }
40
41 // Save the options
42 update_option('loginizer_epl', $option);
43
44 // Mark as saved
45 $GLOBALS['lz_saved'] = true;
46
47 }
48
49 // Call theme
50 loginizer_page_passwordless_T();
51 }
52
53 // Loginizer - PasswordLess Page Theme
54 function loginizer_page_passwordless_T(){
55
56 global $loginizer, $lz_error, $lz_env;
57
58 $lz_options = get_option('loginizer_epl');
59
60 // Universal header
61 loginizer_page_header('PasswordLess Settings');
62
63 loginizer_feature_available('PasswordLess Login');
64
65 // Saved ?
66 if(!empty($GLOBALS['lz_saved'])){
67 echo '<div id="message" class="updated"><p>'. __('The settings were saved successfully', 'loginizer'). '</p></div><br />';
68 }
69
70 // Any errors ?
71 if(!empty($lz_error)){
72 lz_report_error($lz_error);echo '<br />';
73 }
74
75 ?>
76
77 <style>
78 input[type="text"], textarea, select {
79 width: 90%;
80 }
81
82 .form-table label{
83 font-weight:bold;
84 }
85
86 .form-table td{
87 vertical-align:top;
88 }
89
90 .exp{
91 font-size:12px;
92 }
93 </style>
94
95 <div id="" class="postbox">
96
97 <div class="postbox-header">
98 <h2 class="hndle ui-sortable-handle">
99 <span><?php echo __('PasswordLess Settings', 'loginizer'); ?></span>
100 </h2>
101 </div>
102
103 <div class="inside">
104
105 <form action="" method="post" enctype="multipart/form-data" loginizer-premium-only="1">
106 <?php wp_nonce_field('loginizer-options'); ?>
107 <table class="form-table">
108 <tr>
109 <td scope="row" valign="top" style="width:350px !important"><label for="email_pass_less"><?php echo __('Enable PasswordLess Login', 'loginizer'); ?></label></td>
110 <td>
111 <input type="checkbox" value="1" name="email_pass_less" id="email_pass_less" <?php echo lz_POSTchecked('email_pass_less', (empty($loginizer['email_pass_less']) ? false : true)); echo (defined('SITEPAD') ? 'disabled="disabled"' : '') ?> />
112 </td>
113 </tr>
114 <tr>
115 <td colspan="2" valign="top">
116 <?php echo __('If enabled, the login screen will just ask for the username <b>OR</b> email address of the user. If such a user exists, an email with a <b>One Time Login </b> link will be sent to the email address of the user. The link will be valid for 10 minutes only.', 'loginizer'); ?><br><br>
117 <?php echo __('If a wrong username/email is given, the brute force checker will prevent any brute force attempt !', 'loginizer'); ?>
118 </td>
119 </tr>
120 <tr>
121 <td scope="row" valign="top">
122 <label for="lz_passwordless_sub"><?php echo __('Email Subject', 'loginizer'); ?></label><br>
123 <span class="exp"><?php echo __('Set blank to reset to the default subject', 'loginizer'); ?></span>
124 <br />Default : <?php echo @$loginizer['pl_d_sub']; ?>
125 </td>
126 <td valign="top">
127 <input type="text" size="40" value="<?php echo lz_htmlizer(!empty($_POST['lz_passwordless_sub']) ? stripslashes($_POST['lz_passwordless_sub']) : (empty($lz_options['passwordless_sub']) ? '' : $lz_options['passwordless_sub'])); ?>" name="lz_passwordless_sub" id="lz_passwordless_sub" />
128 </td>
129 </tr>
130 <tr>
131 <td scope="row" valign="top">
132 <label for="lz_passwordless_msg"><?php echo __('Email Body', 'loginizer'); ?></label><br>
133 <span class="exp"><?php echo __('Set blank to reset to the default message', 'loginizer'); ?></span>
134 <br />Default : <pre style="font-size:10px"><?php echo @$loginizer['pl_d_msg']; ?></pre>
135 </td>
136 <td valign="top">
137 <textarea rows="10" name="lz_passwordless_msg" id="lz_passwordless_msg"><?php echo lz_htmlizer(!empty($_POST['lz_passwordless_msg']) ? stripslashes($_POST['lz_passwordless_msg']) : (empty($lz_options['passwordless_msg']) ? '' : $lz_options['passwordless_msg'])); ?></textarea>
138 <br />
139 Variables :
140 <br />$email - Users Email
141 <br />$site_name - The Site Name
142 <br />$site_url - The Site URL
143 <br />$login_url - The Login URL
144 </td>
145 </tr>
146 <tr>
147 <td scope="row" valign="top"><label for="lz_passwordless_html"><?php echo __('Send email as HTML', 'loginizer'); ?></label></td>
148 <td>
149 <input type="checkbox" value="1" name="lz_passwordless_html" id="lz_passwordless_html" <?php echo lz_POSTchecked('lz_passwordless_html', (empty($loginizer['passwordless_html']) ? false : true)); ?> />
150 </td>
151 </tr>
152 <tr>
153 <td scope="row" valign="top" style="width:350px !important">
154 <label for="lz_passwordless_redirect"><?php echo __('Custom redirect to', 'loginizer'); ?></label><br/>
155 <span class="exp"><?php echo __('Redirects user to a page of your website other than the admin panel', 'loginizer'); ?></span>
156 </td>
157 <td align="top">
158 <input type="text" size="40" value="<?php echo lz_htmlizer(!empty($_POST['lz_passwordless_redirect']) ? stripslashes($_POST['lz_passwordless_redirect']) : (empty($lz_options['passwordless_redirect']) ? '' : $lz_options['passwordless_redirect'])); ?>" name="lz_passwordless_redirect" id="lz_passwordless_redirect" />
159 </td>
160 </tr>
161
162 <tr>
163 <td scope="row" valign="top" style="width:350px !important">
164 <label for="lz_passwordless_redirect_for"><?php echo __('Custom redirect for', 'loginizer'); ?></label><br/>
165 <span class="exp"><?php echo __('Select the user roles for whom this custom redirect will be used', 'loginizer'); ?></span>
166 </td>
167 <td align="top">
168 <?php
169 $editable_roles = get_editable_roles();
170 echo '<div style="max-height:120px; overflow:auto;">';
171 $r = '';
172 foreach($editable_roles as $role => $details) {
173 $name = translate_user_role( $details['name'] );
174 // Preselect specified role.
175 if(!empty($lz_options['passwordless_redirect_for']) && in_array($role, $lz_options['passwordless_redirect_for'])) {
176 $r .= "\n\t<input type=\"checkbox\" checked name=\"lz_passwordless_redirect_for[]\" value='" . esc_attr($role) . "' style=\"margin-top:5px\">$name</option>";
177 } else {
178 $r .= "\n\t<input type=\"checkbox\" value='" . esc_attr($role) . "' name=\"lz_passwordless_redirect_for[]\">$name</option>";
179 }
180
181 $r .= '<br/>';
182 }
183 echo $r . '</div>';
184 ?>
185 </td>
186 </tr>
187
188 </table><br />
189 <center><input name="save_lz" class="button button-primary action" value="<?php echo __('Save Settings', 'loginizer'); ?>" type="submit" /></center>
190 </form>
191
192 </div>
193 </div>
194 <br />
195
196 <?php
197 loginizer_page_footer();
198
199 }