Skip to content

Commit

Permalink
fix error from wiring backend and frontend (mosip#33)
Browse files Browse the repository at this point in the history
Signed-off-by: Sreang Rathanak <[email protected]>
  • Loading branch information
panharith-0118 authored and Sreang Rathanak committed Jan 15, 2024
1 parent 5c12ab6 commit 274e168
Show file tree
Hide file tree
Showing 6 changed files with 18 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,7 @@
import io.mosip.esignet.core.dto.RequestWrapper;
import io.mosip.esignet.core.dto.ResponseWrapper;
import io.mosip.esignet.core.util.IdentityProviderUtil;
import io.mosip.signup.dto.GenerateChallengeRequest;
import io.mosip.signup.dto.GenerateChallengeResponse;
import io.mosip.signup.dto.RegistrationStatusResponse;
import io.mosip.signup.dto.RegisterRequest;
import io.mosip.signup.dto.RegisterResponse;
import io.mosip.signup.dto.VerifyChallengeRequest;
import io.mosip.signup.dto.VerifyChallengeResponse;
import io.mosip.signup.dto.*;
import io.mosip.signup.exception.SignUpException;
import io.mosip.signup.services.RegistrationService;
import io.mosip.signup.util.ErrorConstants;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,11 @@

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

@Data
@AllArgsConstructor
@NoArgsConstructor
public class RestError {

private String errorCode;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -319,7 +319,7 @@ private void validateTransaction(RegistrationTransaction transaction, String ide

if(transaction.getLastRetryToNow() <= resendDelay) {
log.error("generate-challenge failed: too early attempts");
throw new GenerateChallengeException(ErrorConstants.ACTIVE_CHALLENGE_FOUND);
throw new GenerateChallengeException(ErrorConstants.TOO_EARLY_ATTEMPT);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,5 +27,6 @@ public class ErrorConstants {
public static final String HASH_GENERATE_FAILED = "hash_generate_failed";
public static final String GET_UIN_FAILED = "get_uin_failed";
public static final String INVALID_FULLNAME = "invalid_fullname";
public static final String TOO_EARLY_ATTEMPT = "too_early_attempt";

}
20 changes: 12 additions & 8 deletions signup-service/src/main/resources/application-default.properties
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
## ---------------------------------------------------------------------------------------------------------------------
# challenge.timeout, resend-delay are count as seconds
mosip.signup.supported.challenge-type=OTP
mosip.signup.supported.challenge-format-types={'alpha-numeric'}
mosip.signup.id-schema.version=0.2
mosip.signup.identifier.regex=\\+855\\d{8,9}
mosip.signup.identifier.prefix=+855
mosip.signup.supported-languages={'khm','eng'}
mosip.signup.password.pattern=^.{8,}$
mosip.signup.fullname.pattern=^[\p{Khmer}\s]{1,30}$
mosip.signup.password.max-length=20
mosip.signup.password.min-length=8
mosip.signup.fullname.pattern=^[\u1780-\u17FF\u19E0-\u19FF\u1A00-\u1A9F\u0020]{1,30}$

## Time given to generate and verify the challenge in seconds.
## Default resend delay is 60 seconds, with 3 attempts, so 60*3=180 seconds.
Expand Down Expand Up @@ -89,20 +90,23 @@ mosip.signup.captcha-validator.site-key=6LcdIvsoAAAAAMq_WeWuxfxgt26Nl3cjvMc-4IUJ
mosip.signup.captcha-validator.secret=6LcdIvsoAAAAALn0Rg5ajDSUAyeBgEOaJmCbL3pX

## ----------------------------- UI-Config -----------------------------------------------------------------------------
# Only after current challenge timeout we should enable resend in the UI.
# In this case timeout and resend-delay should be same always.
mosip.signup.ui.config.key-values={\
'identifier.pattern': '${mosip.signup.identifier.regex}', \
'identifier.prefix': '${mosip.signup.identifier.prefix}', \
'captcha.site.key': '${mosip.signup.captcha-validator.site-key}', \
'otp.length': 6, \
'password.pattern': '${mosip.signup.password.pattern}', \
'password.length.max': '${mosip.signup.password.max-length}', \
'password.length.min': '${mosip.signup.password.min-length}', \
'challenge.timeout': '${mosip.signup.challenge.resend-delay}', \
'resend.attempts': '${mosip.signup.challenge.resend-attempt}', \
'resend.delay': '${mosip.signup.challenge.resend-delay}', \
'password.length.max': ${mosip.signup.password.max-length}, \
'password.length.min': ${mosip.signup.password.min-length}, \
'challenge.timeout': ${mosip.signup.challenge.resend-delay}, \
'resend.attempts': ${mosip.signup.challenge.resend-attempt}, \
'resend.delay': ${mosip.signup.challenge.resend-delay}, \
'fullname.pattern': '${mosip.signup.fullname.pattern}', \
'status.request.delay': '${mosip.signup.status.request.delay}', \
'status.request.limit': '${mosip.signup.status.request.limit}' \
'status.request.delay': ${mosip.signup.status.request.delay}, \
'status.request.limit': ${mosip.signup.status.request.limit}, \
'popup.timeout': 10 \
}
## ----------------------------- SMS-message -----------------------------------------------------------------------------
mosip.signup.sms-notification-template.send-otp.khm=ប្រើ {challenge} ដើម្បីផ្ទៀងផ្ទាត់គណនី KhID របស់អ្នក។
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -798,7 +798,7 @@ public void doGenerateChallenge_withToEarlyAttemptTransactionId_thenFail() throw
registrationService.generateChallenge(generateChallengeRequest, transactionId);
Assert.fail();
} catch (GenerateChallengeException ex) {
Assert.assertEquals(ErrorConstants.ACTIVE_CHALLENGE_FOUND, ex.getErrorCode());
Assert.assertEquals(ErrorConstants.TOO_EARLY_ATTEMPT, ex.getErrorCode());
}
}

Expand Down

0 comments on commit 274e168

Please sign in to comment.