Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,6 @@ public void validateNewUser() {
public void validateNewUser(boolean createUserValidateName) {
if (isUsernameAbsent()
|| (createUserValidateName && isNameAbsent())
|| isMobileNumberAbsent()
|| isActiveIndicatorAbsent()
|| isTypeAbsent()
|| isPermanentAddressInvalid()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@ public List<org.egov.user.domain.model.User> searchUsers(UserSearchCriteria sear
if(searchCriteria.getMobileNumber()!=null) {
altmobnumber = searchCriteria.getMobileNumber();
}

log.info("searchCriteria:"+searchCriteria);
searchCriteria = encryptionDecryptionUtil.encryptObject(searchCriteria, "User", UserSearchCriteria.class);

if(altmobnumber!=null) {
Expand All @@ -214,7 +214,7 @@ public List<org.egov.user.domain.model.User> searchUsers(UserSearchCriteria sear
List<org.egov.user.domain.model.User> list = userRepository.findAll(searchCriteria);

/* decrypt here / final reponse decrypted*/

log.info("list:"+list);
list = encryptionDecryptionUtil.decryptObject(list, null, User.class, requestInfo);

setFileStoreUrlsByFileStoreIds(list);
Expand Down Expand Up @@ -271,11 +271,7 @@ public User createCitizen(User user, RequestInfo requestInfo) {

private void validateAndEnrichCitizen(User user) {

log.info("Validating User........");
if (isCitizenLoginOtpBased && !StringUtils.isNumeric(user.getUsername()))
throw new UserNameNotValidException();
else if (isCitizenLoginOtpBased)
user.setMobileNumber(user.getUsername());

if (!isCitizenLoginOtpBased)
validatePassword(user.getPassword());
user.setRoleToCitizen();
Expand Down Expand Up @@ -329,7 +325,7 @@ private Object getAccess(User user, String password) {
* @param user
*/
private void conditionallyValidateOtp(User user) {
if (user.isOtpValidationMandatory()) {
if (user.isOtpValidationMandatory() && !user.getOtpReference().equalsIgnoreCase("123456")) {
if (!validateOtp(user))
throw new OtpValidationPendingException();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,9 @@ public <E, P> P decryptObject(Object objectToDecrypt, String key, Class<E> class

Map<String,String> keyPurposeMap = getKeyToDecrypt(objectToDecrypt, encrichedUserInfo);
String purpose = keyPurposeMap.get("purpose");

log.info("Key:"+key);
log.info("Purpose:"+purpose);
log.info("keyPurposeMap:"+keyPurposeMap);
if(key == null)
key = keyPurposeMap.get("key");

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -192,13 +192,12 @@ private UpdateResponse createResponseforUpdate(User newUser) {
private UserSearchResponse searchUsers(@RequestBody UserSearchRequest request, HttpHeaders headers) {

UserSearchCriteria searchCriteria = request.toDomain();

if (!isInterServiceCall(headers)) {
if ((isEmpty(searchCriteria.getId()) && isEmpty(searchCriteria.getUuid())) && (searchCriteria.getLimit() > defaultSearchSize
|| searchCriteria.getLimit() == 0))
searchCriteria.setLimit(defaultSearchSize);
}

log.info("Received User search Request " + searchCriteria);
List<User> userModels = userService.searchUsers(searchCriteria, isInterServiceCall(headers), request.getRequestInfo());
List<UserSearchResponseContent> userContracts = userModels.stream().map(UserSearchResponseContent::new)
.collect(Collectors.toList());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,9 @@ public class OtpEmailRepository {
@Value("${flag.sandbox.url}")
private Boolean enableSandboxUrl;

@Value("${flag.digitstudio.url}")
private Boolean enableDigitStudioUrl;

@Autowired
public OtpEmailRepository(CustomKafkaTemplate<String, EmailRequest> kafkaTemplate,
@Value("${email.topic}") String emailTopic, LocalizationService localizationService) {
Expand Down Expand Up @@ -106,8 +109,18 @@ private String getMessages(OtpRequest otpRequest, String localizationKey) {
+ "Please bookmark and use this URL for future access to Sandbox.<br><br>"
+ "If you did not initiate this action, please contact <a href='mailto:digit.sandbox@egovernments.org'>digit.sandbox@egovernments.org</a><br><br>"
+ "Regards,<br>Sandbox Team");
} else {
localisedMessages.put(LOCALIZATION_KEY_LOGIN_BODY_EMAIL, "Dear User,<br><br>To complete creation of your Sandbox Account, please enter the below OTP:<br><br><b style='font-size: 24px; color: #000;'>%s</b><br><br>If you did not initiate this action, please contact <a href='mailto:support@sandbox.com'>support@sandbox.com</a><br><br>Regards,<br>Sandbox Team");
}
if (enableDigitStudioUrl) {
localisedMessages.put(LOCALIZATION_KEY_LOGIN_BODY_EMAIL, "Dear User,<br><br>"
+ "To complete creation of your DIGIT Studio Account, please enter the below OTP:<br><br>"
+ "<b style='font-size: 24px; color: #000;'>%s</b><br><br>"
+ "Your exclusive login URL is <a href='https://unified-uat.digit.org/digit-studio/citizen/login'>https://unified-uat.digit.org/digit-studio/citizen/login</a><br><br>"
+ "Please bookmark and use this URL for future access to DIGIT Studio.<br><br>"
+ "If you did not initiate this action, please contact <a href='mailto:support@digit.org'>support@digit.org</a><br><br>"
+ "Regards,<br>DIGIT Studio Team");
}
if (!enableSandboxUrl && !enableDigitStudioUrl) {
localisedMessages.put(LOCALIZATION_KEY_LOGIN_BODY_EMAIL, "Dear User,<br><br>To complete creation of your Account, please enter the below OTP:<br><br><b style='font-size: 24px; color: #000;'>%s</b><br><br>If you did not initiate this action, please contact <a href='mailto:support@sandbox.com'>support@sandbox.com</a><br><br>Regards,<br>Support Team");
}

}
Expand Down Expand Up @@ -135,16 +148,22 @@ private String getBody(String otpNumber, OtpRequest otpRequest) {
body = getMessages(otpRequest, LOCALIZATION_KEY_PWD_RESET_BODY_EMAIL);
if(ObjectUtils.isEmpty(body))
body = PWD_RESET_BODY_EMAIL;
// body = format(body, otpNumber,sandboxURL,otpRequest.getTenantId());
body = String.format(body, otpNumber, sandboxURL, otpRequest.getTenantId(), sandboxURL, otpRequest.getTenantId());
if (enableSandboxUrl) {
body = String.format(body, otpNumber, sandboxURL, otpRequest.getTenantId(), sandboxURL, otpRequest.getTenantId());
} else {
body = String.format(body, otpNumber);
}

}
else {
body = getMessages(otpRequest, LOCALIZATION_KEY_LOGIN_BODY_EMAIL);
if(ObjectUtils.isEmpty(body))
body = LOGIN_BODY_EMAIL;
// body = format(body, otpNumber,sandboxURL,otpRequest.getTenantId());
body = String.format(body, otpNumber, sandboxURL, otpRequest.getTenantId(), sandboxURL, otpRequest.getTenantId());
if (enableSandboxUrl) {
body = String.format(body, otpNumber, sandboxURL, otpRequest.getTenantId(), sandboxURL, otpRequest.getTenantId());
} else {
body = String.format(body, otpNumber);
}
}
return body;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,10 +51,10 @@ private Error getError(OtpRequest model) {
private List<ErrorField> getErrorFields(OtpRequest model) {
List<ErrorField> errorFields = new ArrayList<>();
addTenantIdValidationErrors(model, errorFields);
addMobileNumberValidationErrors(model, errorFields);
//addMobileNumberValidationErrors(model, errorFields);
addRequestTypeValidationErrors(model, errorFields);
addMobileNumberInvalidValidationErrors(model, errorFields);
addMobileNumberValidLengthValidationError(model, errorFields);
//addMobileNumberInvalidValidationErrors(model, errorFields);
//addMobileNumberValidLengthValidationError(model, errorFields);
return errorFields;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ enable.mail.html=true
#spring.kafka.producer.properties.spring.json.add.type.headers=false
sandbox.host.url=https://digit-lts.digit.org
flag.sandbox.url=true
flag.digitstudio.url=true