Merge pull request #1782 from LemmyNet/password_min_length

Set a 10 char minimum password length.
This commit is contained in:
Nutomic 2021-09-20 10:02:30 +00:00 committed by GitHub
commit 1e7f3a4b23
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 16 additions and 14 deletions

View File

@ -76,34 +76,36 @@ export let epsilon: API = {
client: new LemmyHttp('http://localhost:8581'), client: new LemmyHttp('http://localhost:8581'),
}; };
const password = 'lemmylemmy'
export async function setupLogins() { export async function setupLogins() {
let formAlpha: Login = { let formAlpha: Login = {
username_or_email: 'lemmy_alpha', username_or_email: 'lemmy_alpha',
password: 'lemmy', password,
}; };
let resAlpha = alpha.client.login(formAlpha); let resAlpha = alpha.client.login(formAlpha);
let formBeta = { let formBeta = {
username_or_email: 'lemmy_beta', username_or_email: 'lemmy_beta',
password: 'lemmy', password,
}; };
let resBeta = beta.client.login(formBeta); let resBeta = beta.client.login(formBeta);
let formGamma = { let formGamma = {
username_or_email: 'lemmy_gamma', username_or_email: 'lemmy_gamma',
password: 'lemmy', password,
}; };
let resGamma = gamma.client.login(formGamma); let resGamma = gamma.client.login(formGamma);
let formDelta = { let formDelta = {
username_or_email: 'lemmy_delta', username_or_email: 'lemmy_delta',
password: 'lemmy', password,
}; };
let resDelta = delta.client.login(formDelta); let resDelta = delta.client.login(formDelta);
let formEpsilon = { let formEpsilon = {
username_or_email: 'lemmy_epsilon', username_or_email: 'lemmy_epsilon',
password: 'lemmy', password,
}; };
let resEpsilon = epsilon.client.login(formEpsilon); let resEpsilon = epsilon.client.login(formEpsilon);
@ -510,8 +512,8 @@ export async function registerUser(
): Promise<LoginResponse> { ): Promise<LoginResponse> {
let form: Register = { let form: Register = {
username, username,
password: 'test', password,
password_verify: 'test', password_verify: password,
show_nsfw: true, show_nsfw: true,
}; };
return api.client.register(form); return api.client.register(form);

View File

@ -426,7 +426,7 @@ pub async fn build_federated_instances(
/// Checks the password length /// Checks the password length
pub fn password_length_check(pass: &str) -> Result<(), LemmyError> { pub fn password_length_check(pass: &str) -> Result<(), LemmyError> {
if pass.len() > 60 { if !(10..=60).contains(&pass.len()) {
Err(ApiError::err("invalid_password").into()) Err(ApiError::err("invalid_password").into())
} else { } else {
Ok(()) Ok(())

View File

@ -5,7 +5,7 @@
jwt_secret: changeme jwt_secret: changeme
setup: { setup: {
admin_username: lemmy_alpha admin_username: lemmy_alpha
admin_password: lemmy admin_password: lemmylemmy
site_name: lemmy-alpha site_name: lemmy-alpha
sidebar: alphas sidebar sidebar: alphas sidebar
} }

View File

@ -5,7 +5,7 @@
jwt_secret: changeme jwt_secret: changeme
setup: { setup: {
admin_username: lemmy_beta admin_username: lemmy_beta
admin_password: lemmy admin_password: lemmylemmy
site_name: lemmy-beta site_name: lemmy-beta
} }
database: { database: {

View File

@ -5,7 +5,7 @@
jwt_secret: changeme jwt_secret: changeme
setup: { setup: {
admin_username: lemmy_delta admin_username: lemmy_delta
admin_password: lemmy admin_password: lemmylemmy
site_name: lemmy-delta site_name: lemmy-delta
} }
database: { database: {

View File

@ -5,7 +5,7 @@
jwt_secret: changeme jwt_secret: changeme
setup: { setup: {
admin_username: lemmy_epsilon admin_username: lemmy_epsilon
admin_password: lemmy admin_password: lemmylemmy
site_name: lemmy-epsilon site_name: lemmy-epsilon
} }
database: { database: {

View File

@ -5,7 +5,7 @@
jwt_secret: changeme jwt_secret: changeme
setup: { setup: {
admin_username: lemmy_gamma admin_username: lemmy_gamma
admin_password: lemmy admin_password: lemmylemmy
site_name: lemmy-gamma site_name: lemmy-gamma
} }
database: { database: {

View File

@ -6,7 +6,7 @@
# username for the admin user # username for the admin user
admin_username: "lemmy" admin_username: "lemmy"
# password for the admin user # password for the admin user
admin_password: "lemmy" admin_password: "lemmylemmy"
# name of the site (can be changed later) # name of the site (can be changed later)
site_name: "lemmy-test" site_name: "lemmy-test"
} }