Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

A0 widget #16

Merged
merged 55 commits into from
Oct 8, 2014
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
55 commits
Select commit Hold shift + click to select a range
2f616bc
Fix for legacy php versions
glena Sep 27, 2014
e5867b5
A0 widget
glena Sep 26, 2014
21d10b6
Fix to allow to show multiple times the auth0 login form in the same …
glena Sep 26, 2014
b5a36ec
fix
glena Sep 26, 2014
dd2c202
plugin version updated
glena Sep 26, 2014
9c5ff93
upgraded to lock :)
glena Sep 26, 2014
e49b940
upgrade cdn settings to use the lock widget
glena Sep 26, 2014
8af498e
Merge remote-tracking branch 'origin/a0-widget' into a0-widget
glena Sep 27, 2014
b823c8d
Fix for legacy php versions
glena Sep 29, 2014
49a7b54
New settings management
glena Sep 30, 2014
68e09ae
agregado de configuracion
glena Sep 30, 2014
479c34c
change the way it generates the json configuration
glena Sep 30, 2014
9973cbc
added dict + extra settings
glena Oct 1, 2014
cc89ecb
added widget configurations
glena Oct 1, 2014
345cc9d
update version
glena Sep 30, 2014
58d1bf6
fix hidden WP login form when the plugin is disabled
glena Oct 1, 2014
2bae772
upgrade the plugin revision
glena Oct 1, 2014
8349e67
fix
glena Sep 26, 2014
d088c60
A0 widget
glena Sep 26, 2014
a2a362d
fix
glena Sep 26, 2014
0d0c582
upgraded to lock :)
glena Sep 26, 2014
84f5d09
agregado de configuracion
glena Sep 30, 2014
30facef
fix hidden WP login form when the plugin is disabled
glena Oct 1, 2014
f9c6784
the widget now has its own settings! :)
glena Oct 1, 2014
3a39a9f
now the widget can be shown as a modal! :D
glena Oct 2, 2014
2c62c15
shortCode with settings & modal
glena Oct 2, 2014
347dc53
fix the way that the modal is shown (by error it was setted as popup)
glena Oct 2, 2014
b2b5275
updated settings and readme
glena Oct 4, 2014
7529736
fix js changes
glena Oct 4, 2014
f975bfc
change the widget settings form to allow the user to select which opt…
glena Oct 4, 2014
a3b8157
fixes for the shortcode
glena Oct 4, 2014
594a97d
fixes :)
glena Oct 4, 2014
1544fc8
update version
glena Sep 30, 2014
106a829
fix hidden WP login form when the plugin is disabled
glena Oct 1, 2014
607c4ae
upgrade the plugin revision
glena Oct 1, 2014
41434d5
A0 widget
glena Sep 26, 2014
f53f4b5
Fix to allow to show multiple times the auth0 login form in the same …
glena Sep 26, 2014
7b683e5
fix
glena Sep 26, 2014
7cdd8e5
upgraded to lock :)
glena Sep 26, 2014
2a77e29
A0 widget
glena Sep 26, 2014
362f6a9
Fix to allow to show multiple times the auth0 login form in the same …
glena Sep 26, 2014
a48ce05
fix
glena Sep 26, 2014
e35b5b3
New settings management
glena Sep 30, 2014
d4ea519
agregado de configuracion
glena Sep 30, 2014
bfa0c97
added dict + extra settings
glena Oct 1, 2014
3147493
fix hidden WP login form when the plugin is disabled
glena Oct 1, 2014
d10006c
fix
glena Sep 26, 2014
2e57d26
agregado de configuracion
glena Sep 30, 2014
ac6159f
fix hidden WP login form when the plugin is disabled
glena Oct 1, 2014
75ebd3d
the widget now has its own settings! :)
glena Oct 1, 2014
36640dd
now the widget can be shown as a modal! :D
glena Oct 2, 2014
d6f6be9
removed fields, added fields, added descriptions and links
glena Oct 7, 2014
fcc4a42
changes to the plugin and screenshots added
glena Oct 7, 2014
fa7c512
fix widget as modal
glena Oct 7, 2014
8d4e4cb
screenshots added
glena Oct 7, 2014
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
now the widget can be shown as a modal! :D
  • Loading branch information
