File tree Expand file tree Collapse file tree 2 files changed +9
-1
lines changed
core/src/main/java/com/web3auth/core Expand file tree Collapse file tree 2 files changed +9
-1
lines changed Original file line number Diff line number Diff line change @@ -314,6 +314,10 @@ class Web3Auth(web3AuthOptions: Web3AuthOptions) {
314314 */
315315 fun enableMFA (loginParams : LoginParams ? = null): CompletableFuture <Boolean > {
316316 enableMfaCompletableFuture = CompletableFuture ()
317+ if (web3AuthResponse?.userInfo?.isMfaEnabled == true ) {
318+ throwEnableMFAError(ErrorCode .MFA_ALREADY_ENABLED )
319+ return enableMfaCompletableFuture
320+ }
317321 val sessionId = sessionManager.getSessionId()
318322 if (sessionId.isBlank()) {
319323 throwEnableMFAError(ErrorCode .NOUSERFOUND )
Original file line number Diff line number Diff line change @@ -25,6 +25,9 @@ object Web3AuthError {
2525 ErrorCode .INVALID_LOGIN -> {
2626 " Invalid Login"
2727 }
28+ ErrorCode .MFA_ALREADY_ENABLED -> {
29+ " MFA already enabled"
30+ }
2831 }
2932 }
3033}
@@ -36,5 +39,6 @@ enum class ErrorCode {
3639 RUNTIME_ERROR ,
3740 APP_CANCELLED ,
3841 SOMETHING_WENT_WRONG ,
39- INVALID_LOGIN
42+ INVALID_LOGIN ,
43+ MFA_ALREADY_ENABLED
4044}
You can’t perform that action at this time.
0 commit comments