Skip to content

Commit 64d64b4

Browse files
committed
feat: add ability to disable strong password
1 parent 88f9a10 commit 64d64b4

File tree

21 files changed

+1733
-1555
lines changed

21 files changed

+1733
-1555
lines changed

app/package-lock.json

Lines changed: 1510 additions & 1510 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

app/package.json

Lines changed: 27 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,29 @@
11
{
2-
"name": "app",
3-
"version": "1.0.0",
4-
"description": "",
5-
"main": "index.js",
6-
"scripts": {
7-
"build": "rm -rf build && NODE_ENV=production node ./esbuild.config.js",
8-
"start": "NODE_ENV=development node ./esbuild.config.js"
9-
},
10-
"keywords": [],
11-
"author": "Lakhan Samani",
12-
"license": "ISC",
13-
"dependencies": {
14-
"@authorizerdev/authorizer-react": "^0.24.0",
15-
"@types/react": "^17.0.15",
16-
"@types/react-dom": "^17.0.9",
17-
"esbuild": "^0.12.17",
18-
"react": "^17.0.2",
19-
"react-dom": "^17.0.2",
20-
"react-is": "^17.0.2",
21-
"react-router-dom": "^5.2.0",
22-
"typescript": "^4.3.5",
23-
"styled-components": "^5.3.0"
24-
},
25-
"devDependencies": {
26-
"@types/react-router-dom": "^5.1.8",
27-
"@types/styled-components": "^5.1.11"
28-
}
2+
"name": "app",
3+
"version": "1.0.0",
4+
"description": "",
5+
"main": "index.js",
6+
"scripts": {
7+
"build": "rm -rf build && NODE_ENV=production node ./esbuild.config.js",
8+
"start": "NODE_ENV=development node ./esbuild.config.js"
9+
},
10+
"keywords": [],
11+
"author": "Lakhan Samani",
12+
"license": "ISC",
13+
"dependencies": {
14+
"@authorizerdev/authorizer-react": "^0.25.0",
15+
"@types/react": "^17.0.15",
16+
"@types/react-dom": "^17.0.9",
17+
"esbuild": "^0.12.17",
18+
"react": "^17.0.2",
19+
"react-dom": "^17.0.2",
20+
"react-is": "^17.0.2",
21+
"react-router-dom": "^5.2.0",
22+
"typescript": "^4.3.5",
23+
"styled-components": "^5.3.0"
24+
},
25+
"devDependencies": {
26+
"@types/react-router-dom": "^5.1.8",
27+
"@types/styled-components": "^5.1.11"
28+
}
2929
}

dashboard/package-lock.json

Lines changed: 8 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dashboard/src/components/EnvComponents/Features.tsx

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,18 @@ const Features = ({ variables, setVariables }: any) => {
7171
/>
7272
</Flex>
7373
</Flex>
74+
<Flex>
75+
<Flex w="100%" justifyContent="start" alignItems="center">
76+
<Text fontSize="sm">Disable Strong Password:</Text>
77+
</Flex>
78+
<Flex justifyContent="start" mb={3}>
79+
<InputField
80+
variables={variables}
81+
setVariables={setVariables}
82+
inputType={SwitchInputType.DISABLE_STRONG_PASSWORD}
83+
/>
84+
</Flex>
85+
</Flex>
7486
</Stack>
7587
</div>
7688
);

dashboard/src/constants.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,7 @@ export const SwitchInputType = {
6767
DISABLE_BASIC_AUTHENTICATION: 'DISABLE_BASIC_AUTHENTICATION',
6868
DISABLE_SIGN_UP: 'DISABLE_SIGN_UP',
6969
DISABLE_REDIS_FOR_ENV: 'DISABLE_REDIS_FOR_ENV',
70+
DISABLE_STRONG_PASSWORD: 'DISABLE_STRONG_PASSWORD',
7071
};
7172

