Allow pre-activation trial days to be configured

This commit is contained in:
Ben 2020-06-12 15:15:29 +01:00
parent 415ecca766
commit d25bfe4c98
2 changed files with 3 additions and 1 deletions

View File

@ -33,6 +33,8 @@ if __name__ == '__main__':
type=int) type=int)
login_group.add_argument('--login-failure-timer', action='store', default=3600, help='Timeout after flood limit', login_group.add_argument('--login-failure-timer', action='store', default=3600, help='Timeout after flood limit',
type=int) type=int)
login_group.add_argument('--preactivation-days', action='store', default=7, help='Preactivation trial days',
type=int)
login_group.add_argument('-S', '--staff', action='store_true', help='Staff-only server mode') login_group.add_argument('-S', '--staff', action='store_true', help='Staff-only server mode')
logging_group = parser.add_argument_group('logging') logging_group = parser.add_argument_group('logging')

View File

@ -64,7 +64,7 @@ async def handle_login(p, credentials: Credentials):
preactivation_hours = 0 preactivation_hours = 0
if not data.active: if not data.active:
preactivation_expiry = data.registration_date + timedelta(days=7) preactivation_expiry = data.registration_date + timedelta(days=p.server.config.preactivation_days)
preactivation_expiry = preactivation_expiry - datetime.now() preactivation_expiry = preactivation_expiry - datetime.now()
preactivation_hours = preactivation_expiry.total_seconds() // 3600 preactivation_hours = preactivation_expiry.total_seconds() // 3600
if preactivation_hours <= 0 or p.client_type == ClientType.Legacy: if preactivation_hours <= 0 or p.client_type == ClientType.Legacy: