Comments (2)
This method is defined here - https://github.com/plataformatec/devise/blob/342304375946ca11608516eae80f78dbaae059d5/app/controllers/devise/sessions_controller.rb#L59
It will be run before our destroy
action, because we inherit from Devise::SessionsController
. I believe that it will say that there is no signed in user and prevent our destroy
action from running at all. That's why we just override it with an empty method.
I encourage you to check out what happens if you remove it. I think that the token will be not removed.
from tiddle.
Ok thanks. Btw, how to handle a situation where a user want to change his/her password?
Say, I've an AngularJS app as the client and I have a page called Change password
inside the app.
Can you give some example?
Currently, I have this:
class Users::RegistrationsController < Devise::RegistrationsController
def update
respond_to do |format|
format.html {super}
format.json {
# also required X-USER-EMAIL and X-USER-TOKEN inside the headers
email = params[:user][:email] # might send a hidden field for this email
user = User.find_by_email(email)
if params[:user][:password] == params[:user][:password_confirmation]
if user.update(password: params[:user][:password])
render json: {status: "Success", message: "Password changed"}
else
render json: {status: "Error", message: "Password not changed"}
end
else
render json: {status: "Error", message: "Password not matched"}
end
}
end
end
end
Do you have better idea?
Thanks!
from tiddle.
Related Issues (20)
- Version 1.0 HOT 2
- Fix Rubocop offences
- DEPRECATION WARNING: ActionDispatch::IntegrationTest HOT 7
- Error after installed Tiddle HOT 3
- Can't change maximum token per user
- Support devise > 4.3.X HOT 2
- Time-based expiration mechanism for tokens HOT 7
- Remove unnecessary secure compare
- Devise 4.4 HOT 4
- [Question]: What for sending X-USER-EMAIL ?
- Update required fields for README HOT 2
- Tiddle can not work with devise 4.5.0. HOT 3
- Soft purge setting `revoked_at` instead of destroying auth tokens? HOT 2
- Devise can not be updated past version >=4.6
- [Question] Cookieless Tiddle & ActionCable HOT 2
- Multiple types of Users HOT 1
- Token last_used_at not being updated properly HOT 5
- Tokens pile up in the database forever HOT 1
- Switch dev setup to use Docker
- Mongoid support HOT 1
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 tiddle.