mod_auth_openid_loginpage 0.0.3 → 0.0.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/lib/login.rb +47 -0
- metadata +4 -3
data/lib/login.rb
ADDED
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
require 'rubygems'
|
|
2
|
+
require 'sinatra'
|
|
3
|
+
|
|
4
|
+
set :static, true
|
|
5
|
+
set :views, File.join(File.expand_path(File.dirname(__FILE__)), "views")
|
|
6
|
+
|
|
7
|
+
if Sinatra.const_defined?("VERSION") && Gem::Version.new(Sinatra::VERSION) >= Gem::Version.new("1.3.0")
|
|
8
|
+
set :public_folder, File.join(File.expand_path(File.dirname(__FILE__)), "public")
|
|
9
|
+
else
|
|
10
|
+
set :public, File.join(File.expand_path(File.dirname(__FILE__)), "public")
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
get '/' do
|
|
14
|
+
@config = {:links => [],
|
|
15
|
+
:title => "OpenID Login",
|
|
16
|
+
:prompt => "An OpenID login is required:"}
|
|
17
|
+
|
|
18
|
+
if File.exist?(settings.openid_login_config)
|
|
19
|
+
@config.merge!(YAML.load_file(settings.openid_login_config))
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
unless params["modauthopenid.referrer"]
|
|
23
|
+
@error = "Please browse to a site that requires an OpenID login"
|
|
24
|
+
erb ""
|
|
25
|
+
else
|
|
26
|
+
if error = params["modauthopenid.error"]
|
|
27
|
+
case error
|
|
28
|
+
when "no_idp_found"
|
|
29
|
+
@error = "The OpenID URL you provided could not be found"
|
|
30
|
+
when "invalid_id"
|
|
31
|
+
@error = "The ID provided by your OpenID provider is not in the correct format"
|
|
32
|
+
when "idp_not_trusted"
|
|
33
|
+
@error = "The OpenID provider you are using is not trusted by this system"
|
|
34
|
+
when "invalid_nonce"
|
|
35
|
+
@error = "Invalid <em>nonce</em> received, you might need to enable cookies"
|
|
36
|
+
when "canceled"
|
|
37
|
+
@error = "Login did not complete, user cancelled the process"
|
|
38
|
+
when "unspecified"
|
|
39
|
+
@error = "An unspecified error occured, please try again"
|
|
40
|
+
else
|
|
41
|
+
@error = "An unknown error occured, code was <em>%s</em>" % params["modauthopenid.error"]
|
|
42
|
+
end
|
|
43
|
+
end
|
|
44
|
+
|
|
45
|
+
erb :login_page
|
|
46
|
+
end
|
|
47
|
+
end
|
metadata
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: mod_auth_openid_loginpage
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
hash:
|
|
4
|
+
hash: 23
|
|
5
5
|
prerelease: false
|
|
6
6
|
segments:
|
|
7
7
|
- 0
|
|
8
8
|
- 0
|
|
9
|
-
-
|
|
10
|
-
version: 0.0.
|
|
9
|
+
- 4
|
|
10
|
+
version: 0.0.4
|
|
11
11
|
platform: ruby
|
|
12
12
|
authors:
|
|
13
13
|
- R.I.Pienaar
|
|
@@ -152,6 +152,7 @@ files:
|
|
|
152
152
|
- public/css/bootstrap.css
|
|
153
153
|
- views/login_page.erb
|
|
154
154
|
- views/layout.erb
|
|
155
|
+
- lib/login.rb
|
|
155
156
|
has_rdoc: true
|
|
156
157
|
homepage: http://devco.net/
|
|
157
158
|
licenses: []
|