headstart 0.9.2 → 0.11.1

Sign up to get free protection for your applications and to get access to all the features.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.9.2
1
+ 0.11.1
@@ -4,10 +4,9 @@ class Headstart::SessionsController < ApplicationController
4
4
  skip_before_filter :authenticate, :only => [:new, :create, :destroy]
5
5
  protect_from_forgery :except => :create
6
6
  filter_parameter_logging :password
7
+ before_filter :set_oauth_url, :only => [:new, :create]
7
8
 
8
9
  def new
9
- # Scopes: http://developers.facebook.com/docs/authentication/permissions
10
- @oauth_url = MiniFB.oauth_url(Headstart.configuration.facebook_app_id, get_full_app_path + "/sessions/create", :scope=> "user_about_me, publish_stream, email") #MiniFB.scopes.join(",")
11
10
  render :template => 'sessions/new'
12
11
  end
13
12
 
@@ -20,7 +19,7 @@ class Headstart::SessionsController < ApplicationController
20
19
 
21
20
  if @user.nil?
22
21
  flash_failure_after_create
23
- render :template => 'sessions/new', :status => :unauthorized
22
+ render :template => Headstart.configuration.session_failure_template, :status => :unauthorized
24
23
  else
25
24
  if @user.email_confirmed?
26
25
  flash_success_after_create
@@ -65,7 +64,7 @@ class Headstart::SessionsController < ApplicationController
65
64
  end
66
65
 
67
66
  def url_after_create
68
- '/'
67
+ Headstart.configuration.url_after_create
69
68
  end
70
69
 
71
70
  def flash_success_after_destroy
@@ -7,7 +7,8 @@ class Headstart::UsersController < ApplicationController
7
7
  # Before Filter on *only* the 'uninstalled' method
8
8
  before_filter :verify_uninstall_signature, :only => [:facebook_remove]
9
9
  skip_before_filter :verify_authenticity_token, :only => [:facebook_remove]
10
-
10
+ before_filter :set_oauth_url, :only => [:new, :create]
11
+
11
12
  def resend_welcome_email
12
13
  HeadstartMailer.deliver_welcome(current_user)
13
14
  flash[:notice] = 'Your confirmation email has been resent.'
@@ -5,11 +5,7 @@
5
5
  <%- else -%>
6
6
  <%= javascript_include_tag 'http://static.ak.connect.facebook.com/js/api_lib/v0.4/FeatureLoader.js.php/en_US' %>
7
7
  <%- end -%>
8
- <script>
9
- function facebook_onlogin() {
10
- document.location.href = "<%= fb_connect_path %>";
11
- }
12
- </script>
8
+
13
9
  <%- end -%>
14
10
 
15
11
  <h2>Sign in</h2>
@@ -1,7 +1,22 @@
1
1
  <% content_for :title do %>Sign up<% end %>
2
+ <%- if Headstart.configuration.use_facebook_connect -%>
3
+ <%- if request.ssl? -%>
4
+ <%= javascript_include_tag 'https://ssl.connect.facebook.com/js/api_lib/v0.4/FeatureLoader.js.php/en_US' %>
5
+ <%- else -%>
6
+ <%= javascript_include_tag 'http://static.ak.connect.facebook.com/js/api_lib/v0.4/FeatureLoader.js.php/en_US' %>
7
+ <%- end -%>
8
+
9
+ <%- end -%>
10
+
2
11
  <h2>Sign up</h2>
3
12
 
4
13
  <% form_for @user, :html => { :enctype => "multipart/form-data"} do |form| %>
5
14
  <%= render :partial => '/users/form', :object => form %>
6
15
  <%= form.submit 'Sign up', :disable_with => 'Please wait...' %>
7
16
  <% end %>
17
+
18
+ <%- if Headstart.configuration.use_facebook_connect -%>
19
+ <div style="margin-top:20px">
20
+ <%= link_to image_tag("facebook_login.png"), @oauth_url %>
21
+ </div>
22
+ <%- end -%>
@@ -12,6 +12,8 @@ begin
12
12
  config.facebook_api_key = configuration[:facebook_api_key]
13
13
  config.facebook_secret_key = configuration[:facebook_secret_key]
14
14
  config.facebook_app_id = configuration[:facebook_app_id]
15
+ config.url_after_create = configuration[:url_after_create]
16
+ config.session_failure_template = configuration[:session_failure_template]
15
17
  end
16
18
 
17
19
  if configuration[:madmimi_username].present? && configuration[:madmimi_api_key].present?
@@ -24,6 +24,8 @@ development:
24
24
  facebook_api_key: $facebook_api_key
25
25
  facebook_secret_key: $facebook_secret_key
26
26
  facebook_app_id: $facebook_app_id
27
+ url_after_create: /
28
+ session_failure_template: sessions/new
27
29
 
28
30
  staging:
29
31
  mailer_sender: $mailer_sender
@@ -35,6 +37,8 @@ staging:
35
37
  facebook_api_key: $facebook_api_key
36
38
  facebook_secret_key: $facebook_secret_key
37
39
  facebook_app_id: $facebook_app_id
40
+ url_after_create: /
41
+ session_failure_template: sessions/new
38
42
 
39
43
  test:
40
44
  mailer_sender: $mailer_sender
@@ -46,6 +50,8 @@ test:
46
50
  facebook_api_key: $facebook_api_key
47
51
  facebook_secret_key: $facebook_secret_key
48
52
  facebook_app_id: $facebook_app_id
53
+ url_after_create: /
54
+ session_failure_template: sessions/new
49
55
 
50
56
  production:
51
57
  mailer_sender: $mailer_sender
@@ -57,3 +63,5 @@ production:
57
63
  facebook_api_key: $facebook_api_key
58
64
  facebook_secret_key: $facebook_secret_key
59
65
  facebook_app_id: $facebook_app_id
66
+ url_after_create: /
67
+ session_failure_template: sessions/new
@@ -105,6 +105,12 @@ module Headstart
105
105
 
106
106
  protected
107
107
 
108
+
109
+ def set_oauth_url
110
+ # Scopes: http://developers.facebook.com/docs/authentication/permissions
111
+ @oauth_url = MiniFB.oauth_url(Headstart.configuration.facebook_app_id, get_full_app_path + "/sessions/create", :scope=> "user_about_me, publish_stream, email") #MiniFB.scopes.join(",")
112
+ end
113
+
108
114
  def user_from_cookie
109
115
  if token = cookies[:remember_token]
110
116
  ::User.find_by_remember_token(token)
@@ -7,6 +7,8 @@ module Headstart
7
7
  attr_accessor :facebook_secret_key
8
8
  attr_accessor :facebook_app_id
9
9
  attr_accessor :use_delayed_job
10
+ attr_accessor :url_after_create
11
+ attr_accessor :session_failure_template
10
12
 
11
13
  def initialize
12
14
  @mailer_sender = 'donotreply@example.com'
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: headstart
3
3
  version: !ruby/object:Gem::Version
4
- hash: 63
4
+ hash: 49
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
- - 9
9
- - 2
10
- version: 0.9.2
8
+ - 11
9
+ - 1
10
+ version: 0.11.1
11
11
  platform: ruby
12
12
  authors:
13
13
  - Bran Burridge
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2010-10-12 00:00:00 -04:00
18
+ date: 2010-11-08 00:00:00 -05:00
19
19
  default_executable:
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency