diff options
author | Starfall <us@starfall.systems> | 2020-12-10 18:39:04 -0600 |
---|---|---|
committer | Starfall <us@starfall.systems> | 2020-12-10 18:39:04 -0600 |
commit | ab127fd7941b7c84e6d6fe3071d41f52affb143c (patch) | |
tree | 7daabe20eb581a2b9215ed9c4f161bcab89019bd /app/validators/registration_form_time_validator.rb | |
parent | e68391fbaaf409cc01f74c8cf7076520a43ae06e (diff) | |
parent | 4acb5c90a271779a050c4d3b54562bd29359e5c0 (diff) |
Merge branch 'glitch' into main
Diffstat (limited to 'app/validators/registration_form_time_validator.rb')
-rw-r--r-- | app/validators/registration_form_time_validator.rb | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/app/validators/registration_form_time_validator.rb b/app/validators/registration_form_time_validator.rb new file mode 100644 index 000000000..ba7c7e6c6 --- /dev/null +++ b/app/validators/registration_form_time_validator.rb @@ -0,0 +1,9 @@ +# frozen_string_literal: true + +class RegistrationFormTimeValidator < ActiveModel::Validator + REGISTRATION_FORM_MIN_TIME = 3.seconds.freeze + + def validate(user) + user.errors.add(:base, I18n.t('auth.too_fast')) if user.registration_form_time.present? && user.registration_form_time > REGISTRATION_FORM_MIN_TIME.ago + end +end |