diff --git a/packages/app-cli/createUsers.sh b/packages/app-cli/createUsers.sh index 6eb733cef9..dd3eeb10e3 100755 --- a/packages/app-cli/createUsers.sh +++ b/packages/app-cli/createUsers.sh @@ -45,7 +45,7 @@ while [ "$NUM" -lt 400 ]; do echo "config keychain.supported 0" >> "$CMD_FILE" echo "config sync.target 10" >> "$CMD_FILE" echo "config sync.10.username $USER_EMAIL" >> "$CMD_FILE" - echo "config sync.10.password hunter1hunter2hunter3" >> "$CMD_FILE" + echo "config sync.10.password 111111" >> "$CMD_FILE" echo "sync" >> "$CMD_FILE" yarn start --profile "$PROFILE_DIR" batch "$CMD_FILE" diff --git a/packages/app-cli/tools/populateDatabase.ts b/packages/app-cli/tools/populateDatabase.ts index 2a4ddab282..9a8420dc68 100644 --- a/packages/app-cli/tools/populateDatabase.ts +++ b/packages/app-cli/tools/populateDatabase.ts @@ -44,7 +44,7 @@ const processUser = async (userNum: number) => { try { const userEmail = `user${userNum}@example.com`; - const userPassword = 'hunter1hunter2hunter3'; + const userPassword = '111111'; const commandFile = `${tempDir}/populateDatabase-${userNum}.txt`; const profileDir = `${homedir()}/.config/joplindev-populate/joplindev-testing-${userNum}`; diff --git a/packages/app-desktop/runForTesting.sh b/packages/app-desktop/runForTesting.sh index 106d047266..be59ffd154 100755 --- a/packages/app-desktop/runForTesting.sh +++ b/packages/app-desktop/runForTesting.sh @@ -92,7 +92,7 @@ do echo "config sync.target 10" >> "$CMD_FILE" # echo "config sync.10.path http://api.joplincloud.local:22300" >> "$CMD_FILE" echo "config sync.10.username $USER_EMAIL" >> "$CMD_FILE" - echo "config sync.10.password hunter1hunter2hunter3" >> "$CMD_FILE" + echo "config sync.10.password 111111" >> "$CMD_FILE" elif [[ $CMD == "e2ee" ]]; then diff --git a/packages/app-mobile/root.tsx b/packages/app-mobile/root.tsx index 0b58754473..5e6d3d226e 100644 --- a/packages/app-mobile/root.tsx +++ b/packages/app-mobile/root.tsx @@ -507,7 +507,7 @@ async function initialize(dispatch: Function) { // Setting.setValue('sync.target', 10); // Setting.setValue('sync.10.username', 'user1@example.com'); - // Setting.setValue('sync.10.password', 'hunter1hunter2hunter3'); + // Setting.setValue('sync.10.password', '111111'); } if (Setting.value('db.ftsEnabled') === -1) { diff --git a/packages/server/src/models/BaseModel.ts b/packages/server/src/models/BaseModel.ts index 00c80d4da0..625f63504c 100644 --- a/packages/server/src/models/BaseModel.ts +++ b/packages/server/src/models/BaseModel.ts @@ -5,7 +5,7 @@ import uuidgen from '../utils/uuidgen'; import { ErrorUnprocessableEntity, ErrorBadRequest } from '../utils/errors'; import { Models, NewModelFactoryHandler } from './factory'; import * as EventEmitter from 'events'; -import { Config } from '../utils/types'; +import { Config, Env } from '../utils/types'; import personalizedUserContentBaseUrl from '@joplin/lib/services/joplinServer/personalizedUserContentBaseUrl'; import Logger from '@joplin/lib/Logger'; import dbuuid from '../utils/dbuuid'; @@ -85,6 +85,10 @@ export default abstract class BaseModel { return this.config_.userContentBaseUrl; } + protected get env(): Env { + return this.config_.env; + } + protected personalizedUserContentBaseUrl(userId: Uuid): string { return personalizedUserContentBaseUrl(userId, this.baseUrl, this.userContentBaseUrl); } diff --git a/packages/server/src/models/UserModel.ts b/packages/server/src/models/UserModel.ts index 7f14378746..3062587bc0 100644 --- a/packages/server/src/models/UserModel.ts +++ b/packages/server/src/models/UserModel.ts @@ -27,6 +27,7 @@ import changeEmailConfirmationTemplate from '../views/emails/changeEmailConfirma import changeEmailNotificationTemplate from '../views/emails/changeEmailNotificationTemplate'; import { NotificationKey } from './NotificationModel'; import prettyBytes = require('pretty-bytes'); +import { Env } from '../utils/types'; const logger = Logger.create('UserModel'); @@ -237,6 +238,8 @@ export default class UserModel extends BaseModel { } private validatePassword(password: string) { + if (this.env === Env.Dev) return; + const result = zxcvbn(password); if (result.score < 3) { let msg: string[] = [result.feedback.warning]; diff --git a/packages/server/src/routes/admin/users.test.ts b/packages/server/src/routes/admin/users.test.ts index c2b445a0c6..9debd78f18 100644 --- a/packages/server/src/routes/admin/users.test.ts +++ b/packages/server/src/routes/admin/users.test.ts @@ -161,8 +161,8 @@ describe('admin/users', function() { await patchUser(session.id, { id: user.id, email: 'changed@example.com', - password: 'hunter11hunter22hunter33', - password2: 'hunter11hunter22hunter33', + password: '111111', + password2: '111111', }, '/admin/users/me'); const sessions = await models().session().all(); diff --git a/packages/server/src/tools/debugTools.ts b/packages/server/src/tools/debugTools.ts index 9865d5b35a..bab87a426d 100644 --- a/packages/server/src/tools/debugTools.ts +++ b/packages/server/src/tools/debugTools.ts @@ -33,7 +33,7 @@ export async function createTestUsers(db: DbConnection, config: Config, options: ...options, }; - const password = 'hunter1hunter2hunter3'; + const password = '111111'; const models = newModelFactory(db, config);