fix: Signup text update & code optimisation (#11606)
* text change for signup admin settings & code optimized * minor change
This commit is contained in:
parent
e0e0fc8346
commit
1688757bc6
|
|
@ -44,6 +44,7 @@ module.exports = {
|
|||
enableGithubOAuth: parseConfig("__APPSMITH_OAUTH2_GITHUB_CLIENT_ID__"),
|
||||
disableLoginForm: parseConfig("__APPSMITH_FORM_LOGIN_DISABLED__"),
|
||||
disableSignup: parseConfig("__APPSMITH_SIGNUP_DISABLED__"),
|
||||
disableTelemetry: parseConfig("__APPSMITH_DISABLE_TELEMETRY__"),
|
||||
enableRapidAPI: parseConfig("__APPSMITH_MARKETPLACE_ENABLED__"),
|
||||
segment: {
|
||||
apiKey: parseConfig("__APPSMITH_SEGMENT_KEY__"),
|
||||
|
|
|
|||
|
|
@ -195,6 +195,7 @@
|
|||
enableGithubOAuth: parseConfig("__APPSMITH_OAUTH2_GITHUB_CLIENT_ID__"),
|
||||
disableLoginForm: parseConfig("__APPSMITH_FORM_LOGIN_DISABLED__"),
|
||||
disableSignup: parseConfig("__APPSMITH_SIGNUP_DISABLED__"),
|
||||
disableTelemetry: parseConfig("__APPSMITH_DISABLE_TELEMETRY__"),
|
||||
enableRapidAPI: parseConfig("__APPSMITH_MARKETPLACE_ENABLED__"),
|
||||
segment: {
|
||||
apiKey: parseConfig("__APPSMITH_SEGMENT_KEY__"),
|
||||
|
|
|
|||
|
|
@ -17,6 +17,7 @@ export interface INJECTED_CONFIGS {
|
|||
enableGithubOAuth: boolean;
|
||||
disableLoginForm: boolean;
|
||||
disableSignup: boolean;
|
||||
disableTelemetry: boolean;
|
||||
enableRapidAPI: boolean;
|
||||
segment: {
|
||||
apiKey: string;
|
||||
|
|
@ -77,6 +78,9 @@ export const getConfigsFromEnvVars = (): INJECTED_CONFIGS => {
|
|||
disableSignup: process.env.APPSMITH_SIGNUP_DISABLED
|
||||
? process.env.APPSMITH_SIGNUP_DISABLED.length > 0
|
||||
: false,
|
||||
disableTelemetry: process.env.APPSMITH_DISABLE_TELEMETRY
|
||||
? process.env.APPSMITH_DISABLE_TELEMETRY.length > 0
|
||||
: true,
|
||||
segment: {
|
||||
apiKey: process.env.REACT_APP_SEGMENT_KEY || "",
|
||||
ceKey: process.env.REACT_APP_SEGMENT_CE_KEY || "",
|
||||
|
|
@ -246,6 +250,8 @@ export const getAppsmithConfigs = (): AppsmithUIConfigs => {
|
|||
ENV_CONFIG.disableLoginForm || APPSMITH_FEATURE_CONFIGS.disableLoginForm,
|
||||
disableSignup:
|
||||
ENV_CONFIG.disableSignup || APPSMITH_FEATURE_CONFIGS.disableSignup,
|
||||
disableTelemetry:
|
||||
ENV_CONFIG.disableTelemetry || APPSMITH_FEATURE_CONFIGS.disableTelemetry,
|
||||
enableGoogleOAuth:
|
||||
ENV_CONFIG.enableGoogleOAuth ||
|
||||
APPSMITH_FEATURE_CONFIGS.enableGoogleOAuth,
|
||||
|
|
|
|||
|
|
@ -46,6 +46,7 @@ export interface AppsmithUIConfigs {
|
|||
enableGithubOAuth: boolean;
|
||||
disableLoginForm: boolean;
|
||||
disableSignup: boolean;
|
||||
disableTelemetry: boolean;
|
||||
enableMixpanel: boolean;
|
||||
enableTNCPP: boolean;
|
||||
|
||||
|
|
|
|||
|
|
@ -6,6 +6,7 @@ import {
|
|||
} from "constants/ThirdPartyConstants";
|
||||
import {
|
||||
SettingCategories,
|
||||
SettingSubCategories,
|
||||
SettingTypes,
|
||||
SettingSubtype,
|
||||
AdminConfigType,
|
||||
|
|
@ -34,7 +35,7 @@ const Form_Auth: AdminConfigType = {
|
|||
{
|
||||
id: "APPSMITH_FORM_LOGIN_DISABLED",
|
||||
category: SettingCategories.FORM_AUTH,
|
||||
subCategory: "form login",
|
||||
subCategory: SettingSubCategories.FORMLOGIN,
|
||||
controlType: SettingTypes.TOGGLE,
|
||||
label: "Form Login Option",
|
||||
toggleText: (value: boolean) => {
|
||||
|
|
@ -48,12 +49,12 @@ const Form_Auth: AdminConfigType = {
|
|||
{
|
||||
id: "APPSMITH_SIGNUP_DISABLED",
|
||||
category: SettingCategories.FORM_AUTH,
|
||||
subCategory: "form signup",
|
||||
subCategory: SettingSubCategories.FORMLOGIN,
|
||||
controlType: SettingTypes.TOGGLE,
|
||||
label: "Signup",
|
||||
toggleText: (value: boolean) => {
|
||||
if (value) {
|
||||
return "Allow only invited users to signup";
|
||||
return "Restrict Signups";
|
||||
} else {
|
||||
return " Allow all users to signup";
|
||||
}
|
||||
|
|
@ -62,7 +63,7 @@ const Form_Auth: AdminConfigType = {
|
|||
{
|
||||
id: "APPSMITH_FORM_CALLOUT_BANNER",
|
||||
category: SettingCategories.FORM_AUTH,
|
||||
subCategory: "form signup",
|
||||
subCategory: SettingSubCategories.FORMLOGIN,
|
||||
controlType: SettingTypes.LINK,
|
||||
label:
|
||||
"User emails are not verified. This can lead to a breach in your application.",
|
||||
|
|
@ -83,7 +84,7 @@ const Google_Auth: AdminConfigType = {
|
|||
{
|
||||
id: "APPSMITH_OAUTH2_GOOGLE_READ_MORE",
|
||||
category: SettingCategories.GOOGLE_AUTH,
|
||||
subCategory: "google signup",
|
||||
subCategory: SettingSubCategories.GOOGLE,
|
||||
controlType: SettingTypes.LINK,
|
||||
label: "How to configure?",
|
||||
url: GOOGLE_SIGNUP_SETUP_DOC,
|
||||
|
|
@ -91,7 +92,7 @@ const Google_Auth: AdminConfigType = {
|
|||
{
|
||||
id: "APPSMITH_OAUTH2_GOOGLE_CLIENT_ID",
|
||||
category: SettingCategories.GOOGLE_AUTH,
|
||||
subCategory: "google signup",
|
||||
subCategory: SettingSubCategories.GOOGLE,
|
||||
controlType: SettingTypes.TEXTINPUT,
|
||||
controlSubType: SettingSubtype.TEXT,
|
||||
label: "Client ID",
|
||||
|
|
@ -99,7 +100,7 @@ const Google_Auth: AdminConfigType = {
|
|||
{
|
||||
id: "APPSMITH_OAUTH2_GOOGLE_CLIENT_SECRET",
|
||||
category: SettingCategories.GOOGLE_AUTH,
|
||||
subCategory: "google signup",
|
||||
subCategory: SettingSubCategories.GOOGLE,
|
||||
controlType: SettingTypes.TEXTINPUT,
|
||||
controlSubType: SettingSubtype.TEXT,
|
||||
label: "Client Secret",
|
||||
|
|
@ -107,7 +108,7 @@ const Google_Auth: AdminConfigType = {
|
|||
{
|
||||
id: "APPSMITH_SIGNUP_ALLOWED_DOMAINS",
|
||||
category: SettingCategories.GOOGLE_AUTH,
|
||||
subCategory: "google signup",
|
||||
subCategory: SettingSubCategories.GOOGLE,
|
||||
controlType: SettingTypes.TEXTINPUT,
|
||||
controlSubType: SettingSubtype.TEXT,
|
||||
label: "Allowed Domains",
|
||||
|
|
@ -128,7 +129,7 @@ const Github_Auth: AdminConfigType = {
|
|||
{
|
||||
id: "APPSMITH_OAUTH2_GITHUB_READ_MORE",
|
||||
category: SettingCategories.GITHUB_AUTH,
|
||||
subCategory: "github signup",
|
||||
subCategory: SettingSubCategories.GITHUB,
|
||||
controlType: SettingTypes.LINK,
|
||||
label: "How to configure?",
|
||||
url: GITHUB_SIGNUP_SETUP_DOC,
|
||||
|
|
@ -136,7 +137,7 @@ const Github_Auth: AdminConfigType = {
|
|||
{
|
||||
id: "APPSMITH_OAUTH2_GITHUB_CLIENT_ID",
|
||||
category: SettingCategories.GITHUB_AUTH,
|
||||
subCategory: "github signup",
|
||||
subCategory: SettingSubCategories.GITHUB,
|
||||
controlType: SettingTypes.TEXTINPUT,
|
||||
controlSubType: SettingSubtype.TEXT,
|
||||
label: "Client ID",
|
||||
|
|
@ -144,7 +145,7 @@ const Github_Auth: AdminConfigType = {
|
|||
{
|
||||
id: "APPSMITH_OAUTH2_GITHUB_CLIENT_SECRET",
|
||||
category: SettingCategories.GITHUB_AUTH,
|
||||
subCategory: "github signup",
|
||||
subCategory: SettingSubCategories.GITHUB,
|
||||
controlType: SettingTypes.TEXTINPUT,
|
||||
controlSubType: SettingSubtype.TEXT,
|
||||
label: "Client Secret",
|
||||
|
|
|
|||
|
|
@ -71,6 +71,12 @@ export const SettingCategories = {
|
|||
GITHUB_AUTH: "github-auth",
|
||||
};
|
||||
|
||||
export const SettingSubCategories = {
|
||||
GOOGLE: "google signup",
|
||||
GITHUB: "github signup",
|
||||
FORMLOGIN: "form login",
|
||||
};
|
||||
|
||||
export type AdminConfigType = {
|
||||
type: string;
|
||||
controlType: SettingTypes;
|
||||
|
|
|
|||
|
|
@ -11,18 +11,21 @@ export const connectedMethods = [
|
|||
!disableLoginForm,
|
||||
].filter(Boolean);
|
||||
|
||||
/* settings is the updated & unsaved settings on Admin settings page */
|
||||
export const saveAllowed = (settings: any) => {
|
||||
if (
|
||||
connectedMethods.length >= 2 ||
|
||||
(connectedMethods.length === 1 &&
|
||||
((!("APPSMITH_FORM_LOGIN_DISABLED" in settings) && !disableLoginForm) ||
|
||||
(settings["APPSMITH_OAUTH2_GOOGLE_CLIENT_ID"] !== "" &&
|
||||
enableGoogleOAuth) ||
|
||||
(settings["APPSMITH_OAUTH2_GITHUB_CLIENT_ID"] !== "" &&
|
||||
enableGithubOAuth)))
|
||||
) {
|
||||
return true;
|
||||
if (connectedMethods.length === 1) {
|
||||
const checkFormLogin = !(
|
||||
"APPSMITH_FORM_LOGIN_DISABLED" in settings || disableLoginForm
|
||||
),
|
||||
checkGoogleAuth =
|
||||
settings["APPSMITH_OAUTH2_GOOGLE_CLIENT_ID"] !== "" &&
|
||||
enableGoogleOAuth,
|
||||
checkGithubAuth =
|
||||
settings["APPSMITH_OAUTH2_GITHUB_CLIENT_ID"] !== "" &&
|
||||
enableGithubOAuth;
|
||||
|
||||
return checkFormLogin || checkGoogleAuth || checkGithubAuth;
|
||||
} else {
|
||||
return false;
|
||||
return connectedMethods.length >= 2;
|
||||
}
|
||||
};
|
||||
|
|
|
|||
|
|
@ -6,7 +6,8 @@ import { FormGroup, SettingComponentProps } from "./Common";
|
|||
export default function TextInput({ setting }: SettingComponentProps) {
|
||||
return (
|
||||
<FormGroup
|
||||
className={`t--admin-settings-text-input t--admin-settings-${setting.name}`}
|
||||
className={`t--admin-settings-text-input t--admin-settings-${setting.name ||
|
||||
setting.id}`}
|
||||
setting={setting}
|
||||
>
|
||||
<FormTextField
|
||||
|
|
|
|||
|
|
@ -193,9 +193,9 @@ export function SettingsForm(
|
|||
const validate = (values: Record<string, any>) => {
|
||||
const errors: any = {};
|
||||
_.filter(values, (value, name) => {
|
||||
const message = AdminConfig.validate(name, value);
|
||||
if (message) {
|
||||
errors[name] = message;
|
||||
const err_message = AdminConfig.validate(name, value);
|
||||
if (err_message) {
|
||||
errors[name] = err_message;
|
||||
}
|
||||
});
|
||||
return errors;
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@ export const config: AdminConfigType = {
|
|||
settings: [
|
||||
{
|
||||
id: "APPSMITH_MONGODB_URI",
|
||||
category: "advanced",
|
||||
category: SettingCategories.ADVANCED,
|
||||
controlType: SettingTypes.TEXTINPUT,
|
||||
controlSubType: SettingSubtype.TEXT,
|
||||
label: "MongoDB URI",
|
||||
|
|
@ -21,7 +21,7 @@ export const config: AdminConfigType = {
|
|||
},
|
||||
{
|
||||
id: "APPSMITH_REDIS_URL",
|
||||
category: "advanced",
|
||||
category: SettingCategories.ADVANCED,
|
||||
controlType: SettingTypes.TEXTINPUT,
|
||||
controlSubType: SettingSubtype.TEXT,
|
||||
label: "Redis URL",
|
||||
|
|
@ -30,7 +30,7 @@ export const config: AdminConfigType = {
|
|||
},
|
||||
{
|
||||
id: "APPSMITH_CUSTOM_DOMAIN",
|
||||
category: "advanced",
|
||||
category: SettingCategories.ADVANCED,
|
||||
controlType: SettingTypes.TEXTINPUT,
|
||||
controlSubType: SettingSubtype.TEXT,
|
||||
label: "Custom Domain",
|
||||
|
|
|
|||
|
|
@ -21,14 +21,14 @@ export const config: AdminConfigType = {
|
|||
settings: [
|
||||
{
|
||||
id: "APPSMITH_MAIL_READ_MORE",
|
||||
category: "email",
|
||||
category: SettingCategories.EMAIL,
|
||||
controlType: SettingTypes.LINK,
|
||||
label: "How to configure?",
|
||||
url: EMAIL_SETUP_DOC,
|
||||
},
|
||||
{
|
||||
id: "APPSMITH_MAIL_HOST",
|
||||
category: "email",
|
||||
category: SettingCategories.EMAIL,
|
||||
controlType: SettingTypes.TEXTINPUT,
|
||||
controlSubType: SettingSubtype.TEXT,
|
||||
label: "SMTP Host",
|
||||
|
|
@ -36,7 +36,7 @@ export const config: AdminConfigType = {
|
|||
},
|
||||
{
|
||||
id: "APPSMITH_MAIL_PORT",
|
||||
category: "email",
|
||||
category: SettingCategories.EMAIL,
|
||||
controlType: SettingTypes.TEXTINPUT,
|
||||
controlSubType: SettingSubtype.NUMBER,
|
||||
placeholder: "25",
|
||||
|
|
@ -50,7 +50,7 @@ export const config: AdminConfigType = {
|
|||
},
|
||||
{
|
||||
id: "APPSMITH_MAIL_FROM",
|
||||
category: "email",
|
||||
category: SettingCategories.EMAIL,
|
||||
controlType: SettingTypes.TEXTINPUT,
|
||||
controlSubType: SettingSubtype.TEXT,
|
||||
label: "From Address",
|
||||
|
|
@ -65,13 +65,13 @@ export const config: AdminConfigType = {
|
|||
},
|
||||
{
|
||||
id: "APPSMITH_MAIL_SMTP_TLS_ENABLED",
|
||||
category: "email",
|
||||
category: SettingCategories.EMAIL,
|
||||
controlType: SettingTypes.TOGGLE,
|
||||
label: "TLS Protected Connection",
|
||||
},
|
||||
{
|
||||
id: "APPSMITH_MAIL_USERNAME",
|
||||
category: "email",
|
||||
category: SettingCategories.EMAIL,
|
||||
controlType: SettingTypes.TEXTINPUT,
|
||||
controlSubType: SettingSubtype.TEXT,
|
||||
label: "SMTP Username",
|
||||
|
|
@ -81,7 +81,7 @@ export const config: AdminConfigType = {
|
|||
},
|
||||
{
|
||||
id: "APPSMITH_MAIL_PASSWORD",
|
||||
category: "email",
|
||||
category: SettingCategories.EMAIL,
|
||||
controlType: SettingTypes.TEXTINPUT,
|
||||
controlSubType: SettingSubtype.PASSWORD,
|
||||
label: "SMTP Password",
|
||||
|
|
@ -91,7 +91,7 @@ export const config: AdminConfigType = {
|
|||
},
|
||||
{
|
||||
id: "APPSMITH_MAIL_TEST_EMAIL",
|
||||
category: "email",
|
||||
category: SettingCategories.EMAIL,
|
||||
action: (dispatch: Dispatch<ReduxAction<any>>, settings: any = {}) => {
|
||||
dispatch &&
|
||||
dispatch({
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@ export const config: AdminConfigType = {
|
|||
settings: [
|
||||
{
|
||||
id: "APPSMITH_INSTANCE_NAME",
|
||||
category: "general",
|
||||
category: SettingCategories.GENERAL,
|
||||
controlType: SettingTypes.TEXTINPUT,
|
||||
controlSubType: SettingSubtype.TEXT,
|
||||
label: "Instance Name",
|
||||
|
|
@ -24,7 +24,7 @@ export const config: AdminConfigType = {
|
|||
},
|
||||
{
|
||||
id: "APPSMITH_ADMIN_EMAILS",
|
||||
category: "general",
|
||||
category: SettingCategories.GENERAL,
|
||||
controlType: SettingTypes.TEXTINPUT,
|
||||
controlSubType: SettingSubtype.EMAIL,
|
||||
label: "Admin Email",
|
||||
|
|
@ -51,14 +51,14 @@ export const config: AdminConfigType = {
|
|||
"_blank",
|
||||
);
|
||||
},
|
||||
category: "general",
|
||||
category: SettingCategories.GENERAL,
|
||||
controlType: SettingTypes.BUTTON,
|
||||
label: "Generated Docker Compose File",
|
||||
text: "Download",
|
||||
},
|
||||
{
|
||||
id: "APPSMITH_DISABLE_TELEMETRY",
|
||||
category: "general",
|
||||
category: SettingCategories.GENERAL,
|
||||
controlType: SettingTypes.TOGGLE,
|
||||
label: "Disable Sharing Anonymous Usage Data",
|
||||
subText: "Share anonymous usage data to help improve the product",
|
||||
|
|
@ -66,7 +66,7 @@ export const config: AdminConfigType = {
|
|||
if (value) {
|
||||
return "Don't share any data";
|
||||
} else {
|
||||
return "Share data & make appsmith better!";
|
||||
return "Share Anonymous Telemetry";
|
||||
}
|
||||
},
|
||||
},
|
||||
|
|
|
|||
|
|
@ -14,14 +14,14 @@ export const config: AdminConfigType = {
|
|||
settings: [
|
||||
{
|
||||
id: "APPSMITH_GOOGLE_MAPS_READ_MORE",
|
||||
category: "google-maps",
|
||||
category: SettingCategories.GOOGLE_MAPS,
|
||||
controlType: SettingTypes.LINK,
|
||||
label: "How to configure?",
|
||||
url: GOOGLE_MAPS_SETUP_DOC,
|
||||
},
|
||||
{
|
||||
id: "APPSMITH_GOOGLE_MAPS_API_KEY",
|
||||
category: "google-maps",
|
||||
category: SettingCategories.GOOGLE_MAPS,
|
||||
controlType: SettingTypes.TEXTINPUT,
|
||||
controlSubType: SettingSubtype.TEXT,
|
||||
label: "Google Maps API Key",
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@ export const config: AdminConfigType = {
|
|||
settings: [
|
||||
{
|
||||
id: "APPSMITH_CURRENT_VERSION",
|
||||
category: "version",
|
||||
category: SettingCategories.VERSION,
|
||||
controlType: SettingTypes.TEXT,
|
||||
label: "Current version",
|
||||
},
|
||||
|
|
@ -27,7 +27,7 @@ export const config: AdminConfigType = {
|
|||
payload: true,
|
||||
});
|
||||
},
|
||||
category: "version",
|
||||
category: SettingCategories.VERSION,
|
||||
controlType: SettingTypes.LINK,
|
||||
label: "Release Notes",
|
||||
},
|
||||
|
|
|
|||
|
|
@ -133,7 +133,7 @@ function* SendTestEmail(action: ReduxAction<SendTestEmailPayload>) {
|
|||
});
|
||||
} catch (e) {
|
||||
Toaster.show({
|
||||
text: createMessage(TEST_EMAIL_FAILURE),
|
||||
text: e?.message || createMessage(TEST_EMAIL_FAILURE),
|
||||
hideProgressBar: true,
|
||||
variant: Variant.danger,
|
||||
});
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user