Fixes #1974 - If fingerprint is an integer background job for verifying will fail.
This commit is contained in:
parent
3779ccc919
commit
fc43615554
2 changed files with 23 additions and 2 deletions
|
@ -236,7 +236,7 @@ check fingerprint string
|
||||||
|
|
||||||
def self.fingerprint_validation(fingerprint)
|
def self.fingerprint_validation(fingerprint)
|
||||||
return true if fingerprint.blank?
|
return true if fingerprint.blank?
|
||||||
raise Exceptions::UnprocessableEntity, "fingerprint is #{fingerprint.length} chars but can only be 160 chars!" if fingerprint.length > 160
|
raise Exceptions::UnprocessableEntity, "fingerprint is #{fingerprint.to_s.length} chars but can only be 160 chars!" if fingerprint.to_s.length > 160
|
||||||
true
|
true
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -506,7 +506,28 @@ class UserDeviceControllerTest < ActionDispatch::IntegrationTest
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
test '12 - login form controller - check no user device logging' do
|
test '12 - login with integer as fingerprint' do
|
||||||
|
|
||||||
|
assert_equal(0, UserDevice.where(user_id: @admin.id).count)
|
||||||
|
assert_equal(0, email_notification_count('user_device_new', @admin.email))
|
||||||
|
assert_equal(0, email_notification_count('user_device_new_location', @admin.email))
|
||||||
|
|
||||||
|
params = { fingerprint: 123_456_789, username: 'user-device-admin', password: 'adminpw' }
|
||||||
|
post '/api/v1/signin', params: params.to_json, headers: @headers
|
||||||
|
assert_response(201)
|
||||||
|
result = JSON.parse(@response.body)
|
||||||
|
assert(123_456_789, controller.session[:user_device_fingerprint])
|
||||||
|
|
||||||
|
Scheduler.worker(true)
|
||||||
|
|
||||||
|
assert_equal(1, UserDevice.where(user_id: @admin.id).count)
|
||||||
|
assert_equal(0, email_notification_count('user_device_new', @admin.email))
|
||||||
|
assert_equal(0, email_notification_count('user_device_new_location', @admin.email))
|
||||||
|
assert_equal(result.class, Hash)
|
||||||
|
assert_nil(result['error'])
|
||||||
|
end
|
||||||
|
|
||||||
|
test '13 - login form controller - check no user device logging' do
|
||||||
|
|
||||||
Setting.set('form_ticket_create', true)
|
Setting.set('form_ticket_create', true)
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue