cz_auth 0.0.1 → 0.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/README.md +45 -0
- data/Rakefile +9 -15
- data/app/controllers/cz_auth/application_controller.rb +1 -22
- data/app/controllers/cz_auth/authentication_controller.rb +26 -0
- data/app/controllers/cz_auth/concerns/authentication.rb +118 -0
- data/app/views/cz_auth/authentication/create.json.erb +4 -0
- data/app/views/cz_auth/authentication/invalid.json +1 -0
- data/config/environment.rb +1 -0
- data/config/routes.rb +3 -11
- data/lib/cz_auth.rb +1 -4
- data/lib/cz_auth/engine.rb +6 -0
- data/lib/cz_auth/requires_authentication.rb +39 -8
- data/lib/cz_auth/version.rb +1 -1
- data/lib/generators/cz_auth/install_generator.rb +1 -1
- data/spec/dummy/README.rdoc +28 -0
- data/spec/dummy/Rakefile +6 -0
- data/spec/dummy/app/assets/javascripts/application.js +13 -0
- data/spec/dummy/app/assets/stylesheets/application.css +13 -0
- data/spec/dummy/app/controllers/application_controller.rb +5 -0
- data/spec/dummy/app/helpers/application_helper.rb +2 -0
- data/spec/dummy/app/models/user.rb +3 -0
- data/spec/dummy/app/views/layouts/application.html.erb +14 -0
- data/spec/dummy/bin/bundle +3 -0
- data/spec/dummy/bin/rails +4 -0
- data/spec/dummy/bin/rake +4 -0
- data/spec/dummy/config.ru +4 -0
- data/spec/dummy/config/application.rb +28 -0
- data/spec/dummy/config/boot.rb +5 -0
- data/spec/dummy/config/database.yml +13 -0
- data/spec/dummy/config/environment.rb +5 -0
- data/spec/dummy/config/environments/development.rb +29 -0
- data/spec/dummy/config/environments/production.rb +80 -0
- data/spec/dummy/config/environments/test.rb +36 -0
- data/spec/dummy/config/initializers/backtrace_silencers.rb +7 -0
- data/spec/dummy/config/initializers/filter_parameter_logging.rb +4 -0
- data/spec/dummy/config/initializers/inflections.rb +16 -0
- data/spec/dummy/config/initializers/mime_types.rb +5 -0
- data/spec/dummy/config/initializers/secret_token.rb +12 -0
- data/spec/dummy/config/initializers/session_store.rb +3 -0
- data/spec/dummy/config/initializers/wrap_parameters.rb +14 -0
- data/spec/dummy/config/locales/en.yml +23 -0
- data/spec/dummy/config/routes.rb +3 -0
- data/spec/dummy/db/migrate/20130725213651_create_users.rb +12 -0
- data/spec/dummy/db/schema.rb +25 -0
- data/spec/dummy/log/test.log +1180 -0
- data/spec/dummy/public/404.html +58 -0
- data/spec/dummy/public/422.html +58 -0
- data/spec/dummy/public/500.html +57 -0
- data/spec/dummy/public/favicon.ico +0 -0
- data/spec/dummy/spec/factories/user.rb +9 -0
- data/spec/dummy/spec/models/user_spec.rb +40 -0
- data/spec/dummy/spec/spec_helper.rb +37 -0
- data/spec/spec_helper.rb +37 -0
- metadata +58 -26
- data/README.rdoc +0 -19
- data/app/controllers/cz_auth/registrations_controller.rb +0 -19
- data/app/controllers/cz_auth/sessions_controller.rb +0 -22
- data/app/helpers/cz_auth/application_helper.rb +0 -11
- data/app/views/cz_auth/registrations/new.html.erb +0 -1
- data/app/views/cz_auth/sessions/new.html.erb +0 -1
- data/lib/tasks/cz_auth_tasks.rake +0 -4
data/README.rdoc
DELETED
@@ -1,19 +0,0 @@
|
|
1
|
-
== CzAuth
|
2
|
-
|
3
|
-
Just a simple authentication implementation using has_secure_password for convenience. This gem is not supported for public consumption. It's just something I threw together to simplify my daily life.
|
4
|
-
|
5
|
-
=== Usage
|
6
|
-
|
7
|
-
rails g cz_auth:install <model_name>
|
8
|
-
rake db:migrate
|
9
|
-
|
10
|
-
=== Details
|
11
|
-
|
12
|
-
The generator will generate a model with the following attributes:
|
13
|
-
|
14
|
-
* username
|
15
|
-
* email
|
16
|
-
* password_digest
|
17
|
-
* auth_token
|
18
|
-
|
19
|
-
It will then place a 'requires_authentication' method at the top of the model. This will trigger the has_secure_password, and before filter used to generate an auth_token.
|
@@ -1,19 +0,0 @@
|
|
1
|
-
module CzAuth
|
2
|
-
class RegistrationsController < CzAuth::ApplicationController
|
3
|
-
|
4
|
-
def new
|
5
|
-
@resource = @klass.new
|
6
|
-
end
|
7
|
-
|
8
|
-
def create
|
9
|
-
@resource = @klass.new(params[:resource])
|
10
|
-
if @resource.save
|
11
|
-
cookies[:auth_token] = @resource.auth_token
|
12
|
-
redirect_to root_url
|
13
|
-
else
|
14
|
-
render :new
|
15
|
-
end
|
16
|
-
end
|
17
|
-
|
18
|
-
end
|
19
|
-
end
|
@@ -1,22 +0,0 @@
|
|
1
|
-
module CzAuth
|
2
|
-
class SessionsController < CzAuth::ApplicationController
|
3
|
-
|
4
|
-
def new
|
5
|
-
@resource = @klass.new
|
6
|
-
end
|
7
|
-
|
8
|
-
def create
|
9
|
-
@resource = @klass.where(:resourcename => params[:resourcename]).first
|
10
|
-
if @resource && @resource.authenticate(params[:password])
|
11
|
-
cookies.permanent[:auth_token] = @resource.auth_token
|
12
|
-
end
|
13
|
-
redirect_to root_url
|
14
|
-
end
|
15
|
-
|
16
|
-
def destroy
|
17
|
-
cookies.delete(:auth_token)
|
18
|
-
redirect_to root_url
|
19
|
-
end
|
20
|
-
|
21
|
-
end
|
22
|
-
end
|
@@ -1 +0,0 @@
|
|
1
|
-
<h1>Registrations#New</h1>
|
@@ -1 +0,0 @@
|
|
1
|
-
<h1>Sessions#New</h1>
|