7273
export const DateInputType = {
@@ -131,6 +132,7 @@ export interface envVarTypes {
131132
DISABLE_EMAIL_VERIFICATION: boolean;
132133
DISABLE_BASIC_AUTHENTICATION: boolean;
133134
DISABLE_SIGN_UP: boolean;
135+
DISABLE_STRONG_PASSWORD: boolean;
134136
OLD_ADMIN_SECRET: string;
135137
DATABASE_NAME: string;
136138
DATABASE_TYPE: string;

dashboard/src/graphql/queries/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ export const EnvVariablesQuery = `
5353
DISABLE_EMAIL_VERIFICATION,
5454
DISABLE_BASIC_AUTHENTICATION,
5555
DISABLE_SIGN_UP,
56+
DISABLE_STRONG_PASSWORD,
5657
DISABLE_REDIS_FOR_ENV,
5758
CUSTOM_ACCESS_TOKEN_SCRIPT,
5859
DATABASE_NAME,

dashboard/src/pages/Environment.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,7 @@ const Environment = () => {
7474
DISABLE_EMAIL_VERIFICATION: false,
7575
DISABLE_BASIC_AUTHENTICATION: false,
7676
DISABLE_SIGN_UP: false,
77+
DISABLE_STRONG_PASSWORD: false,
7778
OLD_ADMIN_SECRET: '',
7879
DATABASE_NAME: '',
7980
DATABASE_TYPE: '',

server/constants/env.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,8 @@ const (
115115
EnvKeyDisableSignUp = "DISABLE_SIGN_UP"
116116
// EnvKeyDisableRedisForEnv key for env variable DISABLE_REDIS_FOR_ENV
117117
EnvKeyDisableRedisForEnv = "DISABLE_REDIS_FOR_ENV"
118+
// EnvKeyDisableStrongPassword key for env variable DISABLE_STRONG_PASSWORD
119+
EnvKeyDisableStrongPassword = "DISABLE_STRONG_PASSWORD"
118120

119121
// Slice variables
120122
// EnvKeyRoles key for env variable ROLES

server/env/env.go

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,7 @@ func InitAllEnv() error {
8383
osDisableLoginPage := os.Getenv(constants.EnvKeyDisableLoginPage)
8484
osDisableSignUp := os.Getenv(constants.EnvKeyDisableSignUp)
8585
osDisableRedisForEnv := os.Getenv(constants.EnvKeyDisableRedisForEnv)
86+
osDisableStrongPassword := os.Getenv(constants.EnvKeyDisableStrongPassword)
8687

8788
// os slice vars
8889
osAllowedOrigins := os.Getenv(constants.EnvKeyAllowedOrigins)
@@ -476,6 +477,19 @@ func InitAllEnv() error {
476477
}
477478
}
478479

480+
if _, ok := envData[constants.EnvKeyDisableStrongPassword]; !ok {
481+
envData[constants.EnvKeyDisableStrongPassword] = osDisableStrongPassword == "true"
482+
}
483+
if osDisableStrongPassword != "" {
484+
boolValue, err := strconv.ParseBool(osDisableStrongPassword)
485+
if err != nil {
486+
return err
487+
}
488+
if boolValue != envData[constants.EnvKeyDisableStrongPassword].(bool) {
489+
envData[constants.EnvKeyDisableStrongPassword] = boolValue
490+
}
491+
}
492+
479493
// no need to add nil check as its already done above
480494
if envData[constants.EnvKeySmtpHost] == "" || envData[constants.EnvKeySmtpUsername] == "" || envData[constants.EnvKeySmtpPassword] == "" || envData[constants.EnvKeySenderEmail] == "" && envData[constants.EnvKeySmtpPort] == "" {
481495
envData[constants.EnvKeyDisableEmailVerification] = true

server/env/persist_env.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -198,7 +198,7 @@ func PersistEnv() error {
198198
envValue := strings.TrimSpace(os.Getenv(key))
199199
if envValue != "" {
200200
switch key {
201-
case constants.EnvKeyIsProd, constants.EnvKeyDisableBasicAuthentication, constants.EnvKeyDisableEmailVerification, constants.EnvKeyDisableLoginPage, constants.EnvKeyDisableMagicLinkLogin, constants.EnvKeyDisableSignUp, constants.EnvKeyDisableRedisForEnv:
201+
case constants.EnvKeyIsProd, constants.EnvKeyDisableBasicAuthentication, constants.EnvKeyDisableEmailVerification, constants.EnvKeyDisableLoginPage, constants.EnvKeyDisableMagicLinkLogin, constants.EnvKeyDisableSignUp, constants.EnvKeyDisableRedisForEnv, constants.EnvKeyDisableStrongPassword:
202202
if envValueBool, err := strconv.ParseBool(envValue); err == nil {
203203
if value.(bool) != envValueBool {
204204
storeData[key] = envValueBool

0 commit comments

Comments
 (0)