feat: Deprecate PublicAPIRouter in favor of PagesRouter (#9526)
This commit is contained in:
@@ -414,8 +414,7 @@ module.exports.ParseServerOptions = {
|
||||
},
|
||||
pages: {
|
||||
env: 'PARSE_SERVER_PAGES',
|
||||
help:
|
||||
'The options for pages such as password reset and email verification. Caution, this is an experimental feature that may not be appropriate for production.',
|
||||
help: 'The options for pages such as password reset and email verification.',
|
||||
action: parsers.objectParser,
|
||||
type: 'PagesOptions',
|
||||
default: {},
|
||||
@@ -698,7 +697,7 @@ module.exports.PagesOptions = {
|
||||
enableRouter: {
|
||||
env: 'PARSE_SERVER_PAGES_ENABLE_ROUTER',
|
||||
help:
|
||||
'Is true if the pages router should be enabled; this is required for any of the pages options to take effect. Caution, this is an experimental feature that may not be appropriate for production.',
|
||||
'Is true if the pages router should be enabled; this is required for any of the pages options to take effect.',
|
||||
action: parsers.booleanParser,
|
||||
default: false,
|
||||
},
|
||||
|
||||
@@ -75,7 +75,7 @@
|
||||
* @property {String} mountPath Mount path for the server, defaults to /parse
|
||||
* @property {Boolean} mountPlayground Mounts the GraphQL Playground - never use this option in production
|
||||
* @property {Number} objectIdSize Sets the number of characters in generated object id's, default 10
|
||||
* @property {PagesOptions} pages The options for pages such as password reset and email verification. Caution, this is an experimental feature that may not be appropriate for production.
|
||||
* @property {PagesOptions} pages The options for pages such as password reset and email verification.
|
||||
* @property {PasswordPolicyOptions} passwordPolicy The password policy for enforcing password related rules.
|
||||
* @property {String} playgroundPath Mount path for the GraphQL Playground, defaults to /playground
|
||||
* @property {Number} port The port to run the ParseServer, defaults to 1337.
|
||||
@@ -131,7 +131,7 @@
|
||||
* @property {PagesRoute[]} customRoutes The custom routes.
|
||||
* @property {PagesCustomUrlsOptions} customUrls The URLs to the custom pages.
|
||||
* @property {Boolean} enableLocalization Is true if pages should be localized; this has no effect on custom page redirects.
|
||||
* @property {Boolean} enableRouter Is true if the pages router should be enabled; this is required for any of the pages options to take effect. Caution, this is an experimental feature that may not be appropriate for production.
|
||||
* @property {Boolean} enableRouter Is true if the pages router should be enabled; this is required for any of the pages options to take effect.
|
||||
* @property {Boolean} forceRedirect Is true if responses should always be redirects and never content, false if the response type should depend on the request type (GET request -> content response; POST request -> redirect response).
|
||||
* @property {String} localizationFallbackLocale The fallback locale for localization if no matching translation is provided for the given locale. This is only relevant when providing translation resources via JSON file.
|
||||
* @property {String} localizationJsonPath The path to the JSON file for localization; the translations will be used to fill template placeholders according to the locale.
|
||||
|
||||
@@ -217,7 +217,7 @@ export interface ParseServerOptions {
|
||||
/* Public URL to your parse server with http:// or https://.
|
||||
:ENV: PARSE_PUBLIC_SERVER_URL */
|
||||
publicServerURL: ?string;
|
||||
/* The options for pages such as password reset and email verification. Caution, this is an experimental feature that may not be appropriate for production.
|
||||
/* The options for pages such as password reset and email verification.
|
||||
:DEFAULT: {} */
|
||||
pages: ?PagesOptions;
|
||||
/* custom pages for password validation and reset
|
||||
@@ -377,7 +377,7 @@ export interface SecurityOptions {
|
||||
}
|
||||
|
||||
export interface PagesOptions {
|
||||
/* Is true if the pages router should be enabled; this is required for any of the pages options to take effect. Caution, this is an experimental feature that may not be appropriate for production.
|
||||
/* Is true if the pages router should be enabled; this is required for any of the pages options to take effect.
|
||||
:DEFAULT: false */
|
||||
enableRouter: ?boolean;
|
||||
/* Is true if pages should be localized; this has no effect on custom page redirects.
|
||||
|
||||
@@ -5,11 +5,19 @@ import path from 'path';
|
||||
import fs from 'fs';
|
||||
import qs from 'querystring';
|
||||
import { Parse } from 'parse/node';
|
||||
import Deprecator from '../Deprecator/Deprecator';
|
||||
|
||||
const public_html = path.resolve(__dirname, '../../public_html');
|
||||
const views = path.resolve(__dirname, '../../views');
|
||||
|
||||
export class PublicAPIRouter extends PromiseRouter {
|
||||
constructor() {
|
||||
super();
|
||||
Deprecator.logRuntimeDeprecation({
|
||||
usage: 'PublicAPIRouter',
|
||||
solution: 'pages.enableRouter'
|
||||
});
|
||||
}
|
||||
verifyEmail(req) {
|
||||
const { username, token: rawToken } = req.query;
|
||||
const token = rawToken && typeof rawToken !== 'string' ? rawToken.toString() : rawToken;
|
||||
|
||||
Reference in New Issue
Block a user