Add upstream
This commit is contained in:
@@ -0,0 +1,325 @@
|
||||
<?php
|
||||
|
||||
if ( ! class_exists( 'Jetpack_SSO_Helpers' ) ) :
|
||||
|
||||
/**
|
||||
* A collection of helper functions used in the SSO module.
|
||||
*
|
||||
* @since 4.1.0
|
||||
*/
|
||||
class Jetpack_SSO_Helpers {
|
||||
/**
|
||||
* Determine if the login form should be hidden or not
|
||||
*
|
||||
* @return bool
|
||||
**/
|
||||
static function should_hide_login_form() {
|
||||
/**
|
||||
* Remove the default log in form, only leave the WordPress.com log in button.
|
||||
*
|
||||
* @module sso
|
||||
*
|
||||
* @since 3.1.0
|
||||
*
|
||||
* @param bool get_option( 'jetpack_sso_remove_login_form', false ) Should the default log in form be removed. Default to false.
|
||||
*/
|
||||
return (bool) apply_filters( 'jetpack_remove_login_form', get_option( 'jetpack_sso_remove_login_form', false ) );
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a boolean value for whether logging in by matching the WordPress.com user email to a
|
||||
* Jetpack site user's email is allowed.
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
static function match_by_email() {
|
||||
$match_by_email = ( 1 == get_option( 'jetpack_sso_match_by_email', true ) ) ? true: false;
|
||||
$match_by_email = defined( 'WPCC_MATCH_BY_EMAIL' ) ? WPCC_MATCH_BY_EMAIL : $match_by_email;
|
||||
|
||||
/**
|
||||
* Link the local account to an account on WordPress.com using the same email address.
|
||||
*
|
||||
* @module sso
|
||||
*
|
||||
* @since 2.6.0
|
||||
*
|
||||
* @param bool $match_by_email Should we link the local account to an account on WordPress.com using the same email address. Default to false.
|
||||
*/
|
||||
return (bool) apply_filters( 'jetpack_sso_match_by_email', $match_by_email );
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a boolean for whether users are allowed to register on the Jetpack site with SSO,
|
||||
* even though the site disallows normal registrations.
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
static function new_user_override( $user_data = null ) {
|
||||
$new_user_override = defined( 'WPCC_NEW_USER_OVERRIDE' ) ? WPCC_NEW_USER_OVERRIDE : false;
|
||||
|
||||
/**
|
||||
* Allow users to register on your site with a WordPress.com account, even though you disallow normal registrations.
|
||||
* If you return a string that corresponds to a user role, the user will be given that role.
|
||||
*
|
||||
* @module sso
|
||||
*
|
||||
* @since 2.6.0
|
||||
* @since 4.6 $user_data object is now passed to the jetpack_sso_new_user_override filter
|
||||
*
|
||||
* @param bool $new_user_override Allow users to register on your site with a WordPress.com account. Default to false.
|
||||
* @param object|null $user_data An object containing the user data returned from WordPress.com.
|
||||
*/
|
||||
$role = apply_filters( 'jetpack_sso_new_user_override', $new_user_override, $user_data );
|
||||
|
||||
if ( $role ) {
|
||||
if ( is_string( $role ) && get_role( $role ) ) {
|
||||
return $role;
|
||||
} else {
|
||||
return get_option( 'default_role' );
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a boolean value for whether two-step authentication is required for SSO.
|
||||
*
|
||||
* @since 4.1.0
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
static function is_two_step_required() {
|
||||
/**
|
||||
* Is it required to have 2-step authentication enabled on WordPress.com to use SSO?
|
||||
*
|
||||
* @module sso
|
||||
*
|
||||
* @since 2.8.0
|
||||
*
|
||||
* @param bool get_option( 'jetpack_sso_require_two_step' ) Does SSO require 2-step authentication?
|
||||
*/
|
||||
return (bool) apply_filters( 'jetpack_sso_require_two_step', get_option( 'jetpack_sso_require_two_step', false ) );
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a boolean for whether a user that is attempting to log in will be automatically
|
||||
* redirected to WordPress.com to begin the SSO flow.
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
static function bypass_login_forward_wpcom() {
|
||||
/**
|
||||
* Redirect the site's log in form to WordPress.com's log in form.
|
||||
*
|
||||
* @module sso
|
||||
*
|
||||
* @since 3.1.0
|
||||
*
|
||||
* @param bool false Should the site's log in form be automatically forwarded to WordPress.com's log in form.
|
||||
*/
|
||||
return (bool) apply_filters( 'jetpack_sso_bypass_login_forward_wpcom', false );
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a boolean for whether the SSO login form should be displayed as the default
|
||||
* when both the default and SSO login form allowed.
|
||||
*
|
||||
* @since 4.1.0
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
static function show_sso_login() {
|
||||
if ( self::should_hide_login_form() ) {
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Display the SSO login form as the default when both the default and SSO login forms are enabled.
|
||||
*
|
||||
* @module sso
|
||||
*
|
||||
* @since 4.1.0
|
||||
*
|
||||
* @param bool true Should the SSO login form be displayed by default when the default login form is also enabled?
|
||||
*/
|
||||
return (bool) apply_filters( 'jetpack_sso_default_to_sso_login', true );
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a boolean for whether the two step required checkbox, displayed on the Jetpack admin page, should be disabled.
|
||||
*
|
||||
* @since 4.1.0
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
static function is_require_two_step_checkbox_disabled() {
|
||||
return (bool) has_filter( 'jetpack_sso_require_two_step' );
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a boolean for whether the match by email checkbox, displayed on the Jetpack admin page, should be disabled.
|
||||
*
|
||||
* @since 4.1.0
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
static function is_match_by_email_checkbox_disabled() {
|
||||
return defined( 'WPCC_MATCH_BY_EMAIL' ) || has_filter( 'jetpack_sso_match_by_email' );
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns an array of hosts that SSO will redirect to.
|
||||
*
|
||||
* Instead of accessing JETPACK__API_BASE within the method directly, we set it as the
|
||||
* default for $api_base due to restrictions with testing constants in our tests.
|
||||
*
|
||||
* @since 4.3.0
|
||||
* @since 4.6.0 Added public-api.wordpress.com as an allowed redirect
|
||||
*
|
||||
* @param array $hosts
|
||||
* @param string $api_base
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
static function allowed_redirect_hosts( $hosts, $api_base = JETPACK__API_BASE ) {
|
||||
if ( empty( $hosts ) ) {
|
||||
$hosts = array();
|
||||
}
|
||||
|
||||
$hosts[] = 'wordpress.com';
|
||||
$hosts[] = 'jetpack.wordpress.com';
|
||||
$hosts[] = 'public-api.wordpress.com';
|
||||
|
||||
if ( false === strpos( $api_base, 'jetpack.wordpress.com/jetpack' ) ) {
|
||||
$base_url_parts = parse_url( esc_url_raw( $api_base ) );
|
||||
if ( $base_url_parts && ! empty( $base_url_parts[ 'host' ] ) ) {
|
||||
$hosts[] = $base_url_parts[ 'host' ];
|
||||
}
|
||||
}
|
||||
|
||||
return array_unique( $hosts );
|
||||
}
|
||||
|
||||
static function generate_user( $user_data ) {
|
||||
$username = $user_data->login;
|
||||
/**
|
||||
* Determines how many times the SSO module can attempt to randomly generate a user.
|
||||
*
|
||||
* @module sso
|
||||
*
|
||||
* @since 4.3.2
|
||||
*
|
||||
* @param int 5 By default, SSO will attempt to random generate a user up to 5 times.
|
||||
*/
|
||||
$num_tries = intval( apply_filters( 'jetpack_sso_allowed_username_generate_retries', 5 ) );
|
||||
|
||||
$tries = 0;
|
||||
while ( ( $exists = username_exists( $username ) ) && $tries++ < $num_tries ) {
|
||||
$username = $user_data->login . '_' . $user_data->ID . '_' . mt_rand();
|
||||
}
|
||||
|
||||
if ( $exists ) {
|
||||
return false;
|
||||
}
|
||||
|
||||
$user = (object) array();
|
||||
$user->user_pass = wp_generate_password( 20 );
|
||||
$user->user_login = wp_slash( $username );
|
||||
$user->user_email = wp_slash( $user_data->email );
|
||||
$user->display_name = $user_data->display_name;
|
||||
$user->first_name = $user_data->first_name;
|
||||
$user->last_name = $user_data->last_name;
|
||||
$user->url = $user_data->url;
|
||||
$user->description = $user_data->description;
|
||||
|
||||
if ( isset( $user_data->role ) && $user_data->role ) {
|
||||
$user->role = $user_data->role;
|
||||
}
|
||||
|
||||
$created_user_id = wp_insert_user( $user );
|
||||
|
||||
update_user_meta( $created_user_id, 'wpcom_user_id', $user_data->ID );
|
||||
return get_userdata( $created_user_id );
|
||||
}
|
||||
|
||||
static function extend_auth_cookie_expiration_for_sso() {
|
||||
/**
|
||||
* Determines how long the auth cookie is valid for when a user logs in with SSO.
|
||||
*
|
||||
* @module sso
|
||||
*
|
||||
* @since 4.4.0
|
||||
* @since 6.1.0 Fixed a typo. Filter was previously jetpack_sso_auth_cookie_expirtation.
|
||||
*
|
||||
* @param int YEAR_IN_SECONDS
|
||||
*/
|
||||
return intval( apply_filters( 'jetpack_sso_auth_cookie_expiration', YEAR_IN_SECONDS ) );
|
||||
}
|
||||
|
||||
/**
|
||||
* Determines if the SSO form should be displayed for the current action.
|
||||
*
|
||||
* @since 4.6.0
|
||||
*
|
||||
* @param string $action
|
||||
*
|
||||
* @return bool Is SSO allowed for the current action?
|
||||
*/
|
||||
static function display_sso_form_for_action( $action ) {
|
||||
/**
|
||||
* Allows plugins the ability to overwrite actions where the SSO form is allowed to be used.
|
||||
*
|
||||
* @module sso
|
||||
*
|
||||
* @since 4.6.0
|
||||
*
|
||||
* @param array $allowed_actions_for_sso
|
||||
*/
|
||||
$allowed_actions_for_sso = (array) apply_filters( 'jetpack_sso_allowed_actions', array(
|
||||
'login',
|
||||
'jetpack-sso',
|
||||
'jetpack_json_api_authorization',
|
||||
) );
|
||||
return in_array( $action, $allowed_actions_for_sso );
|
||||
}
|
||||
|
||||
/**
|
||||
* This method returns an environment array that is meant to simulate `$_REQUEST` when the initial
|
||||
* JSON API auth request was made.
|
||||
*
|
||||
* @since 4.6.0
|
||||
*
|
||||
* @return array|bool
|
||||
*/
|
||||
static function get_json_api_auth_environment() {
|
||||
if ( empty( $_COOKIE['jetpack_sso_original_request'] ) ) {
|
||||
return false;
|
||||
}
|
||||
|
||||
$original_request = esc_url_raw( $_COOKIE['jetpack_sso_original_request'] );
|
||||
|
||||
$parsed_url = wp_parse_url( $original_request );
|
||||
if ( empty( $parsed_url ) || empty( $parsed_url['query'] ) ) {
|
||||
return false;
|
||||
}
|
||||
|
||||
$args = array();
|
||||
wp_parse_str( $parsed_url['query'], $args );
|
||||
|
||||
if ( empty( $args ) || empty( $args['action'] ) ) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if ( 'jetpack_json_api_authorization' != $args['action'] ) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return array_merge(
|
||||
$args,
|
||||
array( 'jetpack_json_api_original_query' => $original_request )
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
endif;
|
||||
@@ -0,0 +1,203 @@
|
||||
<?php
|
||||
|
||||
if ( ! class_exists( 'Jetpack_SSO_Notices' ) ) :
|
||||
|
||||
/**
|
||||
* A collection of helper functions used in the SSO module.
|
||||
*
|
||||
* @since 4.4.0
|
||||
*/
|
||||
class Jetpack_SSO_Notices {
|
||||
/**
|
||||
* Error message displayed on the login form when two step is required and
|
||||
* the user's account on WordPress.com does not have two step enabled.
|
||||
*
|
||||
* @since 2.7
|
||||
* @param string $message
|
||||
* @return string
|
||||
**/
|
||||
public static function error_msg_enable_two_step( $message ) {
|
||||
$error = sprintf(
|
||||
wp_kses(
|
||||
__(
|
||||
'Two-Step Authentication is required to access this site. Please visit your <a href="%1$s" rel="noopener noreferrer" target="_blank">Security Settings</a> to configure <a href="%2$s" rel="noopener noreferrer" target="_blank">Two-step Authentication</a> for your account.',
|
||||
'jetpack'
|
||||
),
|
||||
array( 'a' => array( 'href' => array() ) )
|
||||
),
|
||||
'https://wordpress.com/me/security/two-step',
|
||||
'https://support.wordpress.com/security/two-step-authentication/'
|
||||
);
|
||||
|
||||
$message .= sprintf( '<p class="message" id="login_error">%s</p>', $error );
|
||||
|
||||
return $message;
|
||||
}
|
||||
|
||||
/**
|
||||
* Error message displayed when the user tries to SSO, but match by email
|
||||
* is off and they already have an account with their email address on
|
||||
* this site.
|
||||
*
|
||||
* @param string $message
|
||||
* @return string
|
||||
*/
|
||||
public static function error_msg_email_already_exists( $message ) {
|
||||
$error = sprintf(
|
||||
wp_kses(
|
||||
__(
|
||||
'You already have an account on this site. Please <a href="%1$s">sign in</a> with your username and password and then connect to WordPress.com.',
|
||||
'jetpack'
|
||||
),
|
||||
array( 'a' => array( 'href' => array() ) )
|
||||
),
|
||||
esc_url_raw( add_query_arg( 'jetpack-sso-show-default-form', '1', wp_login_url() ) )
|
||||
);
|
||||
|
||||
$message .= sprintf( '<p class="message" id="login_error">%s</p>', $error );
|
||||
|
||||
return $message;
|
||||
}
|
||||
|
||||
/**
|
||||
* Error message that is displayed when the current site is in an identity crisis and SSO can not be used.
|
||||
*
|
||||
* @since 4.3.2
|
||||
*
|
||||
* @param $message
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public static function error_msg_identity_crisis( $message ) {
|
||||
$error = esc_html__( 'Logging in with WordPress.com is not currently available because this site is experiencing connection problems.', 'jetpack' );
|
||||
$message .= sprintf( '<p class="message" id="login_error">%s</p>', $error );
|
||||
return $message;
|
||||
}
|
||||
|
||||
/**
|
||||
* Error message that is displayed when we are not able to verify the SSO nonce due to an XML error or
|
||||
* failed validation. In either case, we prompt the user to try again or log in with username and password.
|
||||
*
|
||||
* @since 4.3.2
|
||||
*
|
||||
* @param $message
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public static function error_invalid_response_data( $message ) {
|
||||
$error = esc_html__(
|
||||
'There was an error logging you in via WordPress.com, please try again or try logging in with your username and password.',
|
||||
'jetpack'
|
||||
);
|
||||
$message .= sprintf( '<p class="message" id="login_error">%s</p>', $error );
|
||||
return $message;
|
||||
}
|
||||
|
||||
/**
|
||||
* Error message that is displayed when we were not able to automatically create an account for a user
|
||||
* after a user has logged in via SSO. By default, this message is triggered after trying to create an account 5 times.
|
||||
*
|
||||
* @since 4.3.2
|
||||
*
|
||||
* @param $message
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public static function error_unable_to_create_user( $message ) {
|
||||
$error = esc_html__(
|
||||
'There was an error creating a user for you. Please contact the administrator of your site.',
|
||||
'jetpack'
|
||||
);
|
||||
$message .= sprintf( '<p class="message" id="login_error">%s</p>', $error );
|
||||
return $message;
|
||||
}
|
||||
|
||||
/**
|
||||
* When the default login form is hidden, this method is called on the 'authenticate' filter with a priority of 30.
|
||||
* This method disables the ability to submit the default login form.
|
||||
*
|
||||
* @param $user
|
||||
*
|
||||
* @return WP_Error
|
||||
*/
|
||||
public static function disable_default_login_form( $user ) {
|
||||
if ( is_wp_error( $user ) ) {
|
||||
return $user;
|
||||
}
|
||||
|
||||
/**
|
||||
* Since we're returning an error that will be shown as a red notice, let's remove the
|
||||
* informational "blue" notice.
|
||||
*/
|
||||
remove_filter( 'login_message', array( 'Jetpack_SSO_Notices', 'msg_login_by_jetpack' ) );
|
||||
return new WP_Error( 'jetpack_sso_required', self::get_sso_required_message() );
|
||||
}
|
||||
|
||||
/**
|
||||
* Message displayed when the site admin has disabled the default WordPress
|
||||
* login form in Settings > General > Secure Sign On
|
||||
*
|
||||
* @since 2.7
|
||||
* @param string $message
|
||||
*
|
||||
* @return string
|
||||
**/
|
||||
public static function msg_login_by_jetpack( $message ) {
|
||||
$message .= sprintf( '<p class="message">%s</p>', self::get_sso_required_message() );
|
||||
return $message;
|
||||
}
|
||||
|
||||
public static function get_sso_required_message() {
|
||||
$msg = esc_html__(
|
||||
'A WordPress.com account is required to access this site. Click the button below to sign in or create a free WordPress.com account.',
|
||||
'jetpack'
|
||||
);
|
||||
|
||||
/**
|
||||
* Filter the message displayed when the default WordPress login form is disabled.
|
||||
*
|
||||
* @module sso
|
||||
*
|
||||
* @since 2.8.0
|
||||
*
|
||||
* @param string $msg Disclaimer when default WordPress login form is disabled.
|
||||
*/
|
||||
return apply_filters( 'jetpack_sso_disclaimer_message', $msg );
|
||||
}
|
||||
|
||||
/**
|
||||
* Message displayed when the user can not be found after approving the SSO process on WordPress.com
|
||||
*
|
||||
* @param string $message
|
||||
* @return string
|
||||
*/
|
||||
public static function cant_find_user( $message ) {
|
||||
$error = esc_html__(
|
||||
"We couldn't find your account. If you already have an account, make sure you have connected to WordPress.com.",
|
||||
'jetpack'
|
||||
);
|
||||
$message .= sprintf( '<p class="message" id="login_error">%s</p>', $error );
|
||||
|
||||
return $message;
|
||||
}
|
||||
|
||||
/**
|
||||
* Error message that is displayed when the current site is in an identity crisis and SSO can not be used.
|
||||
*
|
||||
* @since 4.4.0
|
||||
*
|
||||
* @param $message
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public static function sso_not_allowed_in_staging( $message ) {
|
||||
$error = esc_html__(
|
||||
'Logging in with WordPress.com is disabled for sites that are in staging mode.',
|
||||
'jetpack'
|
||||
);
|
||||
$message .= sprintf( '<p class="message">%s</p>', $error );
|
||||
return $message;
|
||||
}
|
||||
}
|
||||
|
||||
endif;
|
||||
177
wp-content/plugins/jetpack/modules/sso/jetpack-sso-login-rtl.css
Normal file
177
wp-content/plugins/jetpack/modules/sso/jetpack-sso-login-rtl.css
Normal file
@@ -0,0 +1,177 @@
|
||||
/* Do not modify this file directly. It is concatenated from individual module CSS files. */
|
||||
#loginform {
|
||||
/* We set !important because sometimes static is added inline */
|
||||
position: relative !important;
|
||||
padding-bottom: 92px;
|
||||
}
|
||||
|
||||
.jetpack-sso-repositioned #loginform {
|
||||
padding-bottom: 26px;
|
||||
}
|
||||
|
||||
#loginform #jetpack-sso-wrap,
|
||||
#loginform #jetpack-sso-wrap * {
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
|
||||
#jetpack-sso-wrap__action,
|
||||
#jetpack-sso-wrap__user{
|
||||
display: none;
|
||||
}
|
||||
|
||||
.jetpack-sso-form-display #jetpack-sso-wrap__action,
|
||||
.jetpack-sso-form-display #jetpack-sso-wrap__user {
|
||||
display: block;
|
||||
}
|
||||
|
||||
#jetpack-sso-wrap {
|
||||
position: absolute;
|
||||
bottom: 20px;
|
||||
padding: 0 24px;
|
||||
margin-right: -24px;
|
||||
margin-left: -24px;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.jetpack-sso-repositioned #jetpack-sso-wrap {
|
||||
position: relative;
|
||||
bottom: auto;
|
||||
padding: 0;
|
||||
margin-top: 16px;
|
||||
margin-right: 0;
|
||||
margin-left: 0;
|
||||
}
|
||||
|
||||
.jetpack-sso-form-display #jetpack-sso-wrap {
|
||||
position: relative;
|
||||
bottom: auto;
|
||||
padding: 0;
|
||||
margin-top: 0;
|
||||
margin-right: 0;
|
||||
margin-left: 0;
|
||||
}
|
||||
|
||||
#loginform #jetpack-sso-wrap p {
|
||||
color: #777777;
|
||||
margin-bottom: 16px;
|
||||
}
|
||||
|
||||
#jetpack-sso-wrap a {
|
||||
display: block;
|
||||
width: 100%;
|
||||
text-align: center;
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
#jetpack-sso-wrap .jetpack-sso-toggle.wpcom {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.jetpack-sso-form-display #jetpack-sso-wrap .jetpack-sso-toggle.wpcom {
|
||||
display: block;
|
||||
}
|
||||
|
||||
|
||||
.jetpack-sso-form-display #jetpack-sso-wrap .jetpack-sso-toggle.default {
|
||||
display: none;
|
||||
}
|
||||
|
||||
|
||||
.jetpack-sso-form-display #loginform > p,
|
||||
.jetpack-sso-form-display #loginform > div {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.jetpack-sso-form-display #loginform #jetpack-sso-wrap {
|
||||
display: block;
|
||||
}
|
||||
|
||||
.jetpack-sso-form-display #loginform {
|
||||
padding: 26px 24px;
|
||||
}
|
||||
|
||||
.jetpack-sso-or {
|
||||
margin-bottom: 16px;
|
||||
position: relative;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.jetpack-sso-or:before {
|
||||
background: #E5E5E5;
|
||||
content: '';
|
||||
height: 1px;
|
||||
position: absolute;
|
||||
right: 0;
|
||||
top: 50%;
|
||||
width: 100%;
|
||||
}
|
||||
.jetpack-sso-or span {
|
||||
background: #fff;
|
||||
color: #777;
|
||||
position: relative;
|
||||
padding: 0 8px;
|
||||
text-transform: uppercase
|
||||
}
|
||||
|
||||
.jetpack-sso.button {
|
||||
height: 36px;
|
||||
line-height: 34px;
|
||||
float: none;
|
||||
margin-bottom: 16px;
|
||||
position: relative;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.jetpack-sso.button > span {
|
||||
position: relative;
|
||||
padding-right: 30px;
|
||||
}
|
||||
|
||||
.jetpack-sso.button .genericon-wordpress {
|
||||
position: absolute;
|
||||
right: 0;
|
||||
top: -3px;
|
||||
font-size: 24px;
|
||||
}
|
||||
|
||||
@media screen and ( max-width: 782px ) {
|
||||
.jetpack-sso.button {
|
||||
line-height: 22px;
|
||||
}
|
||||
}
|
||||
|
||||
#jetpack-sso-wrap__user img {
|
||||
border-radius: 50%;
|
||||
display: block;
|
||||
margin: 0 auto 16px;
|
||||
}
|
||||
|
||||
#jetpack-sso-wrap__user h2 {
|
||||
font-size: 21px;
|
||||
font-weight: 300;
|
||||
margin-bottom: 16px;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
#jetpack-sso-wrap__user h2 span {
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
.jetpack-sso-wrap__reauth {
|
||||
margin-bottom: 16px;
|
||||
}
|
||||
|
||||
.jetpack-sso-form-display #nav {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.jetpack-sso-form-display #backtoblog {
|
||||
margin: 24px 0 0;
|
||||
}
|
||||
|
||||
.jetpack-sso-clear:after {
|
||||
content: "";
|
||||
display: table;
|
||||
clear: both;
|
||||
}
|
||||
1
wp-content/plugins/jetpack/modules/sso/jetpack-sso-login-rtl.min.css
vendored
Normal file
1
wp-content/plugins/jetpack/modules/sso/jetpack-sso-login-rtl.min.css
vendored
Normal file
@@ -0,0 +1 @@
|
||||
#loginform{position:relative!important;padding-bottom:92px}.jetpack-sso-repositioned #loginform{padding-bottom:26px}#loginform #jetpack-sso-wrap,#loginform #jetpack-sso-wrap *{box-sizing:border-box}#jetpack-sso-wrap__action,#jetpack-sso-wrap__user{display:none}.jetpack-sso-form-display #jetpack-sso-wrap__action,.jetpack-sso-form-display #jetpack-sso-wrap__user{display:block}#jetpack-sso-wrap{position:absolute;bottom:20px;padding:0 24px;margin-right:-24px;margin-left:-24px;width:100%}.jetpack-sso-repositioned #jetpack-sso-wrap{position:relative;bottom:auto;padding:0;margin-top:16px;margin-right:0;margin-left:0}.jetpack-sso-form-display #jetpack-sso-wrap{position:relative;bottom:auto;padding:0;margin-top:0;margin-right:0;margin-left:0}#loginform #jetpack-sso-wrap p{color:#777;margin-bottom:16px}#jetpack-sso-wrap a{display:block;width:100%;text-align:center;text-decoration:none}#jetpack-sso-wrap .jetpack-sso-toggle.wpcom{display:none}.jetpack-sso-form-display #jetpack-sso-wrap .jetpack-sso-toggle.wpcom{display:block}.jetpack-sso-form-display #jetpack-sso-wrap .jetpack-sso-toggle.default{display:none}.jetpack-sso-form-display #loginform>div,.jetpack-sso-form-display #loginform>p{display:none}.jetpack-sso-form-display #loginform #jetpack-sso-wrap{display:block}.jetpack-sso-form-display #loginform{padding:26px 24px}.jetpack-sso-or{margin-bottom:16px;position:relative;text-align:center}.jetpack-sso-or:before{background:#e5e5e5;content:'';height:1px;position:absolute;right:0;top:50%;width:100%}.jetpack-sso-or span{background:#fff;color:#777;position:relative;padding:0 8px;text-transform:uppercase}.jetpack-sso.button{height:36px;line-height:34px;float:none;margin-bottom:16px;position:relative;width:100%}.jetpack-sso.button>span{position:relative;padding-right:30px}.jetpack-sso.button .genericon-wordpress{position:absolute;right:0;top:-3px;font-size:24px}@media screen and (max-width:782px){.jetpack-sso.button{line-height:22px}}#jetpack-sso-wrap__user img{border-radius:50%;display:block;margin:0 auto 16px}#jetpack-sso-wrap__user h2{font-size:21px;font-weight:300;margin-bottom:16px;text-align:center}#jetpack-sso-wrap__user h2 span{font-weight:700}.jetpack-sso-wrap__reauth{margin-bottom:16px}.jetpack-sso-form-display #nav{display:none}.jetpack-sso-form-display #backtoblog{margin:24px 0 0}.jetpack-sso-clear:after{content:"";display:table;clear:both}
|
||||
176
wp-content/plugins/jetpack/modules/sso/jetpack-sso-login.css
Normal file
176
wp-content/plugins/jetpack/modules/sso/jetpack-sso-login.css
Normal file
@@ -0,0 +1,176 @@
|
||||
#loginform {
|
||||
/* We set !important because sometimes static is added inline */
|
||||
position: relative !important;
|
||||
padding-bottom: 92px;
|
||||
}
|
||||
|
||||
.jetpack-sso-repositioned #loginform {
|
||||
padding-bottom: 26px;
|
||||
}
|
||||
|
||||
#loginform #jetpack-sso-wrap,
|
||||
#loginform #jetpack-sso-wrap * {
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
|
||||
#jetpack-sso-wrap__action,
|
||||
#jetpack-sso-wrap__user{
|
||||
display: none;
|
||||
}
|
||||
|
||||
.jetpack-sso-form-display #jetpack-sso-wrap__action,
|
||||
.jetpack-sso-form-display #jetpack-sso-wrap__user {
|
||||
display: block;
|
||||
}
|
||||
|
||||
#jetpack-sso-wrap {
|
||||
position: absolute;
|
||||
bottom: 20px;
|
||||
padding: 0 24px;
|
||||
margin-left: -24px;
|
||||
margin-right: -24px;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.jetpack-sso-repositioned #jetpack-sso-wrap {
|
||||
position: relative;
|
||||
bottom: auto;
|
||||
padding: 0;
|
||||
margin-top: 16px;
|
||||
margin-left: 0;
|
||||
margin-right: 0;
|
||||
}
|
||||
|
||||
.jetpack-sso-form-display #jetpack-sso-wrap {
|
||||
position: relative;
|
||||
bottom: auto;
|
||||
padding: 0;
|
||||
margin-top: 0;
|
||||
margin-left: 0;
|
||||
margin-right: 0;
|
||||
}
|
||||
|
||||
#loginform #jetpack-sso-wrap p {
|
||||
color: #777777;
|
||||
margin-bottom: 16px;
|
||||
}
|
||||
|
||||
#jetpack-sso-wrap a {
|
||||
display: block;
|
||||
width: 100%;
|
||||
text-align: center;
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
#jetpack-sso-wrap .jetpack-sso-toggle.wpcom {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.jetpack-sso-form-display #jetpack-sso-wrap .jetpack-sso-toggle.wpcom {
|
||||
display: block;
|
||||
}
|
||||
|
||||
|
||||
.jetpack-sso-form-display #jetpack-sso-wrap .jetpack-sso-toggle.default {
|
||||
display: none;
|
||||
}
|
||||
|
||||
|
||||
.jetpack-sso-form-display #loginform > p,
|
||||
.jetpack-sso-form-display #loginform > div {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.jetpack-sso-form-display #loginform #jetpack-sso-wrap {
|
||||
display: block;
|
||||
}
|
||||
|
||||
.jetpack-sso-form-display #loginform {
|
||||
padding: 26px 24px;
|
||||
}
|
||||
|
||||
.jetpack-sso-or {
|
||||
margin-bottom: 16px;
|
||||
position: relative;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.jetpack-sso-or:before {
|
||||
background: #E5E5E5;
|
||||
content: '';
|
||||
height: 1px;
|
||||
position: absolute;
|
||||
left: 0;
|
||||
top: 50%;
|
||||
width: 100%;
|
||||
}
|
||||
.jetpack-sso-or span {
|
||||
background: #fff;
|
||||
color: #777;
|
||||
position: relative;
|
||||
padding: 0 8px;
|
||||
text-transform: uppercase
|
||||
}
|
||||
|
||||
.jetpack-sso.button {
|
||||
height: 36px;
|
||||
line-height: 34px;
|
||||
float: none;
|
||||
margin-bottom: 16px;
|
||||
position: relative;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.jetpack-sso.button > span {
|
||||
position: relative;
|
||||
padding-left: 30px;
|
||||
}
|
||||
|
||||
.jetpack-sso.button .genericon-wordpress {
|
||||
position: absolute;
|
||||
left: 0;
|
||||
top: -3px;
|
||||
font-size: 24px;
|
||||
}
|
||||
|
||||
@media screen and ( max-width: 782px ) {
|
||||
.jetpack-sso.button {
|
||||
line-height: 22px;
|
||||
}
|
||||
}
|
||||
|
||||
#jetpack-sso-wrap__user img {
|
||||
border-radius: 50%;
|
||||
display: block;
|
||||
margin: 0 auto 16px;
|
||||
}
|
||||
|
||||
#jetpack-sso-wrap__user h2 {
|
||||
font-size: 21px;
|
||||
font-weight: 300;
|
||||
margin-bottom: 16px;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
#jetpack-sso-wrap__user h2 span {
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
.jetpack-sso-wrap__reauth {
|
||||
margin-bottom: 16px;
|
||||
}
|
||||
|
||||
.jetpack-sso-form-display #nav {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.jetpack-sso-form-display #backtoblog {
|
||||
margin: 24px 0 0;
|
||||
}
|
||||
|
||||
.jetpack-sso-clear:after {
|
||||
content: "";
|
||||
display: table;
|
||||
clear: both;
|
||||
}
|
||||
32
wp-content/plugins/jetpack/modules/sso/jetpack-sso-login.js
Normal file
32
wp-content/plugins/jetpack/modules/sso/jetpack-sso-login.js
Normal file
@@ -0,0 +1,32 @@
|
||||
jQuery( document ).ready( function( $ ) {
|
||||
var body = $( 'body' ),
|
||||
toggleSSO = $( '.jetpack-sso-toggle' ),
|
||||
userLogin = $( '#user_login' ),
|
||||
ssoWrap = $( '#jetpack-sso-wrap' ),
|
||||
loginForm = $( '#loginform' ),
|
||||
overflow = $( '<div class="jetpack-sso-clear"></div>' );
|
||||
|
||||
// The overflow div is a poor man's clearfloat. We reposition the remember me
|
||||
// checkbox and the submit button within that to clear the float on the
|
||||
// remember me checkbox. This is important since we're positioning the SSO
|
||||
// UI under the submit button.
|
||||
//
|
||||
// @TODO: Remove this approach once core ticket 28528 is in and we have more actions in wp-login.php.
|
||||
// See - https://core.trac.wordpress.org/ticket/28528
|
||||
loginForm.append( overflow );
|
||||
overflow.append( $( 'p.forgetmenot' ), $( 'p.submit' ) );
|
||||
|
||||
// We reposition the SSO UI at the bottom of the login form which
|
||||
// fixes a tab order issue. Then we override any styles for absolute
|
||||
// positioning of the SSO UI.
|
||||
loginForm.append( ssoWrap );
|
||||
body.addClass( 'jetpack-sso-repositioned' );
|
||||
|
||||
toggleSSO.on( 'click', function( e ) {
|
||||
e.preventDefault();
|
||||
body.toggleClass( 'jetpack-sso-form-display' );
|
||||
if ( ! body.hasClass( 'jetpack-sso-form-display' ) ) {
|
||||
userLogin.focus();
|
||||
}
|
||||
} );
|
||||
} );
|
||||
2
wp-content/plugins/jetpack/modules/sso/jetpack-sso-login.min.css
vendored
Normal file
2
wp-content/plugins/jetpack/modules/sso/jetpack-sso-login.min.css
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
/* Do not modify this file directly. It is concatenated from individual module CSS files. */
|
||||
#loginform{position:relative!important;padding-bottom:92px}.jetpack-sso-repositioned #loginform{padding-bottom:26px}#loginform #jetpack-sso-wrap,#loginform #jetpack-sso-wrap *{box-sizing:border-box}#jetpack-sso-wrap__action,#jetpack-sso-wrap__user{display:none}.jetpack-sso-form-display #jetpack-sso-wrap__action,.jetpack-sso-form-display #jetpack-sso-wrap__user{display:block}#jetpack-sso-wrap{position:absolute;bottom:20px;padding:0 24px;margin-left:-24px;margin-right:-24px;width:100%}.jetpack-sso-repositioned #jetpack-sso-wrap{position:relative;bottom:auto;padding:0;margin-top:16px;margin-left:0;margin-right:0}.jetpack-sso-form-display #jetpack-sso-wrap{position:relative;bottom:auto;padding:0;margin-top:0;margin-left:0;margin-right:0}#loginform #jetpack-sso-wrap p{color:#777;margin-bottom:16px}#jetpack-sso-wrap a{display:block;width:100%;text-align:center;text-decoration:none}#jetpack-sso-wrap .jetpack-sso-toggle.wpcom{display:none}.jetpack-sso-form-display #jetpack-sso-wrap .jetpack-sso-toggle.wpcom{display:block}.jetpack-sso-form-display #jetpack-sso-wrap .jetpack-sso-toggle.default{display:none}.jetpack-sso-form-display #loginform>div,.jetpack-sso-form-display #loginform>p{display:none}.jetpack-sso-form-display #loginform #jetpack-sso-wrap{display:block}.jetpack-sso-form-display #loginform{padding:26px 24px}.jetpack-sso-or{margin-bottom:16px;position:relative;text-align:center}.jetpack-sso-or:before{background:#e5e5e5;content:'';height:1px;position:absolute;left:0;top:50%;width:100%}.jetpack-sso-or span{background:#fff;color:#777;position:relative;padding:0 8px;text-transform:uppercase}.jetpack-sso.button{height:36px;line-height:34px;float:none;margin-bottom:16px;position:relative;width:100%}.jetpack-sso.button>span{position:relative;padding-left:30px}.jetpack-sso.button .genericon-wordpress{position:absolute;left:0;top:-3px;font-size:24px}@media screen and (max-width:782px){.jetpack-sso.button{line-height:22px}}#jetpack-sso-wrap__user img{border-radius:50%;display:block;margin:0 auto 16px}#jetpack-sso-wrap__user h2{font-size:21px;font-weight:300;margin-bottom:16px;text-align:center}#jetpack-sso-wrap__user h2 span{font-weight:700}.jetpack-sso-wrap__reauth{margin-bottom:16px}.jetpack-sso-form-display #nav{display:none}.jetpack-sso-form-display #backtoblog{margin:24px 0 0}.jetpack-sso-clear:after{content:"";display:table;clear:both}
|
||||
Reference in New Issue
Block a user