Add configurable minimum registration age

Introduce PF_MIN_REGISTRATION_AGE env var (config pixelfed.min_registration_age,
default 16) and replace hardcoded age values in the curated register flow,
safety tips, parental control invite form, and auth lang strings.

Refs pixelfed/pixelfed#7358
feature/configurable-min-registration-age
Your Name 6 days ago
parent 3988941f3f
commit 3e258f6f99

@ -8,6 +8,7 @@ APP_LOCALE="en-US"
OPEN_REGISTRATION="false"
ENFORCE_EMAIL_VERIFICATION="false"
PF_MAX_USERS="1000"
PF_MIN_REGISTRATION_AGE="16"
OAUTH_ENABLED="true"
OAUTH_PAT_ENABLED="false"
ENABLE_CONFIG_CACHE="true"

@ -129,6 +129,18 @@ return [
*/
'min_password_length' => env('MIN_PASSWORD_LENGTH', 8),
/*
|--------------------------------------------------------------------------
| Minimum registration age
|--------------------------------------------------------------------------
|
| The minimum age (in years) a user must be to register an account. This
| lets instance admins comply with the legislation of their jurisdiction.
| Defaults to 16.
|
*/
'min_registration_age' => (int) env('PF_MIN_REGISTRATION_AGE', 16),
/*
|--------------------------------------------------------------------------
| Album size limit

@ -18,7 +18,7 @@ return [
'username' => 'Username',
'confirm-password' => 'Confirm Password',
'age' => 'I am at least 16 years old',
'age' => 'I am at least '.(int) config('pixelfed.min_registration_age', 16).' years old',
'terms' => 'By signing up, you agree to our <a href="'.route('site.terms').'" class="font-weight-bold text-dark">Terms of Use</a> and <a href="'.route('site.privacy').'" class="font-weight-bold text-dark">Privacy Policy</a>.',
'emailAddress' => 'E-Mail Address',

@ -30,51 +30,17 @@ $id = Str::random(14);
@push('scripts')
<script>
const minAge = {{ (int) config('pixelfed.min_registration_age', 16) }};
function onSubmit() {
@if ($errors->any())
document.getElementById('{{$id}}').submit();
return;
@endif
swal({
text: "Please select the region you are located in",
icon: "info",
buttons: {
cancel: false,
usa: {
text: "United States",
className: "swal-button--cancel",
value: "usa"
},
uk: {
text: "UK",
className: "swal-button--cancel",
value: "uk"
},
eu: {
text: "EU",
className: "swal-button--cancel",
value: "eu"
},
other: {
text: "Other",
className: "swal-button--cancel",
value: "other"
}
},
dangerMode: false,
}).then((region) => {
handleRegion(region);
})
promptDateOfBirth();
}
function handleRegion(region) {
if(!region) {
return;
}
let minAge = 16;
if(['usa', 'uk', 'other'].includes(region)) {
minAge = 13;
}
function promptDateOfBirth() {
swal({
title: "Enter Your Date of Birth",
text: "We require your birthdate solely to confirm that you meet our age requirement.\n\n Rest assured, this information is not stored or used for any other purpose.",
@ -126,7 +92,7 @@ $id = Str::random(14);
} else {
swal({
title: "Ineligible to join",
text: `Sorry, you must be at least ${minAge} years old to join our service according to the laws of your country or region.`,
text: `Sorry, you must be at least ${minAge} years old to join this server.`,
icon: "error",
buttons: {
cancel: "I understand"

@ -84,7 +84,7 @@
<div class="form-check">
<input class="form-check-input" name="agecheck" type="checkbox" value="true" id="ageCheck" required>
<label class="form-check-label" for="ageCheck">
I am at least 16 years old
I am at least {{ (int) config('pixelfed.min_registration_age', 16) }} years old
</label>
</div>
</div>

@ -36,7 +36,7 @@
<div class="card border-left-blue mb-3">
<div class="card-body">
<p class="h5">Know the age guidelines</p>
<p class="mb-0">Please keep in mind that Pixelfed is meant for people over the age of 16 or 13 depending on where you live.</p>
<p class="mb-0">Please keep in mind that this server is meant for people who are at least {{ (int) config('pixelfed.min_registration_age', 16) }} years old.</p>
</div>
</div>

Loading…
Cancel
Save