Skip to content

Commit fa327d7

Browse files
committed
Clean up decryption logic a bit
1 parent c384392 commit fa327d7

File tree

2 files changed

+2
-8
lines changed

2 files changed

+2
-8
lines changed

app/models/user.rb

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -43,10 +43,7 @@ def token=(value)
4343
end
4444

4545
def token
46-
encrypted_token = self[:token]
47-
unless encrypted_token.nil?
48-
crypt.decrypt_and_verify(encrypted_token)
49-
end
46+
crypt.decrypt_and_verify(self[:token]) if self[:token]
5047
end
5148

5249
def payment_gateway_subscription

app/models/violation.rb

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,7 @@ def source=(value)
2121
end
2222

2323
def source
24-
encrypted_source = self[:source]
25-
unless encrypted_source.nil?
26-
crypt.decrypt_and_verify(encrypted_source)
27-
end
24+
crypt.decrypt_and_verify(self[:source]) if self[:source]
2825
end
2926

3027
private

0 commit comments

Comments
 (0)