omniauth-td 0.0.4 → 0.0.5

Sign up to get free protection for your applications and to get access to all the features.
data/Rakefile CHANGED
@@ -1,2 +1,25 @@
1
1
  #!/usr/bin/env rake
2
2
  require "bundler/gem_tasks"
3
+
4
+ require 'rubygems'
5
+ require 'bundler'
6
+ Bundler.setup
7
+ $LOAD_PATH << File.dirname(__FILE__) + '/lib'
8
+
9
+ desc 'start a development server'
10
+ task :server do
11
+ Dir.chdir 'examples'
12
+ if which('shotgun')
13
+ exec 'shotgun -O sinatra.rb -p 5678'
14
+ else
15
+ warn 'warn: shotgun not installed; reloading is disabled.'
16
+ exec 'ruby -rubygems sinatra.rb -p 5678'
17
+ end
18
+ end
19
+ def which(command)
20
+ ENV['PATH'].
21
+ split(':').
22
+ map { |p| "#{p}/#{command}" }.
23
+ find { |p| File.executable?(p) }
24
+ end
25
+ task :start => :server
data/examples/sinatra.rb CHANGED
@@ -1,5 +1,7 @@
1
1
  $:.push File.dirname(__FILE__) + '/../lib'
2
2
 
3
+ require 'rubygems'
4
+ require 'omniauth'
3
5
  require 'omniauth-td'
4
6
  require 'sinatra'
5
7
 
@@ -10,7 +12,8 @@ get '/' do
10
12
  "<a href='/auth/td'>Log in with Treasure Data</a>"
11
13
  end
12
14
 
13
- get '/auth/td/callback' do
15
+ post '/auth/td/callback' do
14
16
  content_type 'text/plain'
15
17
  request.env['omniauth.auth'].inspect
18
+ "login succeeded!"
16
19
  end
@@ -1,3 +1,5 @@
1
+ require 'erb'
2
+ require 'rack'
1
3
  require 'omniauth-td/version'
2
4
  require 'td/client'
3
5
 
@@ -9,14 +11,12 @@ module OmniAuth
9
11
  option :fields, [:email]
10
12
  option :uid_field, :email
11
13
 
14
+ VIEW_DIR = File.dirname(__FILE__) + "/../../../view/"
15
+
12
16
  def request_phase
13
- form = OmniAuth::Form.new(:title => "Account Info", :url => callback_path)
14
- options.fields.each do |field|
15
- form.text_field field.to_s.capitalize.gsub("_", " "), field.to_s
16
- end
17
- form.password_field 'Password', 'password'
18
- form.button "Sign In"
19
- form.to_response
17
+ tmpl = VIEW_DIR + 'form.erb'
18
+ html = ERB.new(open(tmpl).read).result(binding)
19
+ Rack::Response.new(html).finish
20
20
  end
21
21
 
22
22
  def callback_phase
@@ -1,5 +1,5 @@
1
1
  module OmniAuth
2
2
  module Td
3
- VERSION = "0.0.4"
3
+ VERSION = "0.0.5"
4
4
  end
5
5
  end
data/omniauth-td.gemspec CHANGED
@@ -17,4 +17,6 @@ Gem::Specification.new do |gem|
17
17
 
18
18
  gem.add_dependency 'omniauth', '~> 1.0'
19
19
  gem.add_dependency 'td-client', '~> 0.8.35'
20
+ gem.add_development_dependency 'shotgun', '~> 0.9'
21
+ gem.add_development_dependency 'sinatra', '~> 1.3.1'
20
22
  end
