kete_browserid 0.0.3 → 0.0.4

Sign up to get free protection for your applications and to get access to all the features.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.0.3
1
+ 0.0.4
@@ -1,3 +1,3 @@
1
- <% if !::KeteBrowserid::REPLACE_EXISTING_LOGIN || (Kete.is_configured? && anonymous_ok_for?(session[:return_to])) -%>
1
+ <% if !::KeteBrowserid.supported?(request.user_agent) || !::KeteBrowserid::REPLACE_EXISTING_LOGIN || (Kete.is_configured? && anonymous_ok_for?(session[:return_to])) -%>
2
2
  <div class="wrap"><%= submit_tag @button_text, { :class => @button_classes.join(' '), :tabindex => '1'} %></div>
3
3
  <% end -%>
@@ -1,17 +1,27 @@
1
- <fieldset>
2
- <% unless ::KeteBrowserid::REPLACE_EXISTING_LOGIN -%>
3
- <h3><%= t '.use_browserid' -%></h3>
4
- <% end -%>
1
+ <% if ::KeteBrowserid.supported?(request.user_agent) -%>
2
+ <fieldset>
3
+ <% unless ::KeteBrowserid::REPLACE_EXISTING_LOGIN -%>
4
+ <h3><%= t '.use_browserid' -%></h3>
5
+ <% end -%>
5
6
 
6
- <p><%= t '.register_via_browserid',
7
- :register_link => link_for_register_via_browserid -%></p>
8
- <h4><%= link_for_login_with_browserid -%></h4>
9
- </fieldset>
7
+ <p><%= t '.register_via_browserid',
8
+ :register_link => link_for_register_via_browserid -%></p>
9
+ <h4><%= link_for_login_with_browserid -%></h4>
10
10
 
11
- <% unless ::KeteBrowserid::REPLACE_EXISTING_LOGIN -%>
11
+ <% if ::KeteBrowserid::REPLACE_EXISTING_LOGIN -%>
12
+ <p><%= t '.usually_use_normal_login_1' -%></p>
13
+ <p><%= t '.usually_use_normal_login_2', :site_name => Kete.pretty_site_name -%></p>
14
+ <p><%= t '.usually_use_normal_login_3' -%></p>
15
+ <% end -%>
16
+ </fieldset>
17
+ <% end -%>
18
+
19
+ <% if !::KeteBrowserid.supported?(request.user_agent) || !::KeteBrowserid::REPLACE_EXISTING_LOGIN -%>
12
20
  <p>&nbsp;</p>
13
21
  <fieldset>
14
- <h3><%= t '.or_standard_login' -%></h3>
22
+ <% if ::KeteBrowserid.supported?(request.user_agent) -%>
23
+ <h3><%= t '.or_standard_login' -%></h3>
24
+ <% end -%>
15
25
 
16
26
  <!--[form:login]-->
17
27
  <% if Kete.is_configured? -%>
@@ -47,6 +57,15 @@
47
57
  :action => 'forgot_password',
48
58
  :urlified_name => @site_basket.urlified_name},
49
59
  :tabindex => '1') -%></p>
60
+
61
+ <% unless ::KeteBrowserid.supported?(request.user_agent) -%>
62
+ <p><%=t '.usually_use_browserid',
63
+ :generate_password_link => link_to(t('.generate_password'),
64
+ { :controller => 'account',
65
+ :action => 'forgot_password',
66
+ :urlified_name => @site_basket.urlified_name},
67
+ :tabindex => '1') -%></p>
68
+ <% end -%>
50
69
  <% end -%>
51
70
  </fieldset>
52
71
  <% end -%>
@@ -2,9 +2,14 @@
2
2
  en:
3
3
  account:
4
4
  login_form:
5
+ generate_password: "Click Here"
5
6
  or_standard_login: "Or use standard {{t.base.login}} {{t.base.form}}"
6
7
  register_via_browserid: "Are {{t.base.you}} {{t.base.registered}}? {{t.base.you.capitalize}} will need to {{register_link}} first before {{t.base.you}} can {{t.base.login}}."
7
8
  use_browserid: "Use {{t.base.browserid}}"
