about summary refs log tree commit diff
path: root/app
diff options
context:
space:
mode:
authorTakeshi Umeda <noel.yoshiba@gmail.com>2018-12-26 03:35:26 +0900
committerEugen Rochko <eugen@zeonfederated.com>2018-12-25 19:35:26 +0100
commitbf70e5cfdaef9b7a3a927548a05203a864d5bea9 (patch)
treeb8e160f4cd9caebbb3aa9a8a4062cf9e8723c0ef /app
parent6641a1cac90e65db2c4371306d6b4e3785d69857 (diff)
Add error message with invalid email confirmation (#9625)
Diffstat (limited to 'app')
-rw-r--r--app/controllers/api/base_controller.rb10
1 files changed, 6 insertions, 4 deletions
diff --git a/app/controllers/api/base_controller.rb b/app/controllers/api/base_controller.rb
index 2bf8e82db..a1dd30918 100644
--- a/app/controllers/api/base_controller.rb
+++ b/app/controllers/api/base_controller.rb
@@ -68,12 +68,14 @@ class Api::BaseController < ApplicationController
   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