glena committed Oct 7, 2014
commit 36640dd51fb4b4580a892f6c0b8d79d75ccb3f8d
3 changes: 2 additions & 1 deletion lib/WP_Auth0_Widget.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,8 @@ public function widget( $args, $instance ) {
echo $args['before_widget'];

$settings = WP_Auth0::buildSettings($instance);

$settings[ 'show_as_modal' ] = isset($instance[ 'show_as_modal' ]) ? $instance[ 'show_as_modal' ] : false;
$settings[ 'modal_trigger_name' ] = isset($instance[ 'modal_trigger_name' ]) ? $instance[ 'modal_trigger_name' ] : 'Login';

require_once WPA0_PLUGIN_DIR . 'templates/login-form.php';
renderAuth0Form(false, $settings);
Expand Down
96 changes: 16 additions & 80 deletions templates/a0-widget-setup-form.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,18 +33,10 @@
<label for="<?php echo $this->get_field_id( 'username_style' ); ?>_email"><?php _e( 'Username' ); ?></label>
</p>
<p>
<label><?php _e( 'Show as modal:' ); ?></label>

<input id="<?php echo $this->get_field_id( 'show_as_modal' ); ?>_yes"
name="<?php echo $this->get_field_name( 'show_as_modal' ); ?>"
type="radio" value="1" <?php echo (esc_attr( $show_as_modal ) == 1 ? 'checked="true"' : ''); ?> />
<label for="<?php echo $this->get_field_id( 'show_as_modal' ); ?>_yes"><?php _e( 'Yes' ); ?></label>

<input id="<?php echo $this->get_field_id( 'show_as_modal' ); ?>_no"
name="<?php echo $this->get_field_name( 'show_as_modal' ); ?>"
type="radio" value="0" <?php echo (esc_attr( $show_as_modal ) == 0 ? 'checked="true"' : ''); ?> />
<label for="<?php echo $this->get_field_id( 'show_as_modal' ); ?>_no"><?php _e( 'No' ); ?></label>

<input id="<?php echo $this->get_field_id( 'show_as_modal' ); ?>"
name="<?php echo $this->get_field_name( 'show_as_modal' ); ?>"
type="checkbox" value="1" <?php echo (esc_attr( $show_as_modal ) == 1 ? 'checked="true"' : ''); ?> />
<label for="<?php echo $this->get_field_id( 'show_as_modal' ); ?>"><?php _e( 'Show as modal' ); ?></label>
</p>
<p>
<label for="<?php echo $this->get_field_id( 'modal_trigger_name' ); ?>"><?php _e( 'Modal button name' ); ?></label>
Expand All @@ -53,83 +45,28 @@
type="text" value="<?php echo esc_attr( $modal_trigger_name ); ?>" />
</p>
<p>
<label><?php _e( 'Show big social buttons:' ); ?></label>

<input id="<?php echo $this->get_field_id( 'social_big_buttons' ); ?>_yes"
name="<?php echo $this->get_field_name( 'social_big_buttons' ); ?>"
type="radio" value="1" <?php echo (esc_attr( $social_big_buttons ) == 1 ? 'checked="true"' : ''); ?> />
<label for="<?php echo $this->get_field_id( 'social_big_buttons' ); ?>_yes"><?php _e( 'Yes' ); ?></label>

<input id="<?php echo $this->get_field_id( 'social_big_buttons' ); ?>_no"
name="<?php echo $this->get_field_name( 'social_big_buttons' ); ?>"
type="radio" value="0" <?php echo (esc_attr( $social_big_buttons ) == 0 ? 'checked="true"' : ''); ?> />
<label for="<?php echo $this->get_field_id( 'social_big_buttons' ); ?>_no"><?php _e( 'No' ); ?></label>

<input id="<?php echo $this->get_field_id( 'social_big_buttons' ); ?>_inherit"
<input id="<?php echo $this->get_field_id( 'social_big_buttons' ); ?>"
name="<?php echo $this->get_field_name( 'social_big_buttons' ); ?>"
type="radio" value="" <?php echo (esc_attr( $social_big_buttons ) === '' ? 'checked="true"' : ''); ?> />
<label for="<?php echo $this->get_field_id( 'social_big_buttons' ); ?>_no"><?php _e( 'Inherit' ); ?></label>

type="checkbox" value="1" <?php echo (esc_attr( $social_big_buttons ) == 1 ? 'checked="true"' : ''); ?> />
<label for="<?php echo $this->get_field_id( 'social_big_buttons' ); ?>"><?php _e( 'Show big social buttons' ); ?></label>
</p>
<p>
<label><?php _e( 'Enable Gravatar integration:' ); ?></label>

<input id="<?php echo $this->get_field_id( 'gravatar' ); ?>_yes"
name="<?php echo $this->get_field_name( 'gravatar' ); ?>"
type="radio" value="1" <?php echo (esc_attr( $gravatar ) == 1 ? 'checked="true"' : ''); ?> />
<label for="<?php echo $this->get_field_id( 'gravatar' ); ?>_yes"><?php _e( 'Yes' ); ?></label>

<input id="<?php echo $this->get_field_id( 'gravatar' ); ?>_no"
<input id="<?php echo $this->get_field_id( 'gravatar' ); ?>"
name="<?php echo $this->get_field_name( 'gravatar' ); ?>"
type="radio" value="0" <?php echo (esc_attr( $gravatar ) == 0 ? 'checked="true"' : ''); ?> />
<label for="<?php echo $this->get_field_id( 'gravatar' ); ?>_no"><?php _e( 'No' ); ?></label>

<input id="<?php echo $this->get_field_id( 'gravatar' ); ?>_inherit"
name="<?php echo $this->get_field_name( 'gravatar' ); ?>"
type="radio" value="" <?php echo (esc_attr( $gravatar ) === '' ? 'checked="true"' : ''); ?> />
<label for="<?php echo $this->get_field_id( 'gravatar' ); ?>_no"><?php _e( 'Inherit' ); ?></label>


type="checkbox" value="1" <?php echo (esc_attr( $gravatar ) == 1 ? 'checked="true"' : ''); ?> />
<label for="<?php echo $this->get_field_id( 'gravatar' ); ?>"><?php _e( 'Enable Gravatar integration' ); ?></label>
</p>
<p>

<label><?php _e( 'Remember last login:' ); ?></label>

<input id="<?php echo $this->get_field_id( 'remember_last_login' ); ?>_yes"
name="<?php echo $this->get_field_name( 'remember_last_login' ); ?>"
type="radio" value="1" <?php echo (esc_attr( $remember_last_login ) == 1 ? 'checked="true"' : ''); ?> />
<label for="<?php echo $this->get_field_id( 'remember_last_login' ); ?>_yes"><?php _e( 'Yes' ); ?></label>

<input id="<?php echo $this->get_field_id( 'remember_last_login' ); ?>_no"
<input id="<?php echo $this->get_field_id( 'remember_last_login' ); ?>"
name="<?php echo $this->get_field_name( 'remember_last_login' ); ?>"
type="radio" value="0" <?php echo (esc_attr( $remember_last_login ) == 0 ? 'checked="true"' : ''); ?> />
<label for="<?php echo $this->get_field_id( 'remember_last_login' ); ?>_no"><?php _e( 'No' ); ?></label>

<input id="<?php echo $this->get_field_id( 'remember_last_login' ); ?>_inherit"
name="<?php echo $this->get_field_name( 'remember_last_login' ); ?>"
type="radio" value="" <?php echo (esc_attr( $remember_last_login ) === '' ? 'checked="true"' : ''); ?> />
<label for="<?php echo $this->get_field_id( 'remember_last_login' ); ?>_no"><?php _e( 'Inherit' ); ?></label>

type="checkbox" value="1" <?php echo (esc_attr( $remember_last_login ) == 1 ? 'checked="true"' : ''); ?> />
<label for="<?php echo $this->get_field_id( 'remember_last_login' ); ?>"><?php _e( 'Remember last login' ); ?></label>
</p>
<p>

<label><?php _e( 'Show Icon:' ); ?></label>

<input id="<?php echo $this->get_field_id( 'show_icon' ); ?>_yes"
name="<?php echo $this->get_field_name( 'show_icon' ); ?>"
type="radio" value="1" <?php echo (esc_attr( $show_icon ) == 1 ? 'checked="true"' : ''); ?> />
<label for="<?php echo $this->get_field_id( 'show_icon' ); ?>_yes"><?php _e( 'Yes' ); ?></label>

<input id="<?php echo $this->get_field_id( 'show_icon' ); ?>_no"
<input id="<?php echo $this->get_field_id( 'show_icon' ); ?>"
name="<?php echo $this->get_field_name( 'show_icon' ); ?>"
type="radio" value="0" <?php echo (esc_attr( $show_icon ) == 0 ? 'checked="true"' : ''); ?> />
<label for="<?php echo $this->get_field_id( 'show_icon' ); ?>_no"><?php _e( 'No' ); ?></label>

<input id="<?php echo $this->get_field_id( 'show_icon' ); ?>_inherit"
name="<?php echo $this->get_field_name( 'show_icon' ); ?>"
type="radio" value="" <?php echo (esc_attr( $show_icon ) === '' ? 'checked="true"' : ''); ?> />
<label for="<?php echo $this->get_field_id( 'show_icon' ); ?>_no"><?php _e( 'Inherit' ); ?></label>

type="checkbox" value="1" <?php echo (esc_attr( $show_icon ) == 1 ? 'checked="true"' : ''); ?> />
<label for="<?php echo $this->get_field_id( 'show_icon' ); ?>"><?php _e( 'Show Icon' ); ?></label>
</p>
<p>
<label for="<?php echo $this->get_field_id( 'icon_url' ); ?>"><?php _e( 'Icon Url:' ); ?></label>
Expand Down Expand Up @@ -179,4 +116,3 @@ class="button-secondary"><?php echo _e( 'Choose Icon' ); ?></a>




39 changes: 33 additions & 6 deletions templates/auth0-login-form.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,15 @@
$cdn = WP_Auth0_Options::get('cdn_url');
$allow_signup = WP_Auth0_Options::get('allow_signup') == 1;
$extra_css = apply_filters( 'auth0_login_css', '');
$showAsModal = (isset($specialSettings['show_as_modal']) && $specialSettings['show_as_modal'] == 1);
$modalTriggerName = 'Login';
if (isset($specialSettings['modal_trigger_name']) && $specialSettings['modal_trigger_name'] != '')
{
$modalTriggerName = $specialSettings['modal_trigger_name'];
}

if (isset($specialSettings['show_as_modal'])) unset($specialSettings['show_as_modal']);
if (isset($specialSettings['modal_trigger_namemodal_trigger_name'])) unset($specialSettings['modal_trigger_name']);

$form_desc = WP_Auth0_Options::get('form_desc');
if (isset($_GET['interim-login']) && $_GET['interim-login'] == 1) {
Expand All @@ -30,8 +38,15 @@
<div id="form-signin-wrapper" class="auth0-login">
<?php include 'error-msg.php'; ?>
<div class="form-signin">
<div id="auth0-login-form">
</div>

<?php if ($showAsModal) { ?>

<button id="a0LoginButton" onclick="a0ShowLoginModal();" ><?php echo $modalTriggerName; ?></button>

<?php } else { ?>
<div id="auth0-login-form">
</div>
<?php } ?>
<?php if ($activated && $wordpress_login_enabled && $canShowLegacyLogin) { ?>
<div id="extra-options">
<a href="?wle">Login with WordPress username</a>
Expand Down Expand Up @@ -60,24 +75,36 @@

$options_obj = array_merge( array(
"callbackURL" => site_url('/index.php?auth0=1'),
"container" => 'auth0-login-form',
"authParams" => array("state" => $state),
), $options_obj );

if (isset($specialSettings))
{
if (isset($specialSettings)){
$options_obj = array_merge( $options_obj , $specialSettings );
}

if ($showAsModal){
$options_obj['popup'] = true;
}
else{
$options_obj['container'] = 'auth0-login-form';
}


$options = json_encode($options_obj);
?>
var options = <?php echo $options; ?>;
function a0ShowLoginModal() {
var options = <?php echo $options; ?>;

<?php if ($allow_signup) { ?>
lock.show(options, callback);
<?php } else { ?>
lock.showSignin(options, callback);
<?php } ?>
}

<?php if (!$showAsModal) { ?>
a0ShowLoginModal();
<?php } ?>

</script>
<?php
Expand Down