fix: don't allow setting pop timer past 120 mins

This commit is contained in:
insects 2025-03-12 14:20:15 +01:00
parent 6de594777a
commit b9bbc089c9

View file

@ -97,7 +97,7 @@ class InstanceController < ApplicationController
def adjust_pop
instance_id, nm, pwd = pop_instance_params
parent_instance = Instance.find_by(public_id: instance_id)
if params[:mins] && params[:pwd] == parent_instance.password
if params[:mins] && params[:mins].to_i < 120 && params[:pwd] == parent_instance.password
ts = Time.now.utc
pop = Pop.find_by(instance_id: parent_instance.id, name: nm)
pop.created_at = Time.at(ts - params[:mins].to_i.minutes).utc