forked from binarylogic/authlogic_example
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
45c6197
commit 7a8f30b
Showing
7 changed files
with
43 additions
and
59 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,12 @@ | ||
# Authlogic Example App | ||
|
||
This is an example of how to use Authlogic in a rails app. Authlogic is an object based authentication solution that handles all of the non sense for you. It's as easy as ActiveRecord is with a database. | ||
This is an example of how to use Authlogic in a rails app. Authlogic is a clean, simple, and unobtrusive ruby authentication solution. | ||
|
||
This application live: [http://authlogicexample.binarylogic.com](http://authlogicexample.binarylogic.com) | ||
|
||
Basic setup tutorial: [http://www.binarylogic.com/2008/11/3/tutorial-authlogic-basic-setup](http://www.binarylogic.com/2008/11/3/tutorial-authlogic-basic-setup) | ||
Reset passwords tutorial: [http://www.binarylogic.com/2008/11/16/tutorial-reset-passwords-with-authlogic](http://www.binarylogic.com/2008/11/16/tutorial-reset-passwords-with-authlogic) | ||
Open ID tutorial: [http://www.binarylogic.com/2008/11/21/tutorial-using-openid-with-authlogic](http://www.binarylogic.com/2008/11/21/tutorial-using-openid-with-authlogic) | ||
|
||
Authlogic: [http://github.com/binarylogic/authlogic](http://github.com/binarylogic/authlogic) | ||
* This application live: [http://authlogicexample.binarylogic.com](http://authlogicexample.binarylogic.com) | ||
* Basic setup tutorial: [http://www.binarylogic.com/2008/11/3/tutorial-authlogic-basic-setup](http://www.binarylogic.com/2008/11/3/tutorial-authlogic-basic-setup) | ||
* Reset passwords tutorial: [http://www.binarylogic.com/2008/11/16/tutorial-reset-passwords-with-authlogic](http://www.binarylogic.com/2008/11/16/tutorial-reset-passwords-with-authlogic) | ||
* Open ID tutorial: [http://www.binarylogic.com/2008/11/21/tutorial-using-openid-with-authlogic](http://www.binarylogic.com/2008/11/21/tutorial-using-openid-with-authlogic) | ||
* Authlogic: [http://github.com/binarylogic/authlogic](http://github.com/binarylogic/authlogic) | ||
|
||
|
||
Copyright (c) 2008 [Ben Johnson](http://github.com/binarylogic) of [Binary Logic](http://www.binarylogic.com), released under the MIT license |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,25 +1,6 @@ | ||
# Read about fixtures at http://ar.rubyonrails.org/classes/Fixtures.html | ||
|
||
one: | ||
login: MyString | ||
crypted_password: MyString | ||
password_salt: MyString | ||
remember_token: MyString | ||
login_count: 1 | ||
last_request_at: 2008-11-03 12:13:27 | ||
last_login_at: 2008-11-03 12:13:27 | ||
current_login_at: 2008-11-03 12:13:27 | ||
last_login_ip: MyString | ||
current_login_ip: MyString | ||
|
||
two: | ||
login: MyString | ||
crypted_password: MyString | ||
password_salt: MyString | ||
remember_token: MyString | ||
login_count: 1 | ||
last_request_at: 2008-11-03 12:13:27 | ||
last_login_at: 2008-11-03 12:13:27 | ||
current_login_at: 2008-11-03 12:13:27 | ||
last_login_ip: MyString | ||
current_login_ip: MyString | ||
ben: | ||
login: bjohnson | ||
password_salt: <%= salt = User.unique_token %> | ||
crypted_password: <%= Authlogic::CryptoProviders::Sha512.encrypt("benrocks" + salt) %> | ||
persistence_token: 6cde0674657a8a313ce952df979de2830309aa4c11ca65805dd00bfdc65dbcc2f5e36718660a1d2e68c1a08c276d996763985d2f06fd3d076eb7bc4d97b1e317 | ||
email: ben@ben.com |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,21 @@ | ||
require 'test_helper' | ||
|
||
class UserSessionsControllerTest < ActionController::TestCase | ||
# Replace this with your real tests. | ||
test "the truth" do | ||
assert true | ||
test "should get new" do | ||
get :new | ||
assert_response :success | ||
end | ||
|
||
test "should create user session" do | ||
post :create, :user_session => { :login => "bjohnson", :password => "benrocks" } | ||
assert user_session = UserSession.find | ||
assert_equal users(:ben), user_session.user | ||
assert_redirected_to account_path | ||
end | ||
|
||
test "should destroy user session" do | ||
delete :destroy | ||
assert_nil UserSession.find | ||
assert_redirected_to new_user_session_path | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,42 +1,34 @@ | ||
require 'test_helper' | ||
|
||
class UsersControllerTest < ActionController::TestCase | ||
=begin | ||
test "should get new" do | ||
get :new | ||
assert_response :success | ||
end | ||
test "should create user" do | ||
assert_difference('User.count') do | ||
post :create, :user => { } | ||
post :create, :user => { :login => "ben", :password => "benrocks", :password_confirmation => "benrocks", :email => "myemail@email.com" } | ||
end | ||
assert_redirected_to user_path(assigns(:user)) | ||
assert_redirected_to account_path | ||
end | ||
=end | ||
test "should show user" do | ||
set_session_for(users(:ben)) | ||
get :show | ||
assert_response :success | ||
end | ||
|
||
=begin | ||
test "should get edit" do | ||
get :edit, :id => users(:one).id | ||
set_session_for(users(:ben)) | ||
get :edit, :id => users(:ben).id | ||
assert_response :success | ||
end | ||
|
||
test "should update user" do | ||
put :update, :id => users(:one).id, :user => { } | ||
assert_redirected_to user_path(assigns(:user)) | ||
end | ||
test "should destroy user" do | ||
assert_difference('User.count', -1) do | ||
delete :destroy, :id => users(:one).id | ||
end | ||
assert_redirected_to users_path | ||
set_session_for(users(:ben)) | ||
put :update, :id => users(:ben).id, :user => { } | ||
assert_redirected_to account_path | ||
end | ||
=end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters