diff --git a/app/controllers/concerns/rack_session_fix_controller.rb b/app/controllers/concerns/rack_session_fix_controller.rb new file mode 100644 index 00000000..a9013e27 --- /dev/null +++ b/app/controllers/concerns/rack_session_fix_controller.rb @@ -0,0 +1,19 @@ +module RackSessionFixController + extend ActiveSupport::Concern + + class FakeRackSession < Hash + def enabled? + false + end + end + + included do + before_action :set_fake_rack_session_for_devise + + private + + def set_fake_rack_session_for_devise + request.env['rack.session'] ||= FakeRackSession.new + end + end +end \ No newline at end of file diff --git a/app/controllers/users/authentication.http b/app/controllers/users/authentication.http index e3f676f4..942e4e4f 100644 --- a/app/controllers/users/authentication.http +++ b/app/controllers/users/authentication.http @@ -27,4 +27,26 @@ Authorization: Bearer eyJhbGciOiJIUzI1NiJ9.eyJzdWIiOiIyMiIsInNjcCI6InVzZXIiLCJhd ### Delete User Account ### DELETE http://localhost:3000/users -Authorization: Bearer eyJhbGciOiJIUzI1NiJ9.eyJzdWIiOiIyMiIsInNjcCI6InVzZXIiLCJhdWQiOm51bGwsImlhdCI6MTY5MTk2MTQwNywiZXhwIjoxNjkxOTYxNzA3LCJqdGkiOiJiZDM3MzZiMi1mYTE3LTRiYzYtYjZmZS03MWMyMDlhOTdmZDQifQ.WhiAMuPRJNR2C9wr2hZ5Ma5Yc-fbk1iIuaB0cXGLGfc \ No newline at end of file +Authorization: Bearer eyJhbGciOiJIUzI1NiJ9.eyJzdWIiOiIyMiIsInNjcCI6InVzZXIiLCJhdWQiOm51bGwsImlhdCI6MTY5MTk2MTQwNywiZXhwIjoxNjkxOTYxNzA3LCJqdGkiOiJiZDM3MzZiMi1mYTE3LTRiYzYtYjZmZS03MWMyMDlhOTdmZDQifQ.WhiAMuPRJNR2C9wr2hZ5Ma5Yc-fbk1iIuaB0cXGLGfc + +### Recover password email ### +POST http://localhost:3000/users/password +Content-Type: application/json + +{ + "user": { + "email": "test@gmail.com" + } +} + +### Recover password ### +PATCH http://localhost:3000/users/password +Content-Type: application/json + +{ + "user": { + "reset_password_token": "CkzYfzUACpnzjnEyvSyo", + "password": "1111ilovemaristas24A###", + "password_confirmation": "1111ilovemaristas24A###" + } +} \ No newline at end of file diff --git a/app/controllers/users/passwords_controller.rb b/app/controllers/users/passwords_controller.rb new file mode 100644 index 00000000..3474c09a --- /dev/null +++ b/app/controllers/users/passwords_controller.rb @@ -0,0 +1,3 @@ +class Users::PasswordsController < Devise::PasswordsController + include RackSessionFixController +end diff --git a/config/routes.rb b/config/routes.rb index 68e13fce..58894f32 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -6,6 +6,7 @@ devise_for :users, controllers: { sessions: 'users/sessions', - registrations: 'users/registrations' + registrations: 'users/registrations', + passwords: 'users/passwords' } end