Changeset 2201878
- Timestamp:
- 11/27/2019 09:31:13 AM (6 years ago)
- Location:
- o365-user-authentication/trunk
- Files:
-
- 4 edited
-
function/o365_azure_login_settings.php (modified) (1 diff)
-
inc/o365_user_auth_online_class.php (modified) (7 diffs)
-
o365-user-auth-online.php (modified) (1 diff)
-
readme.txt (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
o365-user-authentication/trunk/function/o365_azure_login_settings.php
r2176874 r2201878 130 130 wp_register_script( 'o365_user_auth_script', O365_USER_AUTH_ONLINE_PLUGIN_URL. '/assests/js/o365_user_auth.js' ); 131 131 wp_localize_script( 'o365_user_auth_script', 'o365_user_auth_script_obj', $value_array ); 132 wp_enqueue_script( 'o365_user_auth_script' ); 132 wp_enqueue_script( 'o365_user_auth_script' ); 133 133 ?> 134 134 135 135 136 136 <tr class="form-field"> 137 <th> <label>Redirect after login</label> </th> 138 <td> 139 <input type="radio" name="o365_user_auth_redirect_after_login" value="admin_dashboard" checked/> Admin Dashboard <br/> 140 <input type="radio" name="o365_user_auth_redirect_after_login" value="current_page" <?php if($azure_login_setting_flow->after_login_redirect_url == 'current_page'){echo 'checked';} ?>/> Current Page 141 </td> 142 </tr> 137 143 138 144 -
o365-user-authentication/trunk/inc/o365_user_auth_online_class.php
r1963459 r2201878 74 74 $azure_login_setting_flow = json_decode( $azure_login_setting_flow ); 75 75 $value = $azure_login_setting_flow->azure_print_login_link; 76 if(session_status() === PHP_SESSION_NONE){ session_start(); } 77 $protocol = ((!empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] != 'off') || $_SERVER['SERVER_PORT'] == 443) ? "https://" : "http://"; 78 $currenturl = $protocol . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI']; 79 if( !strstr($currenturl, 'wp-login.php') ){ 80 unset($_SESSION['currentpageurl']); 81 $_SESSION['currentpageurl'] = $currenturl; 82 } 83 76 84 if( $value == "Yes" || $value == "" ) 77 85 { … … 107 115 'login_text' => '', 108 116 'image_url' => '', 109 ), $atts, 'o365_azure_login_url' 117 ), $atts, 'o365_azure_login_url' 110 118 ); 111 119 if( isset($atts["login_text"]) && $atts["login_text"] !="" ) … … 131 139 function o365_user_auth_authenticate( $user, $username, $password ) 132 140 { 133 / / Don't re-authenticate if already authenticated141 /* Don't re-authenticate if already authenticated */ 134 142 if ( is_a( $user, 'WP_User' ) ) { 135 143 return $user; 136 144 } 137 145 if ( isset( $_GET['code'] ) ) { 138 / /$antiforgery_id = $_SESSION[ self::ANTIFORGERY_ID_KEY ];146 /* $antiforgery_id = $_SESSION[ self::ANTIFORGERY_ID_KEY ]; */ 139 147 $antiforgery_id = sanitize_text_field($_GET['state']); 140 148 $state_is_missing = !isset( $_GET['state']); 141 149 $state_doesnt_match = sanitize_text_field($_GET['state']) != $antiforgery_id; 142 / / Looks like we got an authorization code, let's try to get an access token with it150 /* Looks like we got an authorization code, let's try to get an access token with it */ 143 151 $acc_code = sanitize_text_field($_GET['code']); 144 152 $token = O365_USER_AUTH_ONLINE_AuthorizationHelper::getAccessToken( $acc_code, $this->settings ); 145 / / Happy path153 /* Happy path */ 146 154 if ( isset( $token->access_token ) ) { 147 155 try { … … 157 165 ); 158 166 } 159 / / Invoke any configured matching and auto-provisioning strategy and get the user.167 /* Invoke any configured matching and auto-provisioning strategy and get the user. */ 160 168 $user = $this->getWPUserFromAADUser( $o365_online_JWT ); 161 169 } elseif ( isset( $token->error ) ) { 162 / / Unable to get an access token (although we did get an authorization code)170 /* Unable to get an access token (although we did get an authorization code) */ 163 171 return new WP_Error( 164 172 $token->error, … … 169 177 ); 170 178 } else { 171 / / None of the above, I have no idea what happened.179 /* None of the above, I have no idea what happened. */ 172 180 return new WP_Error( 'unknown', 'ERROR: An unknown error occured.' ); 173 181 } 174 182 } elseif ( isset( $_GET['error'] ) ) { 175 / / The attempt to get an authorization code failed.183 /* The attempt to get an authorization code failed. */ 176 184 return new WP_Error( 177 185 sanitize_text_field($_GET['error']), … … 263 271 ); 264 272 } 265 $o365_user_auth_redirect_to = get_site_url()."/wp-admin"; 273 274 $o365_user_auth_redirect_to = ''; 275 276 if( $azure_login_setting_flow->after_login_redirect_url == 'current_page' ){ 277 $o365_user_auth_redirect_to = $_SESSION['currentpageurl']; 278 } 279 if(empty($o365_user_auth_redirect_to)){ 280 $o365_user_auth_redirect_to = get_site_url()."/wp-admin"; 281 } 282 266 283 $o365_user_auth_new_assign_role = "subscriber"; 267 284 /** Get user by user meta aaduserobjectid: Start**/ … … 413 430 $azure_login_setting_flow = json_decode( $azure_login_setting_flow ); 414 431 $value = $azure_login_setting_flow->azure_print_login_link; 432 if(session_status() === PHP_SESSION_NONE){ session_start(); } 433 $protocol = ((!empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] != 'off') || $_SERVER['SERVER_PORT'] == 443) ? "https://" : "http://"; 434 $currenturl = $protocol . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI']; 435 if( !strstr($currenturl, 'wp-login.php') ){ 436 unset($_SESSION['currentpageurl']); 437 $_SESSION['currentpageurl'] = $currenturl; 438 } 439 415 440 if( $value == "Yes" || $value == "" ){ 416 441 if( isset( $azure_login_setting_flow->azure_image_login_link ) && $azure_login_setting_flow->azure_image_login_link !="" ){ -
o365-user-authentication/trunk/o365-user-auth-online.php
r2183104 r2201878 3 3 * Plugin Name: Office 365 User Authentication 4 4 * Plugin URI: http://www.wpintegrate.com/ 5 * Version: 1. 35 * Version: 1.5 6 6 * Author: wpintegrate.com 7 7 * Author URI: wpintegrate.com -
o365-user-authentication/trunk/readme.txt
r2177016 r2201878 6 6 Tested up to: 5.2.4 7 7 Requires PHP: 5.6.36 8 Stable tag: 1. 48 Stable tag: 1.5 9 9 License: GPLv2 or later 10 10 License URI: http://www.gnu.org/licenses/gpl-2.0.html … … 152 152 Make it compatible to PHP 7 and WordPress 5.2.4 153 153 154 = 1.5 = 155 Added option for Redirect after login 156 154 157 == Upgrade Notice == 155 158
Note: See TracChangeset
for help on using the changeset viewer.