code input validation, lockout after 3 attempts

This commit is contained in:
Kyle Drake 2023-11-10 13:30:05 -06:00
parent 40e848e2c0
commit 7f05c2c9dc
3 changed files with 41 additions and 4 deletions

View file

@ -329,6 +329,13 @@ post '/site/:username/confirm_phone' do
end
current_site.phone_verification_sent_at = Time.now
current_site.phone_verification_attempts += 1
if current_site.phone_verification_attempts > Site::PHONE_VERIFICATION_LOCKOUT_ATTEMPTS
flash[:error] = 'You have exceeded the number of phone verification attempts allowed.'
redirect "/site/#{current_site.username}/confirm_phone"
end
current_site.save_changes validate: false
verification = $twilio.verify