Skip to content

Commit e8db313

Browse files
author
Ethan Jon
committed
removed site password
1 parent ebdb742 commit e8db313

File tree

7 files changed

+8
-184
lines changed

7 files changed

+8
-184
lines changed

react/__tests__/components/site-password.test.js

Lines changed: 0 additions & 13 deletions
This file was deleted.

react/__tests__/stores/site-password.test.js

Lines changed: 0 additions & 6 deletions
This file was deleted.

react/components/site-password.js

Lines changed: 0 additions & 95 deletions
This file was deleted.

react/helpers/create-page.js

Lines changed: 7 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,10 @@ import EmailModal from '../components/modals/email'
1111
import Footer from '../components/footer'
1212
import Header from '../components/header'
1313
import LikeModal, {didLikeFBPageStoreKey} from '../components/modals/like'
14-
import SitePassword from '../components/site-password'
1514
import {getFetchHeaders, getWordpressUrl} from './fetch'
1615
import trackEvent from '../helpers/track-event'
1716
import HeaderStore from '../stores/header'
1817
import ModalStore from '../stores/modal'
19-
import SitePasswordStore from '../stores/site-password'
2018
import styles from '../styles/app.scss'
2119

2220
@observer
@@ -38,8 +36,7 @@ export default function (Child: Object, {propPaths = () => ({}), fullWidth = fal
3836
headerStore: MobxReactPropTypes.observableObject,
3937
likeModalStore: MobxReactPropTypes.observableObject,
4038
pagesData: PropTypes.array,
41-
siteData: PropTypes.object,
42-
sitePasswordStore: MobxReactPropTypes.observableObject
39+
siteData: PropTypes.object
4340
}
4441

4542
static async getInitialProps ({asPath, req, query}) {
@@ -91,17 +88,13 @@ export default function (Child: Object, {propPaths = () => ({}), fullWidth = fal
9188
headerStore: this.headerStore,
9289
likeModalStore: this.likeModalStore,
9390
pagesData: this.props.pagesData,
94-
siteData: this.props.siteData,
95-
sitePasswordStore: this.sitePasswordStore
91+
siteData: this.props.siteData
9692
})
9793

9894
componentWillMount () {
9995
this.emailModalStore = new ModalStore()
10096
this.headerStore = new HeaderStore()
10197
this.likeModalStore = new ModalStore()
102-
if (this.props.siteData.site_password_enabled) {
103-
this.sitePasswordStore = new SitePasswordStore()
104-
}
10598
}
10699

107100
componentDidMount () {
@@ -125,10 +118,8 @@ export default function (Child: Object, {propPaths = () => ({}), fullWidth = fal
125118
props: {
126119
fetchCache: Object,
127120
pagesData: Object,
128-
postsData: Object,
129121
siteData: Object
130122
}
131-
sitePasswordStore: Object
132123

133124
render () {
134125
return (
@@ -143,17 +134,11 @@ export default function (Child: Object, {propPaths = () => ({}), fullWidth = fal
143134
</div>
144135
</div>
145136

146-
{this.sitePasswordStore && !this.sitePasswordStore.isAuthorized &&
147-
(!this.props.postsData || !this.props.postsData[0] || !this.props.postsData[0]._formatting ||
148-
!this.props.postsData[0]._formatting.skip_site_password)
149-
? <SitePassword /> : (
150-
<main className={`${maxWidthClassName(this.props)} mx-auto`}>
151-
<div className={fullWidthClassName(this.props)}>
152-
<Child {...this.props} />
153-
</div>
154-
</main>
155-
)
156-
}
137+
<main className={`${maxWidthClassName(this.props)} mx-auto`}>
138+
<div className={fullWidthClassName(this.props)}>
139+
<Child {...this.props} />
140+
</div>
141+
</main>
157142

158143
<div className='max-width-3 mx-auto'>
159144
<div className='page-x-spacing'>

react/stores/site-password.js

Lines changed: 0 additions & 16 deletions
This file was deleted.

wordpress/themes/coderintros/inc/rest_api.php

Lines changed: 1 addition & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,7 @@ function formatting_callback () {
99
'hide_title' => get_field( 'hide_title' ),
1010
'hr_bottom' => get_field( 'hr_bottom' ),
1111
'hr_top' => get_field( 'hr_top' ),
12-
'no_incontent_units' => get_field( 'no_incontent_units' ),
13-
'skip_site_password' => get_field( 'skip_site_password' )
12+
'no_incontent_units' => get_field( 'no_incontent_units' )
1413
];
1514
}
1615

@@ -94,7 +93,6 @@ function formatting_callback () {
9493
'github_repo_url' => get_option( 'github_repo_url' ),
9594
'mailchimp_frequency_group' => get_option( 'mailchimp_frequency_group' ),
9695
'mailchimp_newsletter_url' => get_option( 'mailchimp_newsletter_url' ),
97-
'site_password_enabled' => ! empty( get_option( 'site_password' ) ),
9896
'sites' => []
9997
];
10098

@@ -114,22 +112,6 @@ function formatting_callback () {
114112
] );
115113
} );
116114

117-
// add a custom endpoint to validate site password
118-
add_action( 'rest_api_init', function () {
119-
register_rest_route( 'ci', '/site_password', [
120-
'methods' => 'POST',
121-
'callback' => function ( $request ) {
122-
if ( $request->get_body() != get_option( 'site_password' ) ) {
123-
return new WP_Error(
124-
'invalid_site_password',
125-
'Invalid site password',
126-
['status' => 401]
127-
);
128-
}
129-
}
130-
] );
131-
} );
132-
133115
// add endpoint to return questions from google sheets
134116
add_action( 'rest_api_init', function () {
135117
register_rest_route( 'ci', '/questions', [

wordpress/themes/coderintros/inc/settings.php

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111
register_setting( 'ci', 'github_repo_url' );
1212
register_setting( 'ci', 'mailchimp_frequency_group' );
1313
register_setting( 'ci', 'mailchimp_newsletter_url' );
14-
register_setting( 'ci', 'site_password' );
1514

1615
add_settings_section( 'ci_general', null, null, 'ci' );
1716

@@ -114,18 +113,6 @@ function () {
114113
'ci',
115114
'ci_general'
116115
);
117-
118-
add_settings_field(
119-
'site_password',
120-
'<label for="site_password">' . __( 'Password for Site Protection' , 'site_password' ) . '</label>',
121-
function () {
122-
$option = get_option('site_password');
123-
echo "<input id='site_password' name='site_password' type='text' class='regular-text code' value='{$option}' />";
124-
echo "<p class='description'>Require a password to view the front-end. Set to nothing to disable.</p>";
125-
},
126-
'ci',
127-
'ci_general'
128-
);
129116
} );
130117

131118
add_action( 'admin_menu', function () {

0 commit comments

Comments
 (0)