hotspotlogin 1.4.3 → 1.5.0

Sign up to get free protection for your applications and to get access to all the features.
data/Changelog CHANGED
@@ -1,3 +1,7 @@
1
+ * 1.5.0 (2013-10-02)
2
+ * --password-recovery-url <URL>: (e.g.
3
+ https://accounts.mysite.com/password-recovery.html)
4
+
1
5
  * 1.4.3 (2013-09-26)
2
6
  * cookie-based credentials persistance can be disallowed (but it is
3
7
  enabled by default): --[no-]-remember-credentials option
@@ -59,7 +59,9 @@ All this options may be put into the YAML config file specified by --conf
59
59
 
60
60
  --my-url <URL> "My Account" link, where -USER- will be replaced by
61
61
  the actual username, e.g.
62
- http://accounts.mysite.com/?id=-USER-
62
+ http://accounts.mysite.com/?id=-USER-
63
+
64
+ --password-recovery-url <URL> e.g. http://accounts.mysite.com/password-recovery.html
63
65
 
64
66
  --[no-]remember-credentials give users the possibility to store their credentials
65
67
  within a cookie in their own computer and avoid typing
@@ -13,3 +13,5 @@ logo: /some/path/to/mylogo.png
13
13
  logo-link: http://myorg.com
14
14
  my-url: http://accounts.myorg.com/?id=-USER- # -USER- will be dinamically replaced by real username
15
15
  favicon: /path/to/favicon.ico
16
+ remember-credentials: false
17
+ password-recovery-url: http://accounts.myorg.com/password-recovery.html
@@ -29,3 +29,8 @@ status:
29
29
  upload_traffic: upload
30
30
  auto_updated_every: auto updated every
31
31
  remember_me: remember me
32
+ password:
33
+ recovery:
34
+ any: password recovery
35
+ "you!": recover password
36
+ forgot: forgot password
@@ -29,3 +29,9 @@ status:
29
29
  upload_traffic: upload
30
30
  auto_updated_every: "aggiornato automaticam. ogni"
31
31
  remember_me: ricordami
32
+ password:
33
+ recovery:
34
+ any: recupero password
35
+ "you!": recupera password
36
+ forgot: password dimenticata
37
+
@@ -221,27 +221,27 @@ module HotSpotLogin
221
221
  erb(
222
222
  :hotspotlogin,
223
223
  :locals => {
224
- :titel => titel,
225
- :headline => headline, # like 'Logged out from HotSpot'
226
- :bodytext => bodytext,
227
- :uamip => params['uamip'],
228
- :uamport => params['uamport'],
229
- :userurl => params['userurl'],
230
- #:redirurl => params['redirurl'],
231
- :redirurl => params['userurl'],
232
- :timeleft => params['timeleft'], # legacy...
233
- :interval => HotSpotLogin.config['interval'],
234
- :signup_url => HotSpotLogin.config['signup-url'],
235
- :my_url => HotSpotLogin.config['my-url'],
236
- :remember_credentials => HotSpotLogin.config['remember-credentials'],
237
- :custom_headline =>
238
- HotSpotLogin.config['custom-headline'], # like "MyOrg Name"
239
- :custom_text => HotSpotLogin.config['custom-text'],
240
- :custom_footer => HotSpotLogin.config['custom-footer'],
241
- :logoext => logoext,
242
- :logo_link => HotSpotLogin.config['logo-link'],
243
- :result => result,
244
- :reply => params['reply'] # Reply-Message
224
+ :titel => titel,
225
+ :headline => headline, # like 'Logged out from HotSpot'
226
+ :bodytext => bodytext,
227
+ :uamip => params['uamip'],
228
+ :uamport => params['uamport'],
229
+ :userurl => params['userurl'],
230
+ #:redirurl => params['redirurl'],
231
+ :redirurl => params['userurl'],
232
+ :timeleft => params['timeleft'], # legacy...
233
+ :interval => HotSpotLogin.config['interval'],
234
+ :signup_url => HotSpotLogin.config['signup-url'],
235
+ :my_url => HotSpotLogin.config['my-url'],
236
+ :password_recovery_url => HotSpotLogin.config['password-recovery-url'],
237
+ :remember_credentials => HotSpotLogin.config['remember-credentials'],
238
+ :custom_headline => HotSpotLogin.config['custom-headline'], # like "MyOrg Name"
239
+ :custom_text => HotSpotLogin.config['custom-text'],
240
+ :custom_footer => HotSpotLogin.config['custom-footer'],
241
+ :logoext => logoext,
242
+ :logo_link => HotSpotLogin.config['logo-link'],
243
+ :result => result,
244
+ :reply => params['reply'] # Reply-Message
245
245
  }
246
246
  )
247
247
 
@@ -4,6 +4,7 @@ require 'hotspotlogin/constants'
4
4
  module HotSpotLogin
5
5
  class App < Sinatra::Base
6
6
  helpers do
7
+
7
8
  def logged_in?(result)
8
9
  [
9
10
  HotSpotLogin::Result::ALREADY,
@@ -12,6 +13,22 @@ module HotSpotLogin
12
13
  ].include? result
13
14
  end
14
15
  alias status_window? logged_in?
16
+
17
+ # Borrowed from / based on
18
+ # https://github.com/gderosa/onboard/blob/8a1d331ca514cd22997a8f459c0f91d64f24158b/lib/onboard/controller/helpers/user-agent.rb#L6
19
+ #
20
+ # TODO: create a common gem? 8-)
21
+ #
22
+ # Thanks to http://detectmobilebrowsers.com
23
+ # Specifically, based on http://detectmobilebrowsers.com/download/rails
24
+ #
25
+ def mobile?
26
+ return true if params['mobile'] =~ /yes|on|true|1/
27
+ return true if instance_variable_get :@mobile # may be not defined yet
28
+ return @mobile = /android.+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|symbian|treo|up\.(browser|link)|vodafone|wap|windows (ce|phone)|xda|xiino/i.match(request.user_agent) ||
29
+ /1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp( i|ip)|hs\-c|ht(c(\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac( |\-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc\-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|e\-|e\/|\-[a-w])|libw|lynx|m1\-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m\-cr|me(di|rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(\-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\-([1-8]|c))|phil|pire|pl(ay|uc)|pn\-2|po(ck|rt|se)|prox|psio|pt\-g|qa\-a|qc(07|12|21|32|60|\-[2-7]|i\-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h\-|oo|p\-)|sdk\/|se(c(\-|0|1)|47|mc|nd|ri)|sgh\-|shar|sie(\-|m)|sk\-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h\-|v\-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\-|tdg\-|tel(i|m)|tim\-|t\-mo|to(pl|sh)|ts(70|m\-|m3|m5)|tx\-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(\-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|xda(\-|2|g)|yas\-|your|zeto|zte\-/i.match(request.user_agent[0..3])
30
+ end
31
+
15
32
  end
16
33
  end
17
34
  end
@@ -60,6 +60,10 @@ module HotSpotLogin
60
60
  @@config['signup-url'] = url
61
61
  end
62
62
 
63
+ opts.on('--password-recovery-url URL', 'display an external link where end-user may recover/reset her password') do |url|
64
+ @@config['password-recovery-url'] = url
65
+ end
66
+
63
67
  opts.on('--[no-]remember-credentials', 'allow users to save username/password in cookies') do |rcred|
64
68
  @@config['remember-credentials'] = rcred
65
69
  end
@@ -1,6 +1,6 @@
1
1
  module HotSpotLogin
2
2
 
3
- VERSION = '1.4.3'
3
+ VERSION = '1.5.0'
4
4
 
5
5
  DEFAULT_CONFIG = {
6
6
  'listen-address' => '0.0.0.0',
@@ -99,23 +99,20 @@ h2#headline {
99
99
  background: white;
100
100
  } */
101
101
 
102
- #signup-container{
102
+ #signup-container, #password-recovery-container {
103
103
  font-style:italic;
104
104
  font-weight: normal;
105
- margin-top:0.2em;
106
105
  }
107
106
 
108
- a#signup {
107
+ a#signup {
109
108
  border: none;
110
109
  color: white;
111
110
  background: #77f;
112
111
  padding: 0.2em 0.2em 0.1em 0.2em;
113
112
  font-style:normal;
114
- }
115
-
116
- a#signup {
117
113
  text-decoration: none;
118
114
  margin-left: 0.2em;
115
+ line-height: 2.4em;
119
116
  font-size: 130%;
120
117
  }
121
118
 
@@ -33,13 +33,17 @@
33
33
  </table>
34
34
  </form>
35
35
  <div style="height:1ex;"> <!-- separator --> </div>
36
- <% if signup_url =~ /\S/ %><span id="signup-container">
37
- <%= t.account.dont_have.you.capitalize %>?
38
- <%
39
- # DEBUG
40
- # require 'pp'
41
- # pp request.GET
42
- %>
43
- <a id="signup" href="<%= signup_url %>?redirect=<%= Rack::Utils.escape params['userurl'] %>"><%= t.signup.you!.capitalize %></a>
44
- </span><% end %>
36
+
37
+ <% if signup_url =~ /\S/ %>
38
+ <span id="signup-container">
39
+ <%= t.account.dont_have.you.capitalize %>?
40
+ <a <%= 'target="_blank"' unless mobile? %> id="signup" href="<%= signup_url %>?redirect=<%= Rack::Utils.escape params['userurl'] %>"><%= t.signup.you!.capitalize %></a>
41
+ </span>
42
+ <% end %>
43
+ <% if password_recovery_url =~ /\S/ %>
44
+ <div id="password-recovery-container">
45
+ <%= t.password.forgot.capitalize %>?
46
+ <a id="password-recovery" href="<%= password_recovery_url %>?redirect=<%= Rack::Utils.escape params['userurl'] %>"><%= t.password.recovery.you!.capitalize.gsub(/\s/, '&nbsp;') %></a>
47
+ </div>
48
+ <% end %>
45
49
 
@@ -53,8 +53,9 @@
53
53
  :_login_form,
54
54
  :layout => false,
55
55
  :locals => {
56
- :signup_url => signup_url,
57
- :remember_credentials => remember_credentials,
56
+ :signup_url => signup_url,
57
+ :remember_credentials => remember_credentials,
58
+ :password_recovery_url => password_recovery_url
58
59
  }
59
60
  )
60
61
  %>
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: hotspotlogin
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.4.3
4
+ version: 1.5.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-09-26 00:00:00.000000000 Z
12
+ date: 2013-10-02 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: facets