Skip to content

Commit

Permalink
fix Signup enabled issue with multisite #89
Browse files Browse the repository at this point in the history
  • Loading branch information
glena committed Aug 5, 2015
1 parent 4bcf32c commit 9fc74f3
Show file tree
Hide file tree
Showing 3 changed files with 57 additions and 1 deletion.
28 changes: 28 additions & 0 deletions lib/WP_Auth0_Admin.php
Original file line number Diff line number Diff line change
Expand Up @@ -553,6 +553,34 @@ public static function render_verified_email() {
}

public static function render_allow_signup() {
if (is_multisite()) {
self::render_allow_signup_regular_multisite();
} else {
self::render_allow_signup_regular();
}
}

public static function render_allow_signup_regular_multisite() {
$allow_signup = WP_Auth0_Options::Instance()->is_wp_registration_enabled();
?>
<span class="description">
<?php echo __( 'Signup will be ', WPA0_LANG ); ?>

<?php if ( ! $allow_signup ) { ?>
<b><?php echo __( 'disabled', WPA0_LANG ); ?></b>
<?php echo __( ' because it is enabled by the setting "Allow new registrations" in the Network Admin.', WPA0_LANG ); ?><br>
<?php } else { ?>
<b><?php echo __( 'enabled', WPA0_LANG ); ?></b>
<?php echo __( ' because it is enabled by the setting "Allow new registrations" nn the Network Admin.', WPA0_LANG ); ?><br>
<?php } ?>

<?php echo __( 'You can manage this setting on Network Admin > Settings > Network Settings > Allow new registrations (you need to set it up to <b>User accounts may be registered</b> or <b>Both sites and user accounts can be registered</b> depending on your preferences).', WPA0_LANG ); ?>
</span>

<?php
}

public static function render_allow_signup_regular() {
$allow_signup = WP_Auth0_Options::Instance()->is_wp_registration_enabled();
?>
<span class="description">
Expand Down
2 changes: 1 addition & 1 deletion lib/WP_Auth0_InitialSetup.php
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ public static function exchange_code() {
if ( ! isset($_REQUEST['code']) ) {
return null;
}

$code = $_REQUEST['code'];
$domain = 'auth0.auth0.com';
$client_id = base64_decode('QmxjVlh0VXVmRm54cnZUTFdLRXBTNG9ET3hCZm95eFo=');
Expand Down
28 changes: 28 additions & 0 deletions lib/WP_Auth0_Routes.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
<?php

class WP_Auth0_Routes {

public static function init() {
add_action('parse_request', array(__CLASS__, 'custom_requests'));
}

public static function custom_requests ( $wp ) {
if( ! empty($wp->query_vars['a0_action']) ) {
switch ($wp->query_vars['a0_action']) {
case 'oauth2-config': self::oauth2_config(); exit;
}
}
}

protected static function oauth2_config() {

$callback_url = admin_url( 'admin.php?page=wpa0-setup&step=2' );

echo json_encode(array(
'redirect_uris' => array(
$callback_url
)
));
exit;
}
}

0 comments on commit 9fc74f3

Please sign in to comment.