From 3d2a0a060bc1080b7682685549f728934d5cb5f9 Mon Sep 17 00:00:00 2001 From: shawn-higgins1 <23224097+shawn-higgins1@users.noreply.github.com> Date: Wed, 21 Aug 2019 14:23:00 -0400 Subject: [PATCH] GRN2-225, GRN2-227: Images sent by Office365 Institutional accounts break the rooms (#753) * Validate profile image url * Add rake task to migrate old office365 accounts --- app/helpers/application_helper.rb | 8 ++++++ app/views/shared/_header.html.erb | 2 +- lib/tasks/migrate_old_office365_users.rake | 33 ++++++++++++++++++++++ 3 files changed, 42 insertions(+), 1 deletion(-) create mode 100644 lib/tasks/migrate_old_office365_users.rake diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index e1e901c2..42bcce1d 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -17,6 +17,7 @@ # with BigBlueButton; if not, see . require 'bbb_api' +require 'uri' require 'i18n/language/mapping' module ApplicationHelper @@ -139,4 +140,11 @@ module ApplicationHelper def google_analytics_url "https://www.googletagmanager.com/gtag/js?id=#{ENV['GOOGLE_ANALYTICS_TRACKING_ID']}" end + + def valid_url?(input) + uri = URI.parse(input) + !uri.host.nil? + rescue URI::InvalidURIError + false + end end diff --git a/app/views/shared/_header.html.erb b/app/views/shared/_header.html.erb index c8efbc60..069fa03a 100755 --- a/app/views/shared/_header.html.erb +++ b/app/views/shared/_header.html.erb @@ -44,7 +44,7 @@