Revert "Refine and document controllers"
This reverts commit 0e0da9c765457a1a9ef3137c3bf2f6f6939971a4.
This commit is contained in:
parent
87ec883cd8
commit
99923ae97d
@ -9,7 +9,7 @@ class PasswordsController < ApplicationController
|
|||||||
PasswordsMailer.reset(user).deliver_later
|
PasswordsMailer.reset(user).deliver_later
|
||||||
end
|
end
|
||||||
|
|
||||||
render json: {}, status: :created
|
render json: {}, status: :ok
|
||||||
end
|
end
|
||||||
|
|
||||||
def update
|
def update
|
||||||
@ -25,6 +25,6 @@ class PasswordsController < ApplicationController
|
|||||||
def set_user_by_token
|
def set_user_by_token
|
||||||
@user = User.find_by_password_reset_token!(params[:token])
|
@user = User.find_by_password_reset_token!(params[:token])
|
||||||
rescue ActiveSupport::MessageVerifier::InvalidSignature
|
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
|
||||||
end
|
end
|
||||||
|
@ -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
|
|
@ -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
|
|
@ -9,22 +9,6 @@ module SwaggerResponseHelper
|
|||||||
end
|
end
|
||||||
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
|
def response_empty_200
|
||||||
response(200, 'Success') do
|
response(200, 'Success') do
|
||||||
produces 'application/json'
|
produces 'application/json'
|
||||||
|
Loading…
x
Reference in New Issue
Block a user