omniauth-standalone 0.2.0 → 0.2.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 5730d8155c0ebf13a45dc5020cafc37e17dae3da
4
- data.tar.gz: 7211e284b25825cfdc60f181f64c4e05fce2da06
3
+ metadata.gz: 0e537aad21d51049ed7cb9002b7d57076b3e04d7
4
+ data.tar.gz: 9fd89e3600a90d61ea07bd28ed1d49966641370c
5
5
  SHA512:
6
- metadata.gz: 6c85057b9278119a8225b0dab2d2c16ebee87b0636b25270d93195ba23124f634b0488e430c64176b2843168767e8ca7031d6be34dd60e5cc085d3e83eae2e98
7
- data.tar.gz: fd7a1a5f0ff9199b50a9da1d33adf7a527f2c3f25ec65c9aa42818a8b8ce886f8e937029fc895ef1724d8a5244ad4108bdc9d16b7475f8cbf230c87bfb543f15
6
+ metadata.gz: 94fc8a3cc4cc19fdc8b3e388ccdc59e65336d93a7aa0dbaf407581bea7877cea3ae0bf05ca0af08d72a611c68c69ab66f9614827becc99a8335a7a58286eb661
7
+ data.tar.gz: bd8dcc897de4beabf16400a6a0c62fda7f68173f859502c103754c5f0f959be46f4d8c799474f9f2991281317c54ced39356630388707388b58a79893d880a02
@@ -1,5 +1,5 @@
1
1
  module OmniAuth
2
2
  module Standalone
3
- VERSION = "0.2.0"
3
+ VERSION = "0.2.1"
4
4
  end
5
5
  end
@@ -4,8 +4,9 @@ module OmniAuth
4
4
  module Strategies
5
5
  class Standalone
6
6
  class Form
7
- def initialize(fields, callback_path)
7
+ def initialize(fields, checkboxes, callback_path)
8
8
  @fields = fields
9
+ @checkboxes = checkboxes ||= []
9
10
  @callback_path = callback_path
10
11
  end
11
12
 
@@ -41,7 +42,16 @@ module OmniAuth
41
42
 
42
43
  def add_fields_to_form
43
44
  fields.each do |field|
44
- form.text_field field.to_s.capitalize.gsub('_', ' '), field.to_s
45
+ label = field.to_s.capitalize.gsub('_', ' ')
46
+ name = field.to_s
47
+ form.text_field label, name
48
+ end
49
+
50
+ checkboxes.each do |checkox|
51
+ label = checkox.to_s.capitalize.gsub('_', ' ')
52
+ name = checkox.to_s
53
+ form.label_field(label, name)
54
+ form.input_field('checkbox', name)
45
55
  end
46
56
  end
47
57
 
@@ -53,6 +63,10 @@ module OmniAuth
53
63
  @fields
54
64
  end
55
65
 
66
+ def checkboxes
67
+ @checkboxes
68
+ end
69
+
56
70
  def form
57
71
  @form ||= OmniAuth::Form.new(:title => title, :url => callback_path)
58
72
  end
@@ -26,6 +26,13 @@ module OmniAuth
26
26
  end
27
27
  end
28
28
 
29
+ extra do
30
+ {
31
+ :terms_accepted => request.params['terms_accepted'],
32
+ :opt_in => request.params['opt_in']
33
+ }
34
+ end
35
+
29
36
  def request_phase
30
37
  sign_up? ? build_sign_up_form : build_sign_in_form
31
38
  end
@@ -42,17 +49,21 @@ module OmniAuth
42
49
  end
43
50
 
44
51
  def build_sign_up_form
45
- SignUpForm.new(sign_up_fields, callback_path).render
52
+ SignUpForm.new(sign_up_fields, sign_up_checkboxes, callback_path).render
46
53
  end
47
54
 
48
55
  def build_sign_in_form
49
- SignInForm.new(sign_in_fields, callback_path).render
56
+ SignInForm.new(sign_in_fields, nil, callback_path).render
50
57
  end
51
58
 
52
59
  def sign_up_fields
53
60
  options.fields << 'password' << 'password_confirmation'
54
61
  end
55
62
 
63
+ def sign_up_checkboxes
64
+ ['terms_accepted', 'opt_in']
65
+ end
66
+
56
67
  def sign_in_fields
57
68
  ['email', 'password']
58
69
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: omniauth-standalone
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jan Owiesniak
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-12-02 00:00:00.000000000 Z
11
+ date: 2016-03-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: omniauth