Changeset 2183104
- Timestamp:
- 10/30/2019 01:41:21 PM (6 years ago)
- Location:
- o365-user-authentication/trunk
- Files:
-
- 2 edited
-
libraries/o365-user-auth-online-authorization-helper.php (modified) (1 diff)
-
o365-user-auth-online.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
o365-user-authentication/trunk/libraries/o365-user-auth-online-authorization-helper.php
r1963459 r2183104 75 75 $key_der = $key->x5c[0]; 76 76 // Per section 4.7 of the current JWK draft [1], the 'x5c' property will be the 77 // DER-encoded value of the X.509 certificate. PHP's openssl functions all require 77 // DER-encoded value of the X.509 certificate. PHP's openssl functions all require 78 78 // a PEM-encoded value. 79 79 $key_pem = chunk_split($key_der, 64, "\n"); -
o365-user-authentication/trunk/o365-user-auth-online.php
r2176874 r2183104 73 73 } 74 74 } 75 76 75 add_action( 'admin_notices', 'o365_base_plugin_error_msg' ); 77 add_action( 'admin_notices', 'o365_base_plugin_info_msg' );78 add_action( 'admin_footer', 'o365_user_auth_basic_feedback_request' );79 function o365_user_auth_basic_feedback_request()80 {81 if ( 'plugins.php' != basename( $_SERVER['PHP_SELF'] ) ) {82 return;83 }84 $deactivate_reasons = array("Does not have the features I'm looking for", "Do not want to upgrade to Premium version", "Confusing Interface", "Bugs in the plugin", "Unable to register", "Other Reasons");85 ?>86 <div id="o365_basic_user_auth_feedback_modal" class="o365_basic_user_auth_modal">87 <div class="o365_basic_user_auth_modal-content">88 <span class="o365_basic_user_auth_close">×</span>89 <h3>Tell us what happened? </h3>90 <form name="f" method="post" action="" id="o365_basic_user_auth_feedback">91 <input type="hidden" name="o365_basic_user_auth_feedback" value="true"/>92 <div>93 <p style="margin-left:2%">94 <?php95 foreach ( $deactivate_reasons as $deactivate_reason ) { ?>96 <div class="o365_basic_user_auth_radio" style="padding:1px;margin-left:2%">97 <label style="font-weight:normal;font-size:14.6px" for="<?php echo $deactivate_reason; ?>">98 <input type="radio" name="o365_basic_user_auth_deactivate_reason_radio" value="<?php echo $deactivate_reason; ?>"99 required>100 <?php echo $deactivate_reason; ?></label>101 </div>102 <?php } ?>103 <br>104 <textarea id="o365_basic_user_auth_query_feedback" name="o365_basic_user_auth_query_feedback" rows="4" style="margin-left:2%;width: 330px"105 placeholder="Write your query here"></textarea>106 <br><br>107 <div class="o365_basic_user_auth_modal-footer">108 <input type="submit" name="o365_basic_user_auth_feedback_submit"109 class="button button-primary button-large" style="float: left;" value="Submit"/>110 <input id="o365_basic_user_auth_skip" type="submit" name="o365_basic_user_auth_feedback_skip"111 class="button button-primary button-large" style="float: right;" value="Skip"/>112 </div>113 </div>114 </form>115 <form name="f" method="post" action="" id="o365_basic_user_auth_feedback_form_close">116 <input type="hidden" name="o365_basic_user_auth_option" value="o365_basic_user_auth_skip_feedback"/>117 </form>118 </div>119 </div>120 <script type="text/javascript">121 jQuery('a[aria-label="Deactivate Office 365 User Authentication"]').click(function () {122 var o365_basic_user_auth_modal = document.getElementById('o365_basic_user_auth_feedback_modal');123 var mo_skip = document.getElementById('o365_basic_user_auth_skip');124 var span = document.getElementsByClassName("o365_basic_user_auth_close")[0];125 o365_basic_user_auth_modal.style.display = "block";126 127 jQuery('input:radio[name="o365_basic_user_auth_deactivate_reason_radio"]').click(function () {128 var reason = jQuery(this).val();129 var query_feedback = jQuery('#o365_basic_user_auth_query_feedback');130 query_feedback.removeAttr('required')131 132 if (reason === "Does not have the features I'm looking for") {133 query_feedback.attr("placeholder", "Let us know what feature are you looking for");134 135 } else if (reason === "Other Reasons") {136 query_feedback.attr("placeholder", "Can you let us know the reason for deactivation");137 query_feedback.prop('required', true);138 139 } else if (reason === "Bugs in the plugin") {140 query_feedback.attr("placeholder", "Can you please let us know about the bug in detail?");141 142 } else if (reason === "Confusing Interface") {143 query_feedback.attr("placeholder", "Finding it confusing? let us know so that we can improve the interface");144 145 } else if (reason === "Unable to register") {146 query_feedback.attr("placeholder", "Error while creating a new account? Can you please let us know the exact error?");147 148 }149 });150 151 span.onclick = function () {152 o365_basic_user_auth_modal.style.display = "none";153 jQuery('#o365_basic_user_auth_feedback_form_close').submit();154 }155 156 window.onclick = function (event) {157 if (event.target == o365_basic_user_auth_modal) {158 o365_basic_user_auth_modal.style.display = "none";159 }160 }161 162 mo_skip.onclick = function() {163 o365_basic_user_auth_modal.style.display = "none";164 jQuery('#o365_basic_user_auth_feedback_form_close').submit();165 }166 return false;167 168 });169 </script>170 <?php171 }172 if ( isset( $_POST['o365_basic_user_auth_option'] ) and $_POST['o365_basic_user_auth_option'] == 'o365_basic_user_auth_skip_feedback' ) {173 $path = plugin_dir_path( dirname( __FILE__ ) ) .'o365-user-authentication/o365-user-auth-online.php';174 deactivate_plugins( $path );175 update_option( 'o365_basic_user_auth_message', 'Plugin deactivated successfully' );176 add_action( 'admin_notices', 'o365_basic_user_auth_message' );177 }178 179 if ( isset( $_POST['o365_basic_user_auth_feedback'] ) and $_POST['o365_basic_user_auth_feedback'] == 'true' ) {180 $url = "https://prod-07.westus.logic.azure.com:443/workflows/5f2f371ae5a8455fad35e6e548fc1363/triggers/manual/paths/invoke?api-version=2016-06-01&sp=%2Ftriggers%2Fmanual%2Frun&sv=1.0&sig=hRCy55kZzm6KQ9W2KQgBvYL46sxMzbVsJZbX_yn2PRc";181 $args = array("deactivate_reason"=>$_POST["o365_basic_user_auth_deactivate_reason_radio"], "deactivate_comment"=>$_POST["o365_basic_user_auth_query_feedback"]);182 $args = json_encode( $args );183 184 wp_remote_post( $url, array("body"=>$args,"headers"=>array("content-type"=>"application/json") ) );185 186 $path = plugin_dir_path( dirname( __FILE__ ) ) .'o365-user-authentication/o365-user-auth-online.php';187 deactivate_plugins( $path );188 update_option( 'o365_basic_user_auth_message', 'Plugin deactivated successfully' );189 add_action( 'admin_notices', 'o365_basic_user_auth_message' );190 191 }192 function o365_basic_user_auth_message()193 {194 $class = "updated";195 $message = get_option('o365_basic_user_auth_message');196 echo "<div class='" . $class . "'><p>" . $message . "</p></div>";197 }
Note: See TracChangeset
for help on using the changeset viewer.