From 19714d01e28ca9ba37564fe0ad48d81c665806dd Mon Sep 17 00:00:00 2001 From: Thais Siqueira Date: Fri, 10 Mar 2017 12:02:56 -0300 Subject: Validates recovery code as hexadecimal data. Related with https://github.com/pixelated/pixelated-user-agent/issues/924 With @aarni --- test/unit/user_test.rb | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'test') diff --git a/test/unit/user_test.rb b/test/unit/user_test.rb index 02e94df..e181765 100644 --- a/test/unit/user_test.rb +++ b/test/unit/user_test.rb @@ -28,6 +28,16 @@ class UserTest < ActiveSupport::TestCase assert !@user.valid? end + test "validates hex for recovery_code_verifier" do + @user.recovery_code_verifier = "1234567abcdef" + assert @user.valid? + end + + test "validates recovery_code_verifier with non hex chars" do + @user.recovery_code_verifier = "gkpq" + assert !@user.valid? + end + test "test require alphanumerical for login" do @user.login = "qw#r" assert !@user.valid? -- cgit v1.2.3