mirror of
https://github.com/TryGhost/Ghost.git
synced 2025-01-04 17:04:59 +03:00
Added check for preview mode to allow mock pages
no issue - By default, we have guards to allow pages based on logged in state - For preview mode, we switch off this guard to allow signin/signup pages to open
This commit is contained in:
parent
df1952ba01
commit
9ac11c562e
@ -2,6 +2,7 @@ import AppContext from '../../AppContext';
|
||||
import MemberAvatar from '../common/MemberGravatar';
|
||||
import ActionButton from '../common/ActionButton';
|
||||
import Switch from '../common/Switch';
|
||||
import isPreviewMode from '../../utils/is-preview-mode';
|
||||
|
||||
const React = require('react');
|
||||
|
||||
@ -261,7 +262,7 @@ export default class AccountHomePage extends React.Component {
|
||||
|
||||
componentDidMount() {
|
||||
const {member} = this.context;
|
||||
if (!member) {
|
||||
if (!member && !isPreviewMode()) {
|
||||
this.context.onAction('switchPage', {
|
||||
page: 'signup'
|
||||
});
|
||||
|
@ -1,6 +1,7 @@
|
||||
import AppContext from '../../AppContext';
|
||||
import ActionButton from '../common/ActionButton';
|
||||
import PlansSection from '../common/PlansSection';
|
||||
import isPreviewMode from '../../utils/is-preview-mode';
|
||||
|
||||
const React = require('react');
|
||||
|
||||
@ -18,7 +19,7 @@ export default class AccountPlanPage extends React.Component {
|
||||
|
||||
componentDidMount() {
|
||||
const {member} = this.context;
|
||||
if (!member) {
|
||||
if (!member && !isPreviewMode()) {
|
||||
this.context.onAction('switchPage', {
|
||||
page: 'signup'
|
||||
});
|
||||
|
@ -3,6 +3,7 @@ import MemberAvatar from '../common/MemberGravatar';
|
||||
import ActionButton from '../common/ActionButton';
|
||||
import InputField from '../common/InputField';
|
||||
import Switch from '../common/Switch';
|
||||
import isPreviewMode from '../../utils/is-preview-mode';
|
||||
|
||||
const React = require('react');
|
||||
|
||||
@ -20,7 +21,7 @@ export default class AccountProfilePage extends React.Component {
|
||||
|
||||
componentDidMount() {
|
||||
const {member} = this.context;
|
||||
if (!member) {
|
||||
if (!member && !isPreviewMode()) {
|
||||
this.context.onAction('switchPage', {
|
||||
page: 'signup'
|
||||
});
|
||||
|
@ -1,6 +1,7 @@
|
||||
import ActionButton from '../common/ActionButton';
|
||||
import InputField from '../common/InputField';
|
||||
import AppContext from '../../AppContext';
|
||||
import isPreviewMode from '../../utils/is-preview-mode';
|
||||
|
||||
const React = require('react');
|
||||
|
||||
@ -16,7 +17,7 @@ export default class SigninPage extends React.Component {
|
||||
|
||||
componentDidMount() {
|
||||
const {member} = this.context;
|
||||
if (member) {
|
||||
if (member && !isPreviewMode()) {
|
||||
this.context.onAction('switchPage', {
|
||||
page: 'accountHome'
|
||||
});
|
||||
|
@ -2,6 +2,7 @@ import ActionButton from '../common/ActionButton';
|
||||
import InputField from '../common/InputField';
|
||||
import AppContext from '../../AppContext';
|
||||
import PlansSection from '../common/PlansSection';
|
||||
import isPreviewMode from '../../utils/is-preview-mode';
|
||||
|
||||
const React = require('react');
|
||||
|
||||
@ -19,7 +20,7 @@ class SignupPage extends React.Component {
|
||||
|
||||
componentDidMount() {
|
||||
const {member} = this.context;
|
||||
if (member) {
|
||||
if (member && !isPreviewMode()) {
|
||||
this.context.onAction('switchPage', {
|
||||
page: 'accountHome'
|
||||
});
|
||||
|
6
ghost/portal/src/utils/is-preview-mode.js
Normal file
6
ghost/portal/src/utils/is-preview-mode.js
Normal file
@ -0,0 +1,6 @@
|
||||
function isPreviewMode() {
|
||||
const [path, qs] = window.location.hash.substr(1).split('?');
|
||||
return (path === '/portal' && qs);
|
||||
}
|
||||
|
||||
export default isPreviewMode;
|
Loading…
Reference in New Issue
Block a user