oa-core 0.2.0.beta5 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
data/lib/omniauth/core.rb CHANGED
@@ -98,7 +98,8 @@ module OmniAuth
98
98
  'tripit' => 'TripIt',
99
99
  'soundcloud' => 'SoundCloud',
100
100
  'smugmug' => 'SmugMug',
101
- 'cas' => 'CAS'
101
+ 'cas' => 'CAS',
102
+ 'trademe' => 'TradeMe'
102
103
  }
103
104
 
104
105
  module_function
data/lib/omniauth/form.rb CHANGED
@@ -72,12 +72,28 @@ module OmniAuth
72
72
  display: block;
73
73
  margin: 20px auto 0;
74
74
  }
75
+
76
+ fieldset {
77
+ border: 1px solid #ccc;
78
+ border-left: 0;
79
+ border-right: 0;
80
+ padding: 10px 0;
81
+ }
82
+
83
+ fieldset input {
84
+ width: 260px;
85
+ font-size: 16px;
86
+ }
75
87
  CSS
76
88
 
77
- def initialize(title=nil)
78
- title ||= "Authentication Info Required"
89
+ attr_accessor :options
90
+
91
+ def initialize(options = {})
92
+ options[:title] ||= "Authentication Info Required"
93
+ self.options = options
94
+
79
95
  @html = ""
80
- header(title)
96
+ header(options[:title])
81
97
  end
82
98
 
83
99
  def self.build(title=nil, &block)
@@ -106,6 +122,21 @@ module OmniAuth
106
122
  input_field('password', name)
107
123
  self
108
124
  end
125
+
126
+ def button(text)
127
+ @html << "\n<button type='submit'>#{text}</button>"
128
+ end
129
+
130
+ def html(html)
131
+ @html << html
132
+ end
133
+
134
+ def fieldset(legend, options = {}, &block)
135
+ @html << "\n<fieldset#{" style='#{options[:style]}'" if options[:style]}#{" id='#{options[:id]}'" if options[:id]}>\n <legend>#{legend}</legend>\n"
136
+ self.instance_eval &block
137
+ @html << "\n</fieldset>"
138
+ self
139
+ end
109
140
 
110
141
  def header(title)
111
142
  @html << <<-HTML
@@ -117,7 +148,7 @@ module OmniAuth
117
148
  </head>
118
149
  <body>
119
150
  <h1>#{title}</h1>
120
- <form method='post' noValidate='noValidate'>
151
+ <form method='post' #{"action='#{options[:url]}' " if options[:url]}noValidate='noValidate'>
121
152
  HTML
122
153
  self
123
154
  end
@@ -35,7 +35,11 @@ module OmniAuth
35
35
  if response = call_through_to_app
36
36
  response
37
37
  else
38
- env['rack.session']['omniauth.origin'] = env['HTTP_REFERER']
38
+ if request.params['origin']
39
+ env['rack.session']['omniauth.origin'] = request.params['origin']
40
+ elsif env['HTTP_REFERER'] && !env['HTTP_REFERER'].match(/#{request_path}$/)
41
+ env['rack.session']['omniauth.origin'] = env['HTTP_REFERER']
42
+ end
39
43
  request_phase
40
44
  end
41
45
  elsif current_path == callback_path
@@ -108,7 +112,7 @@ module OmniAuth
108
112
  end
109
113
 
110
114
  def current_path
111
- request.path.downcase.sub(/\/$/,'')
115
+ request.path_info.downcase.sub(/\/$/,'')
112
116
  end
113
117
 
114
118
  def query_string
@@ -140,17 +144,21 @@ module OmniAuth
140
144
  when Proc
141
145
  OmniAuth.config.full_host.call(env)
142
146
  else
143
- uri = URI.parse(request.url)
147
+ uri = URI.parse(request.url.gsub(/\?.*$/,''))
144
148
  uri.path = ''
145
149
  uri.query = nil
146
150
  uri.to_s
147
151
  end
148
152
  end
149
-
153
+
150
154
  def callback_url
151
- full_host + callback_path + query_string
155
+ full_host + script_name + callback_path + query_string
152
156
  end
153
-
157
+
158
+ def script_name
159
+ @env['SCRIPT_NAME'] || ''
160
+ end
161
+
154
162
  def session
155
163
  @env['rack.session']
156
164
  end
metadata CHANGED
@@ -1,8 +1,8 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: oa-core
3
3
  version: !ruby/object:Gem::Version
4
- prerelease: 6
5
- version: 0.2.0.beta5
4
+ prerelease:
5
+ version: 0.2.0
6
6
  platform: ruby
7
7
  authors:
8
8
  - Michael Bleigh
@@ -10,7 +10,7 @@ autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
12
 
13
- date: 2011-03-01 00:00:00 -06:00
13
+ date: 2011-03-11 00:00:00 -06:00
14
14
  default_executable:
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
@@ -90,6 +90,17 @@ dependencies:
90
90
  type: :development
91
91
  prerelease: false
92
92
  version_requirements: *id007
93
+ - !ruby/object:Gem::Dependency
94
+ name: evernote
95
+ requirement: &id008 !ruby/object:Gem::Requirement
96
+ none: false
97
+ requirements:
98
+ - - ~>
99
+ - !ruby/object:Gem::Version
100
+ version: 0.9.0
101
+ type: :development
102
+ prerelease: false
103
+ version_requirements: *id008
93
104
  description: HTTP Basic strategies for OmniAuth.
94
105
  email: michael@intridea.com
95
106
  executables: []
@@ -124,16 +135,19 @@ required_ruby_version: !ruby/object:Gem::Requirement
124
135
  requirements:
125
136
  - - ">="
126
137
  - !ruby/object:Gem::Version
127
- hash: -2207262758413508228
138
+ hash: -2071655923572517505
128
139
  segments:
129
140
  - 0
130
141
  version: "0"
131
142
  required_rubygems_version: !ruby/object:Gem::Requirement
132
143
  none: false
133
144
  requirements:
134
- - - ">"
145
+ - - ">="
135
146
  - !ruby/object:Gem::Version
136
- version: 1.3.1
147
+ hash: -2071655923572517505
148
+ segments:
149
+ - 0
150
+ version: "0"
137
151
  requirements: []
138
152
 
139
153
  rubyforge_project: