Feature #34242

Include two-factor authentication scheme in users API response

Added by Go MAEDA 11 months ago. Updated 9 months ago.

Status:ClosedStart date:
Priority:NormalDue date:
Assignee:Go MAEDA% Done:


Category:REST API
Target version:4.2.0


By #1237, a new column "twofa_scheme" that represents the two-factor authentication scheme enabled for the user. You can also know whether two-factor auth is enabled for the user by checking the column's value.

I think Users API should export the new column as well.

diff --git a/app/views/users/show.api.rsb b/app/views/users/show.api.rsb
index 3bc77e3be..5fe3d5b1c 100644
--- a/app/views/users/show.api.rsb
+++ b/app/views/users/show.api.rsb
@@ -9,6 +9,7 @@ api.user do
   api.updated_on @user.updated_on
   api.last_login_on     @user.last_login_on
   api.passwd_changed_on @user.passwd_changed_on
+  api.twofa_scheme      @user.twofa_scheme
   api.api_key    @user.api_key if User.current.admin? || (User.current == @user)
   api.status     @user.status if User.current.admin?

Possible values:
  • null: Two-factor authentication is disabled
  • "totp": Two-factor authentication with TOTP is enabled

feature-34242.patch Magnifier (3.77 KB) Mizuki ISHIKAWA, 2020-11-11 07:43

Associated revisions

Revision 20686
Added by Go MAEDA 9 months ago

Include two-factor authentication scheme in users API response (#34242).

Patch by Mizuki ISHIKAWA.

Revision 20687
Added by Go MAEDA 9 months ago

Users API should return twofa_scheme only for administrators (#34242).


#1 Updated by Go MAEDA 11 months ago

  • Tracker changed from Defect to Feature

#2 Updated by Mizuki ISHIKAWA 10 months ago

I attach the patch.

#3 Updated by Go MAEDA 10 months ago

  • Target version set to 4.2.0

LGTM. Setting the target version to 4.2.0.

#4 Updated by Go MAEDA 9 months ago

  • Status changed from New to Closed
  • Assignee set to Go MAEDA
  • Resolution set to Fixed

Committed the patch. Thank you for your contribution.

Also available in: Atom PDF