' . esc_html__( 'You are signed in, but this site is only for the team using it.', 'nodebook' ) . '

' . esc_html__( 'Sign out', 'nodebook' ) . '

', esc_html( get_bloginfo( 'name' ) ), array( 'response' => 403 ) ); } wp_safe_redirect( wp_login_url() ); exit; } /** Search engines: stay out of everything. */ public static function robots_txt() { return "User-agent: *\nDisallow: /\n"; } public static function wp_robots( $robots ) { $robots['noindex'] = true; $robots['nofollow'] = true; unset( $robots['max-image-preview'] ); return $robots; } /** Without signing in, WordPress's user list is not shown (it would list the team's names). */ public static function rest_endpoints( $endpoints ) { if ( is_user_logged_in() ) { return $endpoints; } foreach ( array_keys( $endpoints ) as $route ) { if ( 0 === strpos( $route, '/wp/v2/users' ) ) { unset( $endpoints[ $route ] ); } } return $endpoints; } public static function login_headers() { header( 'X-Robots-Tag: noindex, nofollow' ); } public static function login_url() { return wp_login_url(); } public static function login_text() { return get_bloginfo( 'name' ); } /** "Sign in to Your Business" above the form; WordPress's own messages (wrong password, logged out) stay. */ public static function login_message( $message ) { $action = isset( $_REQUEST['action'] ) ? sanitize_key( wp_unslash( $_REQUEST['action'] ) ) : 'login'; // phpcs:ignore WordPress.Security.NonceVerification.Recommended -- which screen of wp-login.php, display only. if ( 'login' !== $action ) { return $message; } return '

' . esc_html( /* translators: %s: site name */ sprintf( __( 'Sign in to %s', 'nodebook' ), get_bloginfo( 'name' ) ) ) . '

' . $message; } /** * People who use Nodebook land on Today, unless they were on their way somewhere else. * * @param string $to Where WordPress would send them. * @param string $requested What the sign-in link asked for. * @param WP_User|WP_Error $user Who signed in. */ public static function login_redirect( $to, $requested, $user ) { if ( ! $user instanceof WP_User || ! $user->has_cap( Nodebook_Admin::cap() ) ) { return $to; } $requested = (string) $requested; if ( '' === $requested || admin_url() === $requested || admin_url( '/' ) === $requested || home_url( '/' ) === $requested || home_url() === $requested ) { return Nodebook_Admin::url( 'nodebook-today' ); } return $to; } /** The sign-in page in Nodebook's look. */ public static function login_style() { $css = 'body.login{background:#f2f2f7;font-family:-apple-system,BlinkMacSystemFont,"SF Pro Text","Segoe UI",Inter,Roboto,"Helvetica Neue",Arial,sans-serif;color:#1c1c1e;-webkit-font-smoothing:antialiased}' . '#login{width:360px;max-width:calc(100% - 32px);padding:12vh 0 0}' . '.login h1 a{background:#1c1c1e;width:64px;height:64px;border-radius:16px;margin:0 auto 18px;display:flex;align-items:center;justify-content:center;text-indent:0;overflow:hidden;font-size:0;box-shadow:0 8px 24px rgba(0,0,0,.18)}' . '.login h1 a::after{content:"N";color:#fff;font-size:30px;font-weight:800;line-height:1}' . '.nb-login-title{margin:0 0 18px;text-align:center;font-size:24px;font-weight:700;letter-spacing:-.02em;color:#1c1c1e}' . '.login form{margin-top:0;padding:24px;border:0;border-radius:20px;background:#fff;box-shadow:0 1px 2px rgba(0,0,0,.04),0 10px 30px rgba(0,0,0,.06)}' . '.login label{font-size:13px;font-weight:600;color:#1c1c1e}' . '.login form .input,.login input[type=text],.login input[type=password],.login input[type=email]{min-height:44px;margin:4px 0 16px;padding:0 12px;border:1px solid #d1d1d6;border-radius:10px;font-size:16px;box-shadow:none;background:#fff}' . '.login form .input:focus,.login input:focus{border-color:#0071e3;box-shadow:0 0 0 3px rgba(0,113,227,.22);outline:0}' . '.login .button.wp-hide-pw{min-height:44px;color:#6e6e73}' . '.login .button-primary,.wp-core-ui .button-primary{float:none;display:block;width:100%;min-height:44px;margin-top:16px;border:0;border-radius:999px;background:#0071e3;color:#fff;font-size:15px;font-weight:600;text-shadow:none;box-shadow:none}' . '.login .button-primary:hover,.login .button-primary:focus{background:#0062c4}' . '.login .forgetmenot{float:none;margin:0}.login .forgetmenot label{font-weight:500}' . '.login input[type=checkbox]{border-radius:6px}' . '.login #nav{text-align:center;margin:18px 0 0;padding:0}.login #nav a{color:#0071e3;text-decoration:none;font-size:14px}' . '.login #backtoblog,.login .privacy-policy-page-link{display:none}' . '.login .message,.login .notice,.login #login_error{border:0;border-radius:14px;box-shadow:0 1px 2px rgba(0,0,0,.04),0 6px 20px rgba(0,0,0,.045);margin-bottom:16px}' . '.login #login_error{background:#ffe5e7;color:#b4232f}.login .message,.login .notice-info,.login .success{background:#e8f0fe;color:#0058b0}' . '.login a:focus{box-shadow:0 0 0 3px rgba(0,113,227,.22)}'; wp_add_inline_style( 'login', $css ); } }