Skip to content

Commit

Permalink
bugfix/Fix term and conditions multiple saving
Browse files Browse the repository at this point in the history
  • Loading branch information
constantine2nd committed Sep 10, 2024
1 parent 464e3c7 commit f5fa8e9
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1045,7 +1045,7 @@ def restoreSomeSessions(): Unit = {
.map(_.agreementHash).getOrElse(HashUtil.Sha256Hash("not set"))
val agreementText = getWebUiPropsValue("webui_terms_and_conditions", "not set")
val hashedAgreementText = HashUtil.Sha256Hash(agreementText)
if(hashedAgreementTextOfUser == hashedAgreementText) { // Chech terms and conditions
if(hashedAgreementTextOfUser == hashedAgreementText) { // Check terms and conditions
val hashedAgreementTextOfUser =
UserAgreementProvider.userAgreementProvider.vend.getUserAgreement(userId, "privacy_conditions")
.map(_.agreementHash).getOrElse(HashUtil.Sha256Hash("not set"))
Expand Down
4 changes: 3 additions & 1 deletion obp-api/src/main/scala/code/snippet/TermsAndConditions.scala
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,9 @@ class TermsAndConditions extends MdcLoggable {
val agreementText = getWebUiPropsValue("webui_terms_and_conditions", "not set")
// val hashedAgreementText = HashUtil.Sha256Hash(agreementText)
UserAgreementProvider.userAgreementProvider.vend.createOrUpdateUserAgreement(
AuthUser.currentUser.flatMap(_.user.foreign.map(_.userId)).getOrElse(""), "terms_and_conditions", agreementText)
AuthUser.currentUser.flatMap(_.user.foreign.map(_.userId)).getOrElse(""),
"terms_and_conditions",
agreementText)
S.redirectTo("/")
}
}
Expand Down
2 changes: 1 addition & 1 deletion obp-api/src/main/scala/code/users/UserAgreement.scala
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ object UserAgreement extends UserAgreement with LongKeyedMetaMapper[UserAgreemen
agreement =>
tryo {
val hash = HashUtil.Sha256Hash(agreement.agreementText)
agreement.AgreementHash(hash ).save
agreement.AgreementHash(hash)
}
)

Expand Down

0 comments on commit f5fa8e9

Please sign in to comment.