Changeset 1740355
- Timestamp:
- 10/03/2017 02:00:03 PM (9 years ago)
- Location:
- unloq/trunk
- Files:
-
- 6 edited
-
autoloader/class-utility.php (modified) (1 diff)
-
autoloader/login/class-login.php (modified) (4 diffs)
-
autoloader/login/login.tpl.php (modified) (1 diff)
-
readme.txt (modified) (1 diff)
-
unloq.php (modified) (1 diff)
-
vendors/ui/js/login.compat.js (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
unloq/trunk/autoloader/class-utility.php
r1735499 r1740355 69 69 array_push($_SESSION[self::UNLOQ_FLASH_KEY], $item); 70 70 return true; 71 } 72 73 /* 74 * Clears the UNLOQ flash for errors. 75 * */ 76 public static function clearFlash() { 77 if(isset($_SESSION[self::UNLOQ_FLASH_KEY])) { 78 $_SESSION[self::UNLOQ_FLASH_KEY] = array(); 79 } 71 80 } 72 81 -
unloq/trunk/autoloader/login/class-login.php
r1735499 r1740355 1049 1049 session_start(); 1050 1050 } 1051 add_action('init', array($this, "sso_request_start"), 1); 1052 } 1053 1054 private function sso_request_login() { 1051 add_action('init', array($this, "sso_request_start"), 2); 1052 add_action('init', array($this, "sso_request_login"), 0); 1053 } 1054 1055 1056 public function sso_request_login() { 1055 1057 if(!isset($_GET['unloq_uauth']) || !isset($_GET['token']) || !strlen($_GET['token'])) return; 1056 1058 if($_GET['unloq_uauth'] !== 'login') return; 1057 1059 $token = $_GET['token']; 1058 1059 1060 $isLogged = $this->consume_token($token); 1060 1061 if($isLogged !== true) { … … 1064 1065 } 1065 1066 parse_str($this->utility->rgar($_GET, 'query'), $query); 1066 1067 1067 $redirect_to = apply_filters('uq_login_redirect', $this->utility->rgar($query, 'redirect_to', admin_url('index.php'))); 1068 1068 wp_redirect($redirect_to); … … 1076 1076 public function sso_request_start() { 1077 1077 if(is_admin()) return; 1078 $this->sso_request_login();1079 1078 if(!isset($GLOBALS['pagenow']) || $GLOBALS['pagenow'] !== 'wp-login.php') return; 1080 1079 wp_enqueue_script( 'uq-login-compat', UQ_VENDORS . '/ui/js/login.compat.js', array('jquery'), UQ_VERSION, true ); … … 1152 1151 } 1153 1152 } 1153 $this->utility->clearFlash(); 1154 1154 return $errors; 1155 1155 } -
unloq/trunk/autoloader/login/login.tpl.php
r1735499 r1740355 17 17 redirUrl += 'unloq_uauth=login&token=' + data.token; 18 18 try { 19 window.location = redirUrl;19 window.location.replace(redirUrl); 20 20 } catch(e) { 21 window.location.href = redirUrl; 21 22 } 22 setTimeout(function() {23 try {24 window.location.replace(redirUrl);25 } catch(e) {26 }27 }, 5);28 23 }); 29 24 })(); -
unloq/trunk/readme.txt
r1736178 r1740355 119 119 120 120 == Changelog == 121 = 2.1.4 = 122 * Fixed an issue with login redirect 121 123 = 2.1.3 = 122 124 * Fixed an issue with class autoloader -
unloq/trunk/unloq.php
r1736178 r1740355 3 3 * Plugin Name: UNLOQ Authentication 4 4 * Description: Perform UNLOQ.io authentications with the click of a button 5 * Version: 2.1. 35 * Version: 2.1.4 6 6 * Author: UNLOQ.io 7 7 * Author URI: https://unloq.io -
unloq/trunk/vendors/ui/js/login.compat.js
r1735499 r1740355 29 29 document.getElementsByTagName('head')[0].appendChild(script); 30 30 } 31 31 32 function loadPlugin($) { 32 33 var $btn = $("#btnInitUnloq"); 33 if (!$btn || $btn.size() === 0) return; // unloq-only.34 if (!$btn || $btn.size() === 0) return; // unloq-only. 34 35 var $login = $("#login"), 35 36 $form = $login.find("form").first(); 36 if ($login.size() === 0) {37 if ($login.size() === 0) { 37 38 // something went wrong. 38 39 console.error('UNLOQ Failed to initialize, the login form was no-where to be found.'); … … 63 64 isInitialized = true; 64 65 $scr.load(function() { 65 if (typeof window.UNLOQ !== 'object' || !window.UNLOQ) return;66 if (typeof window.UNLOQ.onLogin !== 'function') return;66 if (typeof window.UNLOQ !== 'object' || !window.UNLOQ) return; 67 if (typeof window.UNLOQ.onLogin !== 'function') return; 67 68 // Manually handle the redirect, to avoid issues with token and redirect loops. 68 69 window.UNLOQ.onLogin(function(data) { 69 if (typeof data !== 'object' || !data) return;70 if (typeof data.token !== 'string' || !data.token) return;70 if (typeof data !== 'object' || !data) return; 71 if (typeof data.token !== 'string' || !data.token) return; 71 72 var redirUrl = window.location.href.split('#')[0]; 72 73 redirUrl += (redirUrl.indexOf('?') === -1 ? '?' : '&'); 73 74 redirUrl += 'unloq_uauth=login&token=' + data.token; 74 75 try { 75 window.location = redirUrl;76 window.location.replace(redirUrl); 76 77 } catch(e) { 78 window.location.href = redirUrl; 77 79 } 78 setTimeout(function() {79 try {80 window.location.replace(redirUrl);81 } catch(e) {82 }83 }, 5);84 80 }); 85 81 }); … … 89 85 var which = ($(this).hasClass('tab-unloq') ? 'unloq' : 'password'), 90 86 $parent = $(this).parent(); 91 if (which == 'unloq') {92 if ($parent.hasClass('password-active')) {87 if (which == 'unloq') { 88 if ($parent.hasClass('password-active')) { 93 89 $parent.removeClass('password-active'); 94 90 } 95 if ($parent.hasClass('unloq-active')) return;91 if ($parent.hasClass('unloq-active')) return; 96 92 $parent.addClass('unloq-active'); 97 if (isInitialized) return;93 if (isInitialized) return; 98 94 initialize(); 99 95 } else { 100 if ($parent.hasClass('unloq-active')) {96 if ($parent.hasClass('unloq-active')) { 101 97 $parent.removeClass('unloq-active'); 102 98 } 103 if ($parent.hasClass('password-active')) return;99 if ($parent.hasClass('password-active')) return; 104 100 $parent.addClass('password-active'); 105 101 } … … 107 103 108 104 $tabs.on('click touchstart', '> .tab', onChange); 109 if ($tabs.hasClass('unloq-active')) {105 if ($tabs.hasClass('unloq-active')) { 110 106 initialize(); 111 107 }
Note: See TracChangeset
for help on using the changeset viewer.