Comments (5)
can't remember why.
from clearance.
I actually would have found this useful. My app layout has a login link if there is no current users, and a logout link if there is. I wanted the login form to return to the calling page if login is successful, and the logout link to redirect to the current page as well. So I ended up doing this:
class SessionsController < Clearance::SessionsController
# if login or logout has a :return_to parameter, save it
# so that user will return to her previous page before logging in or out
before_filter do |controller|
return_to = controller.params[:return_to]
controller.session[:return_to] = return_to unless return_to.blank?
end
# Change the redirect behavior of session destroy (logout)
def url_after_destroy
session[:return_to] || sign_in_url
end
end
from clearance.
I committed a fix to this to my fork at
http://github.com/rnewman57/clearance/commit/57bba85dc63ba7f0ae7a138743ab228afb994ac6
from clearance.
A new commit that incorporates this fix:
http://github.com/rnewman57/clearance/commit/a4d19ec27479887f978a429130fd10bc74a52268
from clearance.
Applying this diff to the current version of Clearance will fix and test this issue (and also #78) :
from clearance.
Related Issues (20)
- Cookie not attached to responses when Clearance API is used directly (>= 2.3.0) HOT 3
- Doc typo for config.httponly HOT 1
- Hotwire Turbo Support HOT 2
- Disable auto-login after password reset HOT 4
- Clearance::User email validation `strict_mode: true` option has no effect HOT 1
- i18n is not working when I copied yaml file to config/locale HOT 1
- Ruby 3.0+ support, and support for older Rails version HOT 1
- using clearance without actionmailer? HOT 10
- undefined method 'visit' on request spec
- Generated specs don't work with secure cookies HOT 2
- Rails 7 support HOT 1
- Translation for pt-BR
- Sign up shows no flash message when trying to sign up with already available email
- Feature request: implement "A Well-Known URL for Changing Passwords"
- The backdoor for testing doesn't work with follow redirects HOT 2
- Sign in possibly succeeds for null user
- Clearance cookie expiration doesn't respect time travel in tests
- Feature request: Disable public password reset.
- Feature Request: Allow generator to use a different model like Admin User
- Circular require
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from clearance.