PluginProbe ʕ •ᴥ•ʔ
Firebase Authentication / 1.6.2
Firebase Authentication v1.6.2
1.7.0 trunk 1.0.0 1.1.1 1.1.2 1.1.3 1.1.4 1.2.0 1.3.0 1.3.1 1.3.2 1.3.3 1.3.4 1.3.5 1.3.6 1.3.7 1.4.0 1.4.1 1.4.2 1.4.3 1.4.4 1.4.5 1.4.6 1.4.8 1.5.0 1.5.1 1.5.2 1.5.3 1.5.4 1.5.5 1.5.6 1.5.7 1.5.8 1.5.9 1.6.0 1.6.1 1.6.2 1.6.3 1.6.4 1.6.5 1.6.6 1.6.7 1.6.8 1.6.9
firebase-authentication / admin / partials / config / class-mo-firebase-authentication-admin-config.php
firebase-authentication / admin / partials / config Last commit date
class-mo-firebase-authentication-admin-advsettings.php 3 years ago class-mo-firebase-authentication-admin-config.php 3 years ago class-mo-firebase-authentication-admin-licensing-plans.php 3 years ago class-mo-firebase-authentication-admin-loginsettings.php 3 years ago
class-mo-firebase-authentication-admin-config.php
193 lines
1 <?php
2 /**
3 * Firebase Authentication Config
4 *
5 * @package firebase-authentication
6 */
7
8 /**
9 * Initial configuration screen handler
10 */
11 class Mo_Firebase_Authentication_Admin_Config {
12
13 /**
14 * Display basic configuration
15 *
16 * @return void
17 */
18 public static function mo_firebase_authentication_config() {
19 ?>
20 <!-- <div id="mo_firebase_authentication_support_layout" class="mo_firebase_authentication_support_layout"> -->
21 <div class="row">
22 <div class="col-md-12" >
23 <div>
24 <div class="mo_table_layout" style="padding-top: 0px;">
25 <form action="" method="post" id="mo_enable_firebase_auth_form">
26 <?php wp_nonce_field( 'mo_firebase_auth_enable_form', 'mo_firebase_auth_enable_field' ); ?>
27 <!-- <div style="display:inline"><div style="display:inline-block;padding:0px 10px 10px 0px"><strong>Enable Firebase Authentication:</strong></div> -->
28 <div style="display:inline-block; margin-top: 0"><label class="mo_firebase_auth_switch">
29 <input value="1" name="mo_enable_firebase_auth" type="checkbox" id="mo_enable_firebase_auth" <?php echo esc_attr( get_option( 'mo_enable_firebase_auth' ) ) ? 'checked' : ''; ?>>
30 <span class="mo_firebase_auth_slider round"></span>
31 <input type="hidden" name="option" value="mo_enable_firebase_auth">
32 </label>
33 </div>
34 <div style="display:inline"><div style="display:inline-block;padding:0px 10px 10px 0px"><h3>Enable Firebase Authentication</h3></div>
35 <span style="float: right; font-size: 14px; margin-top: 10px;">
36 <a href="https://plugins.miniorange.com/login-into-wordpress-using-firebase-authentication" target="_blank" rel="noopener" class="mo_firebase_setup_guide_style" style="text-decoration: none;"> How to configure?</a></span>
37 </div>
38 </form>
39 <form action="" method="post" id="mo_firebase_auth_form" style="margin-top: 0px;">
40 <?php wp_nonce_field( 'mo_firebase_auth_config_form', 'mo_firebase_auth_config_field' ); ?>
41 <table class="mo_settings_table">
42 <tr><td colspan="2"><strong style="padding-left: 0px; ">Allow users to login with :</strong>
43 </td></tr>
44 <tr><td>
45 <input style="margin-left: 5px;"type="radio" name="disable_wordpress_login" id="enable_wordpress_login"
46 <?php
47 if ( false === get_option( 'mo_enable_firebase_auth' ) ) {
48 echo '';
49 } else {
50 echo esc_attr( get_option( 'mo_firebase_auth_disable_wordpress_login' ) ) ? '' : 'checked';}
51 ?>
52 value="0"onclick="mo_firebase_auth_hideDiv();">Both Firebase and WordPress
53 </td><td>
54 <input type="radio" name="disable_wordpress_login" id="disable_wordpress_login"
55 <?php
56 if ( false === get_option( 'mo_enable_firebase_auth' ) ) {
57 echo '';
58 } else {
59 echo esc_attr( get_option( 'mo_firebase_auth_disable_wordpress_login' ) ) ? 'checked' : '';}
60 ?>
61 value="1"onclick="mo_firebase_auth_showDiv();">Only Firebase</td></tr>
62 <tr><td colspan="2">
63 <div style="padding:5px;"></div>
64 <div style="
65 <?php
66 if ( 1 === (int) get_option( 'mo_firebase_auth_disable_wordpress_login' ) ) {
67 echo 'display: block';
68 } else {
69 echo 'display: none';
70 }
71 ?>
72 "id="mo_firebase_auth_enable_admin_wp_login_div">
73 <p>Enabling Firebase login will restrict logins with only Firebase credentials and won't allow WP login. <b>Please enable this only after you have successfully tested your configuration</b> as the default WordPress login will stop working.
74 </p><div style="margin-bottom: 15px;">
75 <input type="checkbox" id="mo_firebase_auth_enable_admin_wp_login" name="mo_firebase_auth_enable_admin_wp_login" value="1"
76 <?php
77 if ( get_option( 'mo_firebase_auth_enable_admin_wp_login' ) ) {
78 echo 'checked'; }
79 ?>
80 /> Allow Administrators to use WordPress login<div class="mo-firebase-auth-tooltip">&#x1F6C8;<div class="mo-firebase-auth-tooltip-text mo-tt-right">Selecting this option will only allow WordPress Administrators to log in.</div> </div></div>
81 </div></td></tr>
82 </table>
83 <div style="margin-top: 10px;">
84 <font color="#FF0000">*</font><strong>Project Id</strong><div class="mo-firebase-auth-tooltip">&#x1F6C8;<div class="mo-firebase-auth-tooltip-text mo-tt-right">collect project Id from your firebase project</div> </div></div><div style="margin-top: 10px;">
85 <input type="text" id="project_id" name="projectid" value= "<?php echo esc_attr( get_option( 'mo_firebase_auth_project_id' ) ); ?>" placeholder="Enter Project Id.." required="" style = "width:50%; font-size: 14px;"></div><br>
86 <font color="#FF0000">*</font><strong>API Key</strong><div class="mo-firebase-auth-tooltip">&#x1F6C8;<div class="mo-firebase-auth-tooltip-text mo-tt-right">collect API key from your firebase project</div> </div><br>
87 <input style = "width:50%; font-size: 14px;" type="password" id="api_key" name="apikey" value="<?php echo esc_attr( get_option( 'mo_firebase_auth_api_key' ) ); ?>" placeholder="Enter your API Key.." required="">
88 <i class="fa fa-eye" id="show_button" onclick="passwordShowButton('api_key', this.id)" style="margin-left: -30px; cursor: pointer; "></i>
89 <br><br>
90 <input type="submit" class="button button-primary button-large" style="margin-top: 10px; width:140px;" name="verify_user" value=" Save Configuration" id = "mo_auth_configure_button">
91 </form>
92 </div>
93 </div>
94 <div>
95 <div class="mo_table_layout" id ="test_authentication" style="width:100%" >
96 <h3 style="margin: 0px;">Test Authentication</h3>
97 <form name="test_configuration_form" id="mo_firebasetestconfig" method="post" target="firebasetestconfig" style="margin-top: 0px;">
98 <?php wp_nonce_field( 'mo_firebase_auth_test_config_form', 'mo_firebase_auth_test_config_field' ); ?>
99 <input type="hidden" name="option" value="mo_firebase_auth_test_configuration">
100 <table class="mo_settings_table" >
101 <tr><td>
102 <font color="#FF0000">* </font><strong>Username</strong></td><td><input type="text" id="test_username" name="test_username" value="" placeholder="Username" required="" class="mo_table_short_textbox" style="width:40%;"></td></tr> <tr><td></td></tr><tr><td>
103 <font color="#FF0000">* </font><strong>Password</strong></td><td><input type="password" id="test_password" name="test_password" value="" placeholder="Password" required="" class="mo_table_short_textbox" style="width:40%;" autocomplete="on">
104 <i class="fa fa-eye" id="show_button1" onclick="passwordShowButton('test_password', this.id)" style="margin-left: -30px; cursor: pointer; "></i>
105 </td></tr><br></table>
106 <input type="hidden" id="test_check_field" name="test_check_field" value="test_check_true">
107 <br>
108 <input type="submit" id="mo_firebase_auth_test_config_button" name="test_configuration" value="Test Authentication"
109 <?php
110 if ( ! get_option( 'mo_firebase_auth_project_id' ) && ! get_option( 'mo_firebase_auth_api_key' ) ) {
111 echo 'disabled class="btn btn-primary" style="font-size: 14px; font-weight: 400;"';
112 } else {
113 echo 'class="button button-primary button-large"';}
114 ?>
115 >
116 </form>
117 </div>
118 </div>
119 <div class="mo_table_layout" style="width:100%" >
120 <h3 style="margin: 0px;">Attribute Mapping <small style="color: #FF0000;font-size: 60%"><a href="admin.php?page=mo_firebase_authentication&tab=licensing_plans">[PREMIUM]</a></small></h3>
121 <form name="mo_firebase_attr_mapping_form" id="mo_firebase_attr_mapping_form" method="post">
122 <input type="hidden" name="option" value="mo_firebase_attr_mapping">
123 <table class="mo_settings_table" style="margin-top: 10px;">
124 <tr><td><strong><font color="#FF0000">* </font>Username Attribute:</strong></td>
125 <td><input class="mo_table_short_textbox" type="text" id="mo_firebase_username" name="username_attr" value="" placeholder="Username Attribute Name" disabled style="width:40%;"></td></tr>
126 <tr><td><span class="mo_premium_feature"></span><strong>Email Attribute:</strong></td>
127 <td><input type="text" class="mo_table_short_textbox" id="mo_firebase_email" name="email_attr" value="" placeholder="Email Attribute Name" disabled style="width:40%;"></td></tr>
128 </table><br>
129 <input type="submit" class="btn btn-primary" id="mo_firebase_save_attr_mapping_button" name="save_settings" value="Save Settings" disabled style="font-size: 14px; font-weight: 400;">
130 </form>
131 </div>
132
133 <div class="mo_table_layout" style="width:100%" >
134 <h3 style="margin: 0px">Role Mapping <small style="color: #FF0000;font-size: 60%"><a href="admin.php?page=mo_firebase_authentication&tab=licensing_plans">[PREMIUM]</a></small></h3>
135 <form name="mo_firebase_role_mapping_form" id="mo_firebase_role_mapping_form" method="post">
136 <input type="hidden" name="option" value="mo_firebase_role_mapping">
137 <table class="mo_settings_table" style="margin-top: 20px;">
138 <tr><td colspan="2" style="padding-top: 10px;"><strong> <input type="checkbox" name="keep_existing_user_roles" value="1" disabled />Keep existing user roles</strong> <br><strong></strong><small>Role mapping won't apply to existing WordPress users</small></td></tr>
139 <tr><td><strong>WordPress Role:</strong></td>
140 <td style="padding-top:15px;">
141 <select name="mo_firebase_default_role" id="mo_firebase_default_role" disabled>
142 <?php
143 $mo_fb_role = isset( $role_mappings['mo_firebase_default_role'] ) && $role_mappings['mo_firebase_default_role'] ? $role_mappings['mo_firebase_default_role'] : 'subscriber';
144 wp_dropdown_roles( $mo_fb_role );
145 ?>
146 </select>
147 </td>
148 </tr>
149 <tr><td colspan="2"><strong></strong><small>This role will be assigned to all the users who login with firebase.</small></td></tr>
150 </table>
151 <input type="submit" class="btn btn-primary" id="mo_firebase_save_role_mapping_button" style="font-size: 14px; font-weight: 400; margin-top: 2%;" name="save_settings" disabled value="Save Settings">
152 </form>
153 </div>
154 </div>
155 </div>
156 <script>
157
158 function passwordShowButton(id1, id2){
159 var field = document.getElementById(id1);
160 var show_button = document.getElementById(id2);
161 if(field.type == "password"){
162 field.type = "text";
163 show_button.className = "fa fa-eye-slash";
164 }
165 else{
166 field.type = "password";
167 show_button.className = "fa fa-eye";
168 }
169 }
170 jQuery("#mo_firebase_auth_test_config_button").on("click", function(event) {
171 var test_username = document.forms["test_configuration_form"]["test_username"].value;
172 var test_password = document.forms["test_configuration_form"]["test_password"].value;
173 if( test_username == "" || test_password == "" ){
174 return;
175 }
176 event.preventDefault();
177 let url = "<?php echo esc_url( site_url() ); ?>/?mo_action=firebaselogin&test=true";
178 jQuery("#mo_firebasetestconfig").attr("action", url);
179 let newwindow = window.open("about:blank", 'firebasetestconfig', 'location=yes,height=700,width=600,scrollbars=yes,status=yes');
180 jQuery("#mo_firebasetestconfig").submit();
181 });
182 function mo_firebase_auth_showDiv(){
183 document.getElementById("mo_firebase_auth_enable_admin_wp_login_div").style.display = "block";
184 }
185 function mo_firebase_auth_hideDiv(){
186 document.getElementById("mo_firebase_auth_enable_admin_wp_login_div").style.display = "none";
187 }
188
189 </script>
190 <?php
191 }
192 }
193