omniauth-scaffold 0.1.2 → 0.1.3

Sign up to get free protection for your applications and to get access to all the features.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.1.2
1
+ 0.1.3
@@ -26,6 +26,8 @@ module Omniauth
26
26
 
27
27
  remove_file 'public/index.html'
28
28
  copy_file "README.rdoc", "README.rdoc"
29
+
30
+ insert_into_file ".gitignore", "\n# Add\n.DS_Store\n/config/initializers/local_setting.rb\n", after: "/tmp\n"
29
31
  end
30
32
  end
31
33
  end
@@ -2,12 +2,44 @@
2
2
  class ApplicationController < ActionController::Base
3
3
 
4
4
  protect_from_forgery
5
-
5
+
6
+ # httpsリダイレクト
7
+ before_filter :ssl_redirect if Rails.env.production?
8
+
9
+ # 未ログインリダイレクト
10
+ before_filter :authorize
11
+
6
12
  # セッション有効期限延長
7
13
  before_filter :reset_session_expires
8
14
 
9
15
  private
10
-
16
+
17
+ #--------------#
18
+ # ssl_redirect #
19
+ #--------------#
20
+ # httpsへリダイレクト(Production環境のみ)
21
+ def ssl_redirect
22
+ unless request.env["HTTP_X_FORWARDED_PROTO"].to_s == "https"
23
+ request.env["HTTP_X_FORWARDED_PROTO"] = "https"
24
+
25
+ redirect_to request.url and return
26
+ end
27
+ end
28
+
29
+ #-----------#
30
+ # authorize #
31
+ #-----------#
32
+ # ログイン認証
33
+ def authorize
34
+ # セッション/トップコントローラ以外で
35
+ if params[:controller] != "sessions" and params[:controller] != "top"
36
+ # 未ログインであればルートヘリダイレクト
37
+ if session[:user_id].blank?
38
+ redirect_to :root and return
39
+ end
40
+ end
41
+ end
42
+
11
43
  #-----------------------#
12
44
  # reset_session_expires #
13
45
  #-----------------------#
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = "omniauth-scaffold"
8
- s.version = "0.1.2"
8
+ s.version = "0.1.3"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Shun Matsumoto"]
12
- s.date = "2012-04-26"
12
+ s.date = "2012-04-27"
13
13
  s.description = "Scaffold to use OmniAuth."
14
14
  s.email = "s.matsumoto0115@gmail.com"
15
15
  s.extra_rdoc_files = [
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: omniauth-scaffold
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2
4
+ version: 0.1.3
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-04-26 00:00:00.000000000 Z
12
+ date: 2012-04-27 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: omniauth-twitter
@@ -152,7 +152,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
152
152
  version: '0'
153
153
  segments:
154
154
  - 0
155
- hash: -3227694130415020159
155
+ hash: 1518802580756727504
156
156
  required_rubygems_version: !ruby/object:Gem::Requirement
157
157
  none: false
158
158
  requirements: