|
|
@@ -365,7 +365,7 @@ func authenticateUser(response http.ResponseWriter, request *http.Request) {
|
|
|
|
|
|
var successResponse models.SuccessResponse
|
|
|
|
|
|
- if logic.IsMFAEnabled() && user.IsMFAEnabled {
|
|
|
+ if user.IsMFAEnabled {
|
|
|
successResponse = models.SuccessResponse{
|
|
|
Code: http.StatusOK,
|
|
|
Message: "W1R3: TOTP required",
|
|
|
@@ -452,13 +452,6 @@ func initiateTOTPSetup(w http.ResponseWriter, r *http.Request) {
|
|
|
return
|
|
|
}
|
|
|
|
|
|
- if !logic.IsMFAEnabled() {
|
|
|
- err = fmt.Errorf("mfa is disabled, cannot process totp setup")
|
|
|
- logger.Log(0, err.Error())
|
|
|
- logic.ReturnErrorResponse(w, r, logic.FormatError(err, "badrequest"))
|
|
|
- return
|
|
|
- }
|
|
|
-
|
|
|
if user.IsMFAEnabled {
|
|
|
err = fmt.Errorf("mfa is already enabled for user, cannot process totp setup")
|
|
|
logger.Log(0, err.Error())
|
|
|
@@ -545,13 +538,6 @@ func completeTOTPSetup(w http.ResponseWriter, r *http.Request) {
|
|
|
return
|
|
|
}
|
|
|
|
|
|
- if !logic.IsMFAEnabled() {
|
|
|
- err = fmt.Errorf("mfa is disabled, cannot process totp setup")
|
|
|
- logger.Log(0, err.Error())
|
|
|
- logic.ReturnErrorResponse(w, r, logic.FormatError(err, "badrequest"))
|
|
|
- return
|
|
|
- }
|
|
|
-
|
|
|
if user.IsMFAEnabled {
|
|
|
err = fmt.Errorf("mfa is already enabled for user, cannot process totp setup")
|
|
|
logger.Log(0, err.Error())
|
|
|
@@ -612,13 +598,6 @@ func verifyTOTP(w http.ResponseWriter, r *http.Request) {
|
|
|
return
|
|
|
}
|
|
|
|
|
|
- if !logic.IsMFAEnabled() {
|
|
|
- err = fmt.Errorf("mfa is disabled, cannot process totp verification")
|
|
|
- logger.Log(0, err.Error())
|
|
|
- logic.ReturnErrorResponse(w, r, logic.FormatError(err, "badrequest"))
|
|
|
- return
|
|
|
- }
|
|
|
-
|
|
|
if !user.IsMFAEnabled {
|
|
|
err = fmt.Errorf("mfa is disabled for user(%s), cannot process totp verification", username)
|
|
|
logger.Log(0, err.Error())
|