Skip to content

Commit

Permalink
Refactoring
Browse files Browse the repository at this point in the history
  • Loading branch information
SAUL committed Oct 24, 2024
1 parent dadfb61 commit d79a5e4
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/main/kotlin/core/form/validation/CommonRules.kt
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ val emailIfNotNullRule: ValidationRule = ValidationRule(

val urlRule: ValidationRule = ValidationRule(
condition = { url ->
url.matches(Regex("^https?://(?:www\\.)?[-a-zA-Z0-9@:%._+~#=]{1,256}\\.[a-zA-Z0-9()]{1,6}\\b[-a-zA-Z0-9()@:%_+.~#?&/=]*$"))
url.isEmpty() || url.matches(Regex("^https?://(?:www\\.)?[-a-zA-Z0-9@:%._+~#=]{1,256}\\.[a-zA-Z0-9()]{1,6}\\b[-a-zA-Z0-9()@:%_+.~#?&/=]*$"))
},
errorMessage = "Invalid URL"
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ fun PasswordItem(passwordSummary: PasswordSummary) {

Row {
Text(
text = passwordSummary.email ?: passwordSummary.username ?: "",
text = if (passwordSummary.email?.isEmpty() == true) passwordSummary.username!! else passwordSummary.email!!,
fontSize = 12.sp,
fontFamily = Font.RobotoThin,
color = PasswordColors.outline
Expand Down
2 changes: 0 additions & 2 deletions src/main/kotlin/ui/validators/PasswordFormValidator.kt
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,6 @@ fun passwordFormValidator(): FormValidator {
.addField(
PasswordFormFieldName.WEBSITE_ICON_URL, FormField(
validator = Validator()
.addRule(notNullRule(PasswordFormFieldName.WEBSITE_ICON_URL.fieldName))
.addRule(lengthRule(PasswordFormFieldName.WEBSITE_ICON_URL.fieldName, 1))
.addRule(urlRule)
)
)
Expand Down

0 comments on commit d79a5e4

Please sign in to comment.