sinatra-single-user-auth 0.1 → 0.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -12,18 +12,18 @@ module Sinatra
12
12
  session[:arni] = true
13
13
  redirect_back_or_default(settings.home)
14
14
  end
15
- redirect to('/login')
15
+ redirect to("#{settings.context}login")
16
16
  end
17
17
 
18
18
  def logout!
19
19
  session.clear
20
- redirect to('/')
20
+ redirect to(settings.context)
21
21
  end
22
22
 
23
23
  def protected!
24
24
  unless authorized?
25
25
  store_location
26
- redirect to('/login')
26
+ redirect to("#{settings.context}login")
27
27
  end
28
28
  end
29
29
 
@@ -47,16 +47,17 @@ module Sinatra
47
47
  app.set :username, 'username'
48
48
  app.set :password, 'password'
49
49
  app.set :home, '/'
50
+ app.set :context, '/'
50
51
 
51
- app.post '/login/?' do
52
+ app.post "#{app.context}login/?" do
52
53
  auth!(params[:password],params[:username])
53
54
  end
54
55
 
55
- app.delete '/logout/?' do
56
+ app.delete "#{app.context}logout/?" do
56
57
  logout!
57
58
  end
58
59
 
59
- app.get '/logout/?' do
60
+ app.get "#{app.context}logout/?" do
60
61
  logout!
61
62
  end
62
63
  end
@@ -3,7 +3,7 @@ $:.push File.expand_path("../lib", __FILE__)
3
3
 
4
4
  Gem::Specification.new do |s|
5
5
  s.name = "sinatra-single-user-auth"
6
- s.version = '0.1'
6
+ s.version = '0.2'
7
7
  s.platform = Gem::Platform::RUBY
8
8
  s.authors = ["Kingsley Hendrickse","Vasily Polovnyov"]
9
9
  s.email = ["kingsley@masterthought.net","vasily@polovnyov.ru"]
@@ -8,6 +8,7 @@ class SinatraModularApp < Sinatra::Base
8
8
  set :username, 'username'
9
9
  set :password, 'password'
10
10
  set :home, '/'
11
+ set :context, '/'
11
12
 
12
13
  get '/' do
13
14
  "hello, i'm root"
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sinatra-single-user-auth
3
3
  version: !ruby/object:Gem::Version
4
- version: '0.1'
4
+ version: '0.2'
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2013-07-06 00:00:00.000000000 Z
13
+ date: 2013-07-12 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: sinatra