From f8fee5de293d0cef96894bf23278e5efabe55591 Mon Sep 17 00:00:00 2001 From: German Lena Date: Thu, 28 May 2015 11:42:11 -0300 Subject: [PATCH] fix implicit wf in subdirectories, added custom JS --- README.md | 2 ++ WP_Auth0.php | 7 +++++-- lib/WP_Auth0_Admin.php | 7 +++++++ lib/WP_Auth0_Options.php | 1 + templates/a0-widget-setup-form.php | 5 +++++ templates/auth0-login-form.php | 8 +++++++- 6 files changed, 27 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 6bf4744d..c56fe89f 100644 --- a/README.md +++ b/README.md @@ -5,6 +5,8 @@ Single Sign On for Enterprises + Social Login + User/Passwords. For all your Wor Demo: +Documentation: + ## Installation Before you start, **make sure the admin user has a valid email that you own**, read the Technical Notes for more information. diff --git a/WP_Auth0.php b/WP_Auth0.php index 7f8af345..a2ccfe33 100644 --- a/WP_Auth0.php +++ b/WP_Auth0.php @@ -2,7 +2,7 @@ /** * Plugin Name: Wordpress Auth0 Integration * Description: Implements the Auth0 Single Sign On solution into Wordpress - * Version: 1.2.6 + * Version: 1.2.7 * Author: Auth0 * Author URI: https://auth0.com */ @@ -12,7 +12,7 @@ define('WPA0_PLUGIN_URL', trailingslashit(plugin_dir_url(__FILE__) )); define('WPA0_LANG', 'wp-auth0'); define('AUTH0_DB_VERSION', 2); -define('WPA0_VERSION', '1.2.6'); +define('WPA0_VERSION', '1.2.7'); class WP_Auth0 { public static function init(){ @@ -265,6 +265,9 @@ public static function buildSettings($settings) if (self::IsValid($settings,'custom_css')) { $options_obj['custom_css'] = $settings['custom_css']; } + if (self::IsValid($settings,'custom_js')) { + $options_obj['custom_js'] = $settings['custom_js']; + } if (self::IsValid($settings,'social_big_buttons')) { $options_obj['socialBigButtons'] = self::GetBoolean($settings['social_big_buttons']); } diff --git a/lib/WP_Auth0_Admin.php b/lib/WP_Auth0_Admin.php index 13764150..1f8c4dc4 100755 --- a/lib/WP_Auth0_Admin.php +++ b/lib/WP_Auth0_Admin.php @@ -80,6 +80,7 @@ public static function init_admin(){ array('id' => 'wpa0_default_login_redirection', 'name' => 'Login redirection URL', 'function' => 'render_default_login_redirection'), array('id' => 'wpa0_verified_email', 'name' => 'Requires verified email', 'function' => 'render_verified_email'), array('id' => 'wpa0_allow_signup', 'name' => 'Allow signup', 'function' => 'render_allow_signup'), + array('id' => 'wpa0_custom_js', 'name' => 'Customize the Login Widget with custom JS', 'function' => 'render_custom_js'), //array('id' => 'wpa0_auto_provisioning', 'name' => 'Auto Provisioning', 'function' => 'render_auto_provisioning'), array('id' => 'wpa0_auth0_implicit_workflow', 'name' => 'Auth0 Implicit flow', 'function' => 'render_auth0_implicit_workflow'), array('id' => 'wpa0_auto_login', 'name' => 'Auto Login (no widget)', 'function' => 'render_auto_login'), @@ -169,6 +170,12 @@ public static function render_custom_css(){ echo '
' . __('This should be a valid CSS to customize the Auth0 login widget. ', WPA0_LANG) . '' . __('More info', WPA0_LANG) . ''; } + public static function render_custom_js(){ + $v = WP_Auth0_Options::get( 'custom_js' ); + echo ''; + echo '
' . __('This should be a valid JS to customize the Auth0 login widget to, for example, add custom buttons. ', WPA0_LANG) . '' . __('More info', WPA0_LANG) . ''; + } + public static function render_username_style(){ $v = WP_Auth0_Options::get( 'username_style' ); echo ''; diff --git a/lib/WP_Auth0_Options.php b/lib/WP_Auth0_Options.php index 91b8787d..fdb4e12a 100755 --- a/lib/WP_Auth0_Options.php +++ b/lib/WP_Auth0_Options.php @@ -59,6 +59,7 @@ private static function defaults(){ 'extra_conf' => '', 'remember_last_login' => true, 'custom_css' => '', + 'custom_js' => '', 'auth0_implicit_workflow' => false, 'gravatar' => true, 'jwt_auth_integration' => false, diff --git a/templates/a0-widget-setup-form.php b/templates/a0-widget-setup-form.php index 62dc5fc7..2f633d40 100644 --- a/templates/a0-widget-setup-form.php +++ b/templates/a0-widget-setup-form.php @@ -11,6 +11,7 @@ $extra_conf = isset($instance[ 'extra_conf' ]) ? $instance[ 'extra_conf' ] : ''; $remember_last_login = isset($instance[ 'remember_last_login' ]) ? $instance[ 'remember_last_login' ] : ''; $custom_css = isset($instance[ 'custom_css' ]) ? $instance[ 'custom_css' ] : ''; +$custom_js = isset($instance[ 'custom_js' ]) ? $instance[ 'custom_js' ] : ''; ?> @@ -140,6 +141,10 @@ class="button-secondary"> name="get_field_name( 'custom_css' ); ?>"> +
diff --git a/templates/auth0-login-form.php b/templates/auth0-login-form.php index 2db8a224..6fb4f24d 100644 --- a/templates/auth0-login-form.php +++ b/templates/auth0-login-form.php @@ -119,7 +119,7 @@ callback = function(err,profile, token) { - post('/index.php?auth0=implicit', { + post(, { token:token, state:'' }, 'POST'); @@ -130,6 +130,12 @@ var lock = new Auth0Lock('', ''); + + + + + + function a0ShowLoginModal() { var options = ;