Commit 6dac4ec8 authored by Cool Fire's avatar Cool Fire

Gracefully handle lack of contact mail

parent a6bb4005
Pipeline #1405 passed with stage
in 2 minutes and 29 seconds
......@@ -105,7 +105,10 @@ class Manager2Api < Sinatra::Base
# Get contact mail for user
def mysql_get_contactmail(username)
mysql_get_record(username)['email']
record = mysql_get_record(username)
return record['email'] if record.key? 'email'
"#{username}@insomnia247.nl"
end
end
# rubocop:enable Metrics/BlockLength
......
......@@ -95,7 +95,7 @@ class Manager2Api < Sinatra::Base
erb :result, locals: {
message: 'Retreived contact email address',
result: mysql_get_record(user)['email']
result: mysql_get_contactmail(user)
}
end
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment