1
0
mirror of https://github.com/laurent22/joplin.git synced 2024-12-24 10:27:10 +02:00

Tools: Use simpler test passwords

This commit is contained in:
Laurent Cozic 2022-04-12 17:06:53 +01:00
parent f24750f7b4
commit 55db877f85
8 changed files with 15 additions and 8 deletions

View File

@ -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"

View File

@ -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}`;

View File

@ -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

View File

@ -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) {

View File

@ -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<T> {
return this.config_.userContentBaseUrl;
}
protected get env(): Env {
return this.config_.env;
}
protected personalizedUserContentBaseUrl(userId: Uuid): string {
return personalizedUserContentBaseUrl(userId, this.baseUrl, this.userContentBaseUrl);
}

View File

@ -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<User> {
}
private validatePassword(password: string) {
if (this.env === Env.Dev) return;
const result = zxcvbn(password);
if (result.score < 3) {
let msg: string[] = [result.feedback.warning];

View File

@ -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();

View File

@ -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);