feat: demo token
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
import { ApplicationGroup } from '@/ui_models/application_group';
|
||||
import { getPlatformString } from '@/utils';
|
||||
import { getPlatformString, getWindowUrlParams } from '@/utils';
|
||||
import { AppStateEvent, PanelResizedData } from '@/ui_models/app_state';
|
||||
import {
|
||||
ApplicationEvent,
|
||||
@@ -144,15 +144,12 @@ export class ApplicationView extends PureComponent<Props, State> {
|
||||
}
|
||||
|
||||
async handleDemoSignInFromParams() {
|
||||
if (
|
||||
window.location.href.includes('demo') &&
|
||||
!this.application.hasAccount()
|
||||
) {
|
||||
await this.application.setCustomHost(
|
||||
'https://syncing-server-demo.standardnotes.com'
|
||||
);
|
||||
this.application.signIn('demo@standardnotes.org', 'password');
|
||||
const token = getWindowUrlParams().get('demo-token');
|
||||
if (!token || this.application.hasAccount()) {
|
||||
return;
|
||||
}
|
||||
|
||||
await this.application.sessions.populateSessionFromDemoShareToken(token);
|
||||
}
|
||||
|
||||
presentPermissionsDialog = (dialog: PermissionDialog) => {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { WebApplication } from '@/ui_models/application';
|
||||
import { AppState } from '@/ui_models/app_state';
|
||||
import { isDesktopApplication } from '@/utils';
|
||||
import { getWindowUrlParams, isDesktopApplication } from '@/utils';
|
||||
import { observer } from 'mobx-react-lite';
|
||||
import { FunctionComponent } from 'preact';
|
||||
import { PurchaseFlowView } from './PurchaseFlowView';
|
||||
@@ -29,7 +29,7 @@ export const loadPurchaseFlowUrl = async (
|
||||
application: WebApplication
|
||||
): Promise<boolean> => {
|
||||
const url = await getPurchaseFlowUrl(application);
|
||||
const params = new URLSearchParams(window.location.search);
|
||||
const params = getWindowUrlParams();
|
||||
const period = params.get('period') ? `&period=${params.get('period')}` : '';
|
||||
const plan = params.get('plan') ? `&plan=${params.get('plan')}` : '';
|
||||
if (url) {
|
||||
|
||||
Reference in New Issue
Block a user