# HG changeset patch # User bsw # Date 1536048499 -7200 # Node ID 5f26df65672fa20286bb7de9a3e30ca5e0dbdc79 # Parent 09f50a44cb7d529a45e98b8257ab2cac00621afa Allow configuration of minimum age diff -r 09f50a44cb7d -r 5f26df65672f app/main/registration/_action/register.lua --- a/app/main/registration/_action/register.lua Thu Aug 30 10:57:39 2018 +0200 +++ b/app/main/registration/_action/register.lua Tue Sep 04 10:08:19 2018 +0200 @@ -127,11 +127,12 @@ errors = errors + 1 end local today = atom.date:get_current() - local date_16y_ago = atom.date:new{ year = today.year - 16, month = today.month, day = today.day } - if date_16y_ago.invalid and today.month == 2 and today.day == 29 then - date_16y_ago = atom.date:new{ year = today.year - 16, month = 2, day = 28 } + local min_age = config.self_registration.min_age or 16 + local date_nyears_ago = atom.date:new{ year = today.year - min_age, month = today.month, day = today.day } + if date_nyears_ago.invalid and today.month == 2 and today.day == 29 then + date_nyears_ago = atom.date:new{ year = today.year - min_age, month = 2, day = 28 } end - if date > date_16y_ago then + if date > date_nyears_ago then request.redirect{ external = encode.url { module = "registration", view = "register_rejected_age" } } return end