PluginProbe ʕ •ᴥ•ʔ
Firebase Authentication / 1.5.6
Firebase Authentication v1.5.6
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-config.php
firebase-authentication / admin / partials / config Last commit date
class-mo-firebase-authentication-advsettings.php 4 years ago class-mo-firebase-authentication-config.php 4 years ago class-mo-firebase-authentication-hooks.php 4 years ago class-mo-firebase-authentication-licensing_plans.php 4 years ago class-mo-firebase-authentication-loginsettings.php 4 years ago
class-mo-firebase-authentication-config.php
125 lines
1 <?php
2
3 class Mo_Firebase_Authentication_Admin_Config {
4
5 public static function mo_firebase_authentication_config() {
6 ?>
7 <!-- <div id="mo_firebase_authentication_support_layout" class="mo_firebase_authentication_support_layout"> -->
8 <div class="row">
9 <div class="col-md-12" >
10 <div>
11 <div class="mo_table_layout" style="padding-top: 0px;">
12 <form action="" method="post" id="mo_enable_firebase_auth_form">
13 <?php wp_nonce_field('mo_firebase_auth_enable_form','mo_firebase_auth_enable_field'); ?>
14 <!-- <div style="display:inline"><div style="display:inline-block;padding:0px 10px 10px 0px"><strong>Enable Firebase Authentication:</strong></div> -->
15 <div style="display:inline-block; margin-top: 0"><label class="mo_firebase_auth_switch">
16 <input value="1" name="mo_enable_firebase_auth" type="checkbox" id="mo_enable_firebase_auth" <?php echo get_option('mo_enable_firebase_auth') ? 'checked' : '' ?>>
17 <span class="mo_firebase_auth_slider round"></span>
18 <input type="hidden" name="option" value="mo_enable_firebase_auth">
19 </label>
20 </div>
21 <div style="display:inline"><div style="display:inline-block;padding:0px 10px 10px 0px"><h3>Enable Firebase Authentication</h3></div>
22 <span style="float: right; font-size: 14px; margin-top: 10px;">
23 <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>
24 </div>
25 </form>
26 <form action="" method="post" id="mo_firebase_auth_form" style="margin-top: 0px;">
27 <?php wp_nonce_field('mo_firebase_auth_config_form','mo_firebase_auth_config_field'); ?>
28 <table class="mo_settings_table">
29 <tr><td colspan="2"><strong style="padding-left: 0px; ">Allow users to login with :</strong>
30 </td></tr>
31 <tr><td>
32 <input style="margin-left: 5px;"type="radio" name="disable_wordpress_login" id="disable_wordpress_login" <?php if(get_option('mo_enable_firebase_auth') == false){ echo '';}else {echo get_option('mo_firebase_auth_disable_wordpress_login') ? '' : 'checked';} ?> value="0"onclick="mo_firebase_auth_hideDiv();">Both Firebase and WordPress
33 </td><td>
34 <input type="radio" name="disable_wordpress_login" id="disable_wordpress_login" <?php if(get_option('mo_enable_firebase_auth') == false){ echo '';}else {echo get_option('mo_firebase_auth_disable_wordpress_login') ? 'checked' : '';} ?> value="1"onclick="mo_firebase_auth_showDiv();">Only Firebase</td></tr>
35 <tr><td colspan="2">
36 <div style="padding:5px;"></div>
37 <div style="<?php if(get_option('mo_firebase_auth_disable_wordpress_login') == 1) echo "display: block";else echo "display: none";?>"id="mo_firebase_auth_enable_admin_wp_login_div">
38 <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.
39 </p><div style="margin-bottom: 15px;">
40 <input type="checkbox" id="mo_firebase_auth_enable_admin_wp_login" name="mo_firebase_auth_enable_admin_wp_login" value="1" <?php checked((esc_attr(get_option('mo_firebase_auth_enable_admin_wp_login')) === false) || (esc_attr(get_option('mo_firebase_auth_enable_admin_wp_login')) == 1));?> /> 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>
41 </div></td></tr>
42 </table>
43 <div style="margin-top: 10px;">
44 <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;">
45 <input type="text" id="project_id" name="projectid" value= "<?php echo get_option( 'mo_firebase_auth_project_id' ); ?>" placeholder="Enter Project Id.." required="" style = "width:50%; font-size: 14px;"></div><br>
46 <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>
47 <input style = "width:50%; font-size: 14px;" type="password" id="api_key" name="apikey" value="<?php echo get_option( 'mo_firebase_auth_api_key' ); ?>" placeholder="Enter your API Key.." required="">
48 <i class="fa fa-eye" id="show_button" onclick="passwordShowButton('api_key', this.id)" style="margin-left: -30px; cursor: pointer; "></i>
49 <br><br>
50 <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">
51 </form>
52 </div>
53 </div>
54 <div>
55 <div class="mo_table_layout" id ="test_authentication" style="width:100%" >
56 <h3 style="margin: 0px;">Test Authentication</h3>
57 <form name="test_configuration_form" id="mo_firebasetestconfig" method="post" target="firebasetestconfig" style="margin-top: 0px;">
58 <?php wp_nonce_field('mo_firebase_auth_test_config_form','mo_firebase_auth_test_config_field'); ?>
59
60 <input type="hidden" name="option" value="mo_firebase_auth_test_configuration">
61 <table class="mo_settings_table" >
62 <tr><td>
63 <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>
64 <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%;">
65 <i class="fa fa-eye" id="show_button1" onclick="passwordShowButton('test_password', this.id)" style="margin-left: -30px; cursor: pointer; "></i>
66 </td></tr><br></table>
67 <input type="hidden" id="test_check_field" name="test_check_field" value="test_check_true">
68 <br>
69 <input type="submit" id="mo_firebase_auth_test_config_button" name="test_configuration" value="Test Authentication" <?php if( ! get_option( 'mo_firebase_auth_project_id' ) && ! get_option( 'mo_firebase_auth_api_key' ) ) echo 'disabled class="btn btn-primary" style="font-size: 14px; font-weight: 400;"'; else echo 'class="button button-primary button-large"' ?> >
70 </form>
71 </div>
72 </div>
73 <div class="mo_table_layout" style="width:100%" >
74 <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>
75 <form name="mo_firebase_attr_mapping_form" id="mo_firebase_attr_mapping_form" method="post">
76 <input type="hidden" name="option" value="mo_firebase_attr_mapping">
77 <table class="mo_settings_table" style="margin-top: 10px;">
78 <tr><td><strong><font color="#FF0000">* </font>Username Attribute:</strong></td>
79 <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>
80 <tr><td><span class="mo_premium_feature"></span><strong>Email Attribute:</strong></td>
81 <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>
82 </table><br>
83 <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;">
84 </form>
85 </div>
86 </div>
87 </div>
88 <script>
89
90 function passwordShowButton(id1, id2){
91 var field = document.getElementById(id1);
92 var show_button = document.getElementById(id2);
93 if(field.type == "password"){
94 field.type = "text";
95 show_button.className = "fa fa-eye-slash";
96 }
97 else{
98 field.type = "password";
99 show_button.className = "fa fa-eye";
100 }
101 }
102
103 jQuery("#mo_firebase_auth_test_config_button").on("click", function(event) {
104 var test_username = document.forms["test_configuration_form"]["test_username"].value;
105 var test_password = document.forms["test_configuration_form"]["test_password"].value;
106 if( test_username == "" || test_password == "" ){
107 return;
108 }
109 event.preventDefault();
110 let url = "<?php echo site_url(); ?>/?mo_action=firebaselogin&test=true";
111 jQuery("#mo_firebasetestconfig").attr("action", url);
112 let newwindow = window.open("about:blank", 'firebasetestconfig', 'location=yes,height=700,width=600,scrollbars=yes,status=yes');
113 jQuery("#mo_firebasetestconfig").submit();
114 });
115 function mo_firebase_auth_showDiv(){
116 document.getElementById("mo_firebase_auth_enable_admin_wp_login_div").style.display = "block";
117 }
118 function mo_firebase_auth_hideDiv(){
119 document.getElementById("mo_firebase_auth_enable_admin_wp_login_div").style.display = "none";
120 }
121
122 </script>
123 <?php
124 }
125 }