9
+ usually_use_browserid: "Do you usually use {{t.base.browserid}} to {{t.base.login}}? If so, you'll need to request a {{t.base.password}} (if you haven't already): {{generate_password_link}}."
10
+ usually_use_normal_login_1: "Do you usually NOT use {{t.base.browserid}} to {{t.base.login}}?"
11
+ usually_use_normal_login_2: "{{t.base.browserid}} is this site's preferred way to login (because it works with a lot of other sites!), please set up your {{t.base.browserid}} account and we'll match it to your existing {{site_name}} account."
12
+ usually_use_normal_login_3: "Just click \"{{t.base.login.capitalize}} with {{t.base.browserid}}\" to get started signing up with {{t.base.browserid}}."
8
13
  signup_as_browserid:
9
14
  second_step: "Now that you have created your {{t.base.browserid}}, we need to ask you a few more questions before completing your sign up on the site."
10
15
  short_name: "{{t.base.short_name.capitalize}}"
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{kete_browserid}
8
- s.version = "0.0.3"
8
+ s.version = "0.0.4"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Walter McGinnis"]
12
- s.date = %q{2012-06-20}
12
+ s.date = %q{2012-07-12}
13
13
  s.description = %q{An add-on for Kete (http://kete.net.nz) that replaces normal login with a browserid based login.}
14
14
  s.email = %q{walter@katipo.co.nz}
15
15
  s.extra_rdoc_files = [
@@ -1,4 +1,8 @@
1
1
  module KeteBrowserid
2
2
  REPLACE_EXISTING_LOGIN = true
3
3
  REPLACE_EXISTING_REGISTER = true
4
+
5
+ def self.supported?(user_agent)
6
+ !user_agent.include?('MSIE 7.') && !user_agent.include?('MSIE 6.')
7
+ end
4
8
  end
@@ -7,8 +7,11 @@ ApplicationHelper.module_eval do
7
7
  end
8
8
 
9
9
  def link_to_login(phrase, url_for_options, html_options)
10
+ standard_html = link_to_unless_current phrase, url_for_options, html_options
11
+ return standard_html unless ::KeteBrowserid.supported?(request.user_agent)
12
+
10
13
  html = String.new
11
-
14
+
12
15
  # don't make link active for login page
13
16
  browserid_login_html = if params[:controller] == 'account' && params[:action] == 'login'
14
17
  t('application_helper.link_to_login.login_with_browserid')
@@ -16,8 +19,9 @@ ApplicationHelper.module_eval do
16
19
  link_for_login_with_browserid
17
20
  end
18
21
 
22
+
19
23
  unless ::KeteBrowserid::REPLACE_EXISTING_LOGIN
20
- html = link_to_unless_current phrase, url_for_options, html_options
24
+ html = standard_html
21
25
  html += '</li><li>'
22
26
  end
23
27
 
@@ -33,6 +37,9 @@ ApplicationHelper.module_eval do
33
37
  end
34
38
 
35
39
  def link_to_register(phrase, url_for_options, html_options)
40
+ standard_html = link_to_unless_current phrase, url_for_options, html_options
41
+ return standard_html unless ::KeteBrowserid.supported?(request.user_agent)
42
+
36
43
  html = String.new
37
44
 
38
45
  # don't make link active for signup page
@@ -43,7 +50,7 @@ ApplicationHelper.module_eval do
43
50
  end
44
51
 
45
52
  unless ::KeteBrowserid::REPLACE_EXISTING_REGISTER
46
- html = link_to_unless_current phrase, url_for_options, html_options
53
+ html =
47
54
  html += '</li><li>'
48
55
  end
49
56
 
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: kete_browserid
3
3
  version: !ruby/object:Gem::Version
4
- hash: 25
4
+ hash: 23
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 0
9
- - 3
10
- version: 0.0.3
9
+ - 4
10
+ version: 0.0.4
11
11
  platform: ruby
12
12
  authors:
13
13
  - Walter McGinnis
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2012-06-20 00:00:00 +12:00
18
+ date: 2012-07-12 00:00:00 +12:00
19
19
  default_executable:
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency