1
0
mirror of https://github.com/danbee/danbarberphoto synced 2025-03-04 08:49:07 +00:00

Add warning if not on an SSL connection.

This commit is contained in:
Dan Barber 2014-03-07 10:53:09 +00:00
parent 2b4a72f28e
commit 34baa4bb48
2 changed files with 12 additions and 1 deletions

View File

@ -1,3 +1,12 @@
class Admin::SessionsController < ::Devise::SessionsController
layout "admin/layouts/login"
end
before_filter :check_https
private
def check_https
secure_link = url_for(protocol: 'https')
flash[:alert] = I18n.t('insecure_alert', secure_link: secure_link).html_safe unless request.scheme == 'https'
end
end

View File

@ -5,3 +5,5 @@ en:
contact:
thanks: Thanks for your email, I'll be in touch as soon as possible.
invalid: Please fill in fields marked in red.
insecure_alert: You are on an insecure connection. Sign in will not work. <a href="%{secure_link}">Switch</a>.