Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enhancement: changed error codes for the APIs #1387

Open
wants to merge 1 commit into
base: 2-6-stable
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions app/api/v2/identity/users.rb
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,8 @@ def parse_refid!
success: { code: 201, message: 'Generated verification code' },
failure: [
{ code: 400, message: 'Required params are missing' },
{ code: 422, message: 'Validation errors' }
{ code: 422, message: 'Validation errors' },
{ code: 404, message: 'User doesn\'t exist'}
]
params do
requires :email,
Expand All @@ -125,7 +126,7 @@ def parse_refid!
current_user = User.find_by_email(params[:email])

if current_user.nil? || current_user.active?
return status 201
return status 404
end

publish_confirmation(current_user, Barong::App.config.domain)
Expand Down Expand Up @@ -194,7 +195,7 @@ def parse_refid!

current_user = User.find_by_email(params[:email])

return status 201 if current_user.nil?
return status 404 if current_user.nil?

reset_token = SecureRandom.hex(10)
token = codec.encode(sub: 'reset', email: params[:email], uid: current_user.uid, reset_token: reset_token)
Expand Down