Skip to content

Commit

Permalink
more details in the README
Browse files Browse the repository at this point in the history
  • Loading branch information
Dan Croak committed Jul 5, 2011
1 parent ef95328 commit 270119c
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 4 deletions.
1 change: 0 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
-------------------

* [#129] Denying access redirects to root_url when signed in, sign_in_url when signed out. (Dan Croak)
* New configuration setting: denied_access_url. (Dan Croak)
* Using flash :notice key everywhere now instead of :success and :failure. More in line with Rails conventions. (Dan Croak)
* [#149] redirect_back_or on sign up. (Dan Croak)
* [#147] Resetting password no longer redirects to sign in page. It displays a message telling them to look for an email. (Dan Croak)
Expand Down
26 changes: 23 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,10 +59,30 @@ the current_user method.
current_user.articles
end

Customizing
-----------
If you want to know whether the current user is signed in or out, you can use
these methods in controllers, views, or helpers:

Clearance is intended to be small, simple, well-tested, and easy to extend.
signed_in?
signed_out?

Typically, you want to have something like this in your app, maybe in a layout:

<% if signed_in? %>
<%= current_user.email %>
<%= link_to "Sign out", sign_out_path, :method => :delete %>
<% else %>
<%= link_to "Sign in", sign_in_path %>
<% end %>

If you ever want to authenticate the user some place other than sessions/new,
maybe in an API:

User.authenticate("email@example.com", "password")

Overriding defaults
-------------------

Clearance is intended to be small, simple, well-tested, and easy to override defaults.

If you ever need to change the logic in any of the four provided controllers,
subclass the Clearance controller. You don't need to do this by default.
Expand Down

0 comments on commit 270119c

Please sign in to comment.