diff --git a/app/controllers/passwords_controller.rb b/app/controllers/passwords_controller.rb index 1189710..9877034 100644 --- a/app/controllers/passwords_controller.rb +++ b/app/controllers/passwords_controller.rb @@ -9,7 +9,7 @@ class PasswordsController < ApplicationController PasswordsMailer.reset(user).deliver_later end - render json: {}, status: :created + render json: {}, status: :ok end def update @@ -25,6 +25,6 @@ class PasswordsController < ApplicationController def set_user_by_token @user = User.find_by_password_reset_token!(params[:token]) rescue ActiveSupport::MessageVerifier::InvalidSignature - render json: { errors: ['Password reset link is invalid or has expired.'] }, status: :unprocessable_entity + redirect_to new_password_path, alert: 'Password reset link is invalid or has expired.' end end diff --git a/spec/requests/passwords_spec.rb b/spec/requests/passwords_spec.rb deleted file mode 100644 index 510177a..0000000 --- a/spec/requests/passwords_spec.rb +++ /dev/null @@ -1,40 +0,0 @@ -require 'swagger_helper' - -RSpec.describe 'passwords', type: :request do - path '/passwords' do - post('send a password (re)set email') do - tags 'Passwords' - consumes 'application/json' - produces 'application/json' - parameter name: :body, in: :body, schema: { - type: :object, - required: [:email_address], - properties: { - email_address: { type: :string, format: :email } - } - } - - response_empty_201 - end - end - - path '/passwords/{token}' do - parameter name: 'token', in: :path, type: :string, description: 'token' - put('update password') do - tags 'Passwords' - consumes 'application/json' - produces 'application/json' - parameter name: :body, in: :body, schema: { - type: :object, - required: %i[password password_confirmation], - properties: { - password: { type: :string }, - password_confirmation: { type: :string } - } - } - - response_empty_200 - response_422 - end - end -end diff --git a/spec/requests/sessions_spec.rb b/spec/requests/sessions_spec.rb deleted file mode 100644 index 3800088..0000000 --- a/spec/requests/sessions_spec.rb +++ /dev/null @@ -1,29 +0,0 @@ -require 'swagger_helper' - -RSpec.describe 'sessions', type: :request do - path '/session' do - delete('delete session') do - tags 'Sessions' - produces 'application/json' - response_empty_200 - end - - post('create session') do - tags 'Sessions' - consumes 'application/json' - produces 'application/json' - parameter name: :body, in: :body, schema: { - type: :object, - required: %i[email_address password], - properties: { - email_address: { type: :string, format: :email }, - password: { type: :string } - } - } - - response_empty_201 - response_401 - response_429 - end - end -end diff --git a/spec/swagger_response_helper.rb b/spec/swagger_response_helper.rb index d0812dd..1f84ebd 100644 --- a/spec/swagger_response_helper.rb +++ b/spec/swagger_response_helper.rb @@ -9,22 +9,6 @@ module SwaggerResponseHelper end end - def response_429 - response(429, 'Rate limit exceeded') do - produces 'application/json' - error_schema - xit - end - end - - def response_401 - response(401, 'Unauthorized') do - produces 'application/json' - error_schema - xit - end - end - def response_empty_200 response(200, 'Success') do produces 'application/json'