Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pieniä korjauksia Keycloakin korvaaviin toimintoihin #6306

Merged
merged 3 commits into from
Jan 27, 2025
Merged
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 @@ -82,13 +82,14 @@ export default React.memo(function LoginDetailsSection({
<Grid>
<H2 noMargin>{t.title}</H2>
<div />
<Label>
{t.weakLoginUsername}
{featureFlags.weakLogin ? ' (Keycloak)' : ''}
</Label>
<div data-qa="keycloak-email" translate="no">
{user.keycloakEmail}
</div>
{!featureFlags.weakLogin && (
<>
<Label>{t.weakLoginUsername}</Label>
<div data-qa="keycloak-email" translate="no">
{user.keycloakEmail}
</div>
</>
)}
{featureFlags.weakLogin && (user.email || user.weakLoginUsername) && (
<>
<Label>{t.weakLoginCredentials}</Label>
Expand Down Expand Up @@ -247,6 +248,8 @@ const WeakCredentialsFormModal = React.memo(function WeakCredentialsFormModal({
[passwordConstraints]
)

const [isUnacceptable, setUnacceptable] = useState<boolean>(false)

const form = useForm(
passwordForm,
() => ({ password: '', confirmPassword: '' }),
Expand All @@ -267,8 +270,6 @@ const WeakCredentialsFormModal = React.memo(function WeakCredentialsFormModal({
const { password, confirmPassword } = useFormFields(form)
const pattern = `.{${passwordConstraints.minLength},${passwordConstraints.maxLength}}`

const [isUnacceptable, setUnacceptable] = useState<boolean>(false)

const onFailure = useCallback(
(failure: Failure<unknown>) => {
setUnacceptable(failure.errorCode === 'PASSWORD_UNACCEPTABLE')
Expand Down
3 changes: 1 addition & 2 deletions service/src/main/kotlin/fi/espoo/evaka/EvakaEnv.kt
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ import fi.espoo.evaka.shared.job.JobSchedule
import fi.espoo.evaka.shared.job.ScheduledJobSettings
import io.github.oshai.kotlinlogging.KotlinLogging
import java.net.URI
import java.nio.file.Path
import java.security.KeyStore
import java.time.Duration
import java.time.LocalDate
Expand Down Expand Up @@ -43,7 +42,7 @@ data class EvakaEnv(
val personAddressEnvelopeWindowPosition: Rectangle,
val replacementInvoicesStart: YearMonth?,
val newCitizenWeakLoginEnabled: Boolean,
val passwordBlacklistDirectory: Path?,
val passwordBlacklistDirectory: String?,
) {
companion object {
fun fromEnvironment(env: Environment): EvakaEnv {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ import fi.espoo.evaka.shared.domain.EvakaClock
import fi.espoo.evaka.titania.cleanTitaniaErrors
import fi.espoo.evaka.varda.new.VardaUpdateServiceNew
import io.github.oshai.kotlinlogging.KotlinLogging
import java.nio.file.Path
import java.time.LocalTime
import org.springframework.stereotype.Component

Expand Down Expand Up @@ -473,6 +474,6 @@ WHERE id IN (SELECT id FROM attendances_to_end)

fun importPasswordBlacklists(db: Database.Connection, clock: EvakaClock) =
evakaEnv.passwordBlacklistDirectory?.let { directory ->
passwordBlacklist.importBlacklists(db, directory)
passwordBlacklist.importBlacklists(db, Path.of(directory))
}
}
Loading