Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Table of Contents
Specification


Apiary
Status
titlePATCH
 mithril/api/users/{user_id}/authentication_factorfactors{2fa_id}/actions/reset
Scopeauthentication_factor:resetwrite

Purpose

Reset factor value by 2fa_id for user (via Admin-console).

Request parameters

  • user_id
  • 2fa_id

Logic WS

  • Validate token & scope
  • Validate user_id FK
  • Validate 2fa_id FK
  • Get 2FA item by 2fa_id  for non-blocked user by $.user_id

    Code Block
    languagesql
    SELECT *
    FROM authentication_factors AS 2FA
    	INNER JOIN user AS U
    		ON 2FA.user_id = U.id
    WHERE 
    	U.id = $.user_id
    		AND 2FA.id = $.2fa_id
    		AND U.is_active = TRUE
    		AND U.is_blocked = FALSE
    • If  exist 2FA item for user →  update 2FA item (set values) to logical status = RESET :
      • 2FA.factor = NULL
      • 2FA.update_at = now()
  • Return 200

Response

  • 200 if 2FA successful reset  + 2FA_object_view
  • 4xx in other case