Coder Social home page Coder Social logo

api_session_recovering's Introduction

Maintainability Test Coverage Build Status

ApiSessionRecovering

ApiSessionRecovering.

Only Rails > 5 support.

Installation

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)

Request params

  • 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)
  }
}

SWAGGER

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

HOWTO (steps)

  1. restore password
  2. reset password validation (if needed)
  3. reset password!

Have questions/want to know how to configure somethig?

We have prepared cool Wiki page for You!

About MLSDev

MLSdev

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!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.