Skip to content

Commit

Permalink
Add error message with invalid email confirmation (mastodon#9625)
Browse files Browse the repository at this point in the history
  • Loading branch information
noellabo authored and hiyuki2578 committed Oct 2, 2019
1 parent f4578a7 commit cf8d301
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions app/controllers/api/base_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -68,12 +68,14 @@ def current_user
end

def require_user!
if current_user && !current_user.disabled? && current_user.confirmed?
set_user_activity
elsif current_user
if !current_user
render json: { error: 'This method requires an authenticated user' }, status: 422
elsif current_user.disabled?
render json: { error: 'Your login is currently disabled' }, status: 403
elsif !current_user.confirmed?
render json: { error: 'Email confirmation is not completed' }, status: 403
else
render json: { error: 'This method requires an authenticated user' }, status: 422
set_user_activity
end
end

Expand Down

0 comments on commit cf8d301

Please sign in to comment.