ApiSessionRecovering
.
Only Rails > 5
support.
Add these gems to your Gemfile
gem 'api_session_recovering', github: 'MLSDev/api_session_recovering', tag: 'LATEST_VERSION'
gem 'geocoder'
...and run bundle install
to install the gems.
Next, run:
# add an initializer to config/initializers with all of the configuration options
rails g api_session_recovering:install
# This will add the necessary migrations to your app's db/migrate directory
rails api_session_recovering:install:migrations
# This will run any pending migrations
rails db:migrate
then add the following to your routes.rb file:
# config/routes.rb
mount ApiSessionRecovering::Engine => '/api'
# or inside api namespace
namespace :api do
mount ApiSessionRecovering::Engine => '/'
end
It will generate routes like
Routes for ApiSessionRecovering::Engine:
session_recovering_restore_password POST /session_recovering/restore_password(.:format)
session_recovering_reset_password_validation POST /session_recovering/reset_passwords/validate(.:format)
session_recovering_reset_password POST /session_recovering/reset_password(.:format)
- POST /session_recovering/restore_password(.:format)
{
"restore_password": {
"frontend_path": ...,
"email": ...
}
}
OR
{
"restore_password": {
"frontend_path": ...,
"phone": ...
}
}
- POST /session_recovering/reset_passwords/validate(.:format)
{
"email": ...,
"token": ...
}
- POST /session_recovering/reset_password(.:format)
{
"reset_password": {
"token": ...,
"password": ...,
"password_confirmation": ...,
"email": ... // token should be unique in scope of email (security reasons)
}
}
Add in SWAGGERED_CLASSES array in api docs controller of project (if swagger gem is used in project)
ApiSessionRecovering::SWAGGER_CLASSES
And call on array flatten
method like this
SWAGGERED_CLASSES = [
SomeClass,
ApiSessionRecovering::SWAGGER_CLASSES,
].flatten.freeze
it will add reset password
and restore password
documentation
- restore password
- reset password validation (if needed)
- reset password!
We have prepared cool Wiki page for You!
ApiSessionRecovering is maintained by MLSDev, Inc. We specialize in providing all-in-one solution in mobile and web development. Our team follows Lean principles and works according to agile methodologies to deliver the best results reducing the budget for development and its timeline.
Find out more here and don't hesitate to contact us!