data/view/form.erb ADDED
@@ -0,0 +1,67 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <title>Sign Up | Treasure Data</title>
5
+
6
+ <!-- jQuery -->
7
+ <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.4.0/jquery.min.js"></script>
8
+ <script src="https://ajax.aspnetcdn.com/ajax/jquery.validate/1.6/jquery.validate.min.js"></script>
9
+
10
+ <!-- Assets -->
11
+ <link rel='stylesheet' href='http://www.treasure-data.com/stylesheets/base.css' media='screen' />
12
+
13
+ <!-- ready() -->
14
+ <script>
15
+ $(document).ready(function(){
16
+ $('#SignUpForm').validate({
17
+ rules: {
18
+ password: {
19
+ minlength: 6,
20
+ maxlength: 30
21
+ }
22
+ },
23
+ messages: {
24
+ password: {
25
+ required: "Enter password.",
26
+ }
27
+ }
28
+ });
29
+ });
30
+ </script>
31
+ </head>
32
+ <body>
33
+ <br />
34
+ <br />
35
+ <br />
36
+ <br />
37
+ <div id="container_signup">
38
+ <h1>
39
+ <a href="http://www.treasure-data.com/" id="brand_signup">Treasure Data</a>
40
+ </h1>
41
+ <div id="form_wrapper">
42
+ <form method="POST" action="/auth/td/callback" id="SignUpForm" >
43
+ <div>
44
+ Email:
45
+ <input class="text required" name="email" placeholder="Email" type="text" />
46
+ </div>
47
+ <div>
48
+ Password:
49
+ <input class="text" name="password" placeholder="Password" type="password" />
50
+ </div>
51
+ <div>
52
+ <button type="submit">Login</button>
53
+ </div>
54
+ <input name="code" type="hidden" value="treasure-data" />
55
+ <input name="source" type="hidden" value="top" />
56
+ <input name="return_url" type="hidden" value="http://treasure-data.com/thanks/" />
57
+ </form>
58
+ <p class="smaller-print">
59
+ Don't have an account? <a href="http://www.treasure-data.com/signup/">Sign up.</a> Or <a href="http://docs.treasure-data.com/articles/change-password">forgot password</a>?
60
+ </p>
61
+ </div>
62
+ <div id="footer_signup">
63
+ <div>&copy; 2011- <a href="http://treasure-data.com">Treasure Data, Inc.</a> All Rights Reserved. </div>
64
+ </div>
65
+ </div>
66
+ </body>
67
+ </html>
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: omniauth-td
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.4
4
+ version: 0.0.5
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -43,6 +43,38 @@ dependencies:
43
43
  - - ~>
44
44
  - !ruby/object:Gem::Version
45
45
  version: 0.8.35
46
+ - !ruby/object:Gem::Dependency
47
+ name: shotgun
48
+ requirement: !ruby/object:Gem::Requirement
49
+ none: false
50
+ requirements:
51
+ - - ~>
52
+ - !ruby/object:Gem::Version
53
+ version: '0.9'
54
+ type: :development
55
+ prerelease: false
56
+ version_requirements: !ruby/object:Gem::Requirement
57
+ none: false
58
+ requirements:
59
+ - - ~>
60
+ - !ruby/object:Gem::Version
61
+ version: '0.9'
62
+ - !ruby/object:Gem::Dependency
63
+ name: sinatra
64
+ requirement: !ruby/object:Gem::Requirement
65
+ none: false
66
+ requirements:
67
+ - - ~>
68
+ - !ruby/object:Gem::Version
69
+ version: 1.3.1
70
+ type: :development
71
+ prerelease: false
72
+ version_requirements: !ruby/object:Gem::Requirement
73
+ none: false
74
+ requirements:
75
+ - - ~>
76
+ - !ruby/object:Gem::Version
77
+ version: 1.3.1
46
78
  description: OmniAuth strategy for Treasure Data
47
79
  email:
48
80
  - kazuki.ohta@gmail.com
@@ -60,6 +92,7 @@ files:
60
92
  - lib/omniauth-td/version.rb
61
93
  - lib/omniauth/strategies/td.rb
62
94
  - omniauth-td.gemspec
95
+ - view/form.erb
63
96
  homepage: https://github.com/treasure-data/omniauth-td
64
97
  licenses: []
65
98
  post_install_message:
@@ -72,12 +105,18 @@ required_ruby_version: !ruby/object:Gem::Requirement
72
105
  - - ! '>='
73
106
  - !ruby/object:Gem::Version
74
107
  version: '0'
108
+ segments:
109
+ - 0
110
+ hash: -3124961536604598899
75
111
  required_rubygems_version: !ruby/object:Gem::Requirement
76
112
  none: false
77
113
  requirements:
78
114
  - - ! '>='
79
115
  - !ruby/object:Gem::Version
80
116
  version: '0'
117
+ segments:
118
+ - 0
119
+ hash: -3124961536604598899
81
120
  requirements: []
82
121
  rubyforge_project:
83
122
  rubygems_version: 1.8.24