cz_auth 0.3.0 → 0.4.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/controllers/cz_auth/application_controller.rb +1 -0
- data/app/controllers/cz_auth/concerns/authentication.rb +8 -27
- data/app/controllers/cz_auth/sessions_controller.rb +55 -0
- data/app/views/cz_auth/{authentication → sessions}/create.json.erb +0 -0
- data/app/views/cz_auth/{authentication → sessions}/invalid.json +0 -0
- data/app/views/cz_auth/sessions/new.html.erb +7 -0
- data/config/routes.rb +5 -2
- data/lib/cz_auth/engine.rb +2 -0
- data/lib/cz_auth/requires_authentication.rb +0 -7
- data/lib/cz_auth/version.rb +1 -1
- data/spec/dummy/app/models/user.rb +1 -1
- data/spec/dummy/log/test.log +28 -1126
- data/spec/dummy/spec/factories/user.rb +1 -1
- metadata +5 -4
- data/app/controllers/cz_auth/authentication_controller.rb +0 -26
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cz_auth
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.4.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Mike Kelley
|
@@ -46,10 +46,11 @@ extensions: []
|
|
46
46
|
extra_rdoc_files: []
|
47
47
|
files:
|
48
48
|
- app/controllers/cz_auth/application_controller.rb
|
49
|
-
- app/controllers/cz_auth/authentication_controller.rb
|
50
49
|
- app/controllers/cz_auth/concerns/authentication.rb
|
51
|
-
- app/
|
52
|
-
- app/views/cz_auth/
|
50
|
+
- app/controllers/cz_auth/sessions_controller.rb
|
51
|
+
- app/views/cz_auth/sessions/create.json.erb
|
52
|
+
- app/views/cz_auth/sessions/invalid.json
|
53
|
+
- app/views/cz_auth/sessions/new.html.erb
|
53
54
|
- config/environment.rb
|
54
55
|
- config/routes.rb
|
55
56
|
- lib/cz_auth/engine.rb
|
@@ -1,26 +0,0 @@
|
|
1
|
-
module CzAuth
|
2
|
-
class AuthenticationController < ApplicationController
|
3
|
-
skip_before_filter { :"authorize_#{model}!" }
|
4
|
-
|
5
|
-
def create
|
6
|
-
resource = model.where(email: params[:email]).first
|
7
|
-
@authenticated = perform_authentication_for(resource || model)
|
8
|
-
render @authenticated ? 'create' : 'invalid'
|
9
|
-
end
|
10
|
-
|
11
|
-
def destroy
|
12
|
-
delete_session_cookie
|
13
|
-
end
|
14
|
-
|
15
|
-
private
|
16
|
-
|
17
|
-
def resource_param
|
18
|
-
"#{params[:resource]}".classify
|
19
|
-
end
|
20
|
-
|
21
|
-
def model
|
22
|
-
resource = "#{resource_param}".constantize
|
23
|
-
end
|
24
|
-
|
25
|
-
end
|
26
|
-
end
|