From 346cefcc9021c14b433c7c94afcb521266d40523 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marko=20Mili=C4=87?= Date: Tue, 13 Jan 2026 12:08:13 +0100 Subject: [PATCH] Revert "feature/Remove Sign Up flow from legacy portal" This reverts commit 233af77b753ededc3668f395a62c2446c589bb76. --- .../resources/props/sample.props.template | 26 +-- .../main/scala/code/api/util/Glossary.scala | 6 +- .../code/model/dataAccess/AuthUser.scala | 193 +++++++++++++++++- .../src/main/scala/code/snippet/Login.scala | 7 +- .../code/snippet/OAuthAuthorisation.scala | 9 +- .../src/main/scala/code/snippet/WebUI.scala | 17 +- obp-api/src/main/webapp/index-en.html | 2 +- obp-api/src/main/webapp/index.html | 2 +- obp-api/src/main/webapp/oauth/authorize.html | 2 +- .../main/webapp/templates-hidden/_login.html | 2 +- .../webapp/templates-hidden/default-en.html | 6 +- .../templates-hidden/default-footer.html | 6 +- .../templates-hidden/default-header.html | 6 +- .../main/webapp/templates-hidden/default.html | 6 +- .../test/scala/code/util/OAuthClient.scala | 2 +- 15 files changed, 219 insertions(+), 73 deletions(-) diff --git a/obp-api/src/main/resources/props/sample.props.template b/obp-api/src/main/resources/props/sample.props.template index 80e0c7725..c0f151d83 100644 --- a/obp-api/src/main/resources/props/sample.props.template +++ b/obp-api/src/main/resources/props/sample.props.template @@ -569,16 +569,15 @@ webui_oauth_1_documentation_url = # Link to OAuth 2.0 glossary on api explorer webui_oauth_2_documentation_url = -# Sign up functionality removed - users are directed to OBP Portal for registration -# The following signup-related properties are no longer used: -# - webui_signup_form_submit_button_value (signup form submit button text) -# - webui_signup_form_title_text (signup form title) -# - webui_signup_body_password_repeat_text (password repeat field text) -# - allow_pre_filled_password (pre-filled password functionality) -# - webui_agree_terms_html (terms agreement checkbox HTML) -# - webui_agree_privacy_policy_url (privacy policy URL for signup) -# - webui_agree_privacy_policy_html_text (privacy policy agreement text) -# - webui_legal_notice_html_text (legal notice for signup forms) +# Link to Privacy Policy on signup page +#webui_signup_form_submit_button_value= +#webui_signup_form_title_text=Sign Up +#webui_signup_body_password_repeat_text=Repeat +#allow_pre_filled_password=true +#webui_agree_terms_html=
+webui_agree_privacy_policy_url = https://openbankproject.com/privacy-policy +webui_agree_privacy_policy_html_text =
+#webui_legal_notice_html_text= ## For partner logos and links webui_main_partners=[\ @@ -597,8 +596,8 @@ webui_main_style_sheet = /media/css/website.css # Override certain elements (with important styles) webui_override_style_sheet = -## Link to agree to Terms & Conditions (no longer used - signup removed) -# webui_agree_terms_url = +## Link to agree to Terms & Conditions, shown on signup page +webui_agree_terms_url = ## The Support Email, shown in the bottom page #webui_support_email=contact@openbankproject.com @@ -626,9 +625,6 @@ webui_override_style_sheet = #webui_post_consumer_registration_submit_button_value=Register consumer # OBP Portal URL - base URL for the OBP Portal service -# Used for: -# - User registration: {webui_obp_portal_url}/register (all "Register" links redirect here) -# - Consumer registration: {webui_obp_portal_url}/consumer-registration (default) webui_obp_portal_url = http://localhost:5174 # External Consumer Registration URL - used to redirect "Get API Key" links to an external service diff --git a/obp-api/src/main/scala/code/api/util/Glossary.scala b/obp-api/src/main/scala/code/api/util/Glossary.scala index 15adc55bb..cde7dd1dd 100644 --- a/obp-api/src/main/scala/code/api/util/Glossary.scala +++ b/obp-api/src/main/scala/code/api/util/Glossary.scala @@ -1249,7 +1249,7 @@ object Glossary extends MdcLoggable { | |### 1) Get your App key | - |[Sign up](${APIUtil.getPropsValue("webui_obp_portal_url", "http://localhost:5174")}/register) or [login]($getServerUrl/user_mgt/login) as a developer. + |[Sign up]($getServerUrl/user_mgt/sign_up) or [login]($getServerUrl/user_mgt/login) as a developer. | |Register your App key [HERE](${getConsumerRegistrationUrl()}) | @@ -2305,7 +2305,7 @@ object Glossary extends MdcLoggable { | |### Step 1: Get your App key | - |[Sign up](${APIUtil.getPropsValue("webui_obp_portal_url", "http://localhost:5174")}/register) or [login]($getServerUrl/user_mgt/login) as a developer + |[Sign up]($getServerUrl/user_mgt/sign_up) or [login]($getServerUrl/user_mgt/login) as a developer | |Register your App key [HERE](${getConsumerRegistrationUrl()}) | @@ -2954,7 +2954,7 @@ object Glossary extends MdcLoggable { | |## In order to get an App / Consumer key | -|[Sign up](${APIUtil.getPropsValue("webui_obp_portal_url", "http://localhost:5174")}/register) or [login]($getServerUrl/user_mgt/login) as a developer. +|[Sign up]($getServerUrl/user_mgt/sign_up) or [login]($getServerUrl/user_mgt/login) as a developer. | |Register your App / Consumer [HERE](${getConsumerRegistrationUrl()}) | diff --git a/obp-api/src/main/scala/code/model/dataAccess/AuthUser.scala b/obp-api/src/main/scala/code/model/dataAccess/AuthUser.scala index 11efcde0d..de1989065 100644 --- a/obp-api/src/main/scala/code/model/dataAccess/AuthUser.scala +++ b/obp-api/src/main/scala/code/model/dataAccess/AuthUser.scala @@ -229,7 +229,7 @@ class AuthUser extends MegaProtoUser[AuthUser] with CreatedUpdated with MdcLogga override lazy val password = new MyPasswordNew - // Removed signup password repeat text - not needed with OBP Portal redirect + lazy val signupPasswordRepeatText = getWebUiPropsValue("webui_signup_body_password_repeat_text", S.?("repeat")) class MyPasswordNew extends MappedPassword(this) { lazy val preFilledPassword = if (APIUtil.getPropsAsBoolValue("allow_pre_filled_password", true)) {get.toString} else "" @@ -238,9 +238,14 @@ class AuthUser extends MegaProtoUser[AuthUser] with CreatedUpdated with MdcLogga Full( {appendFieldId( ) } -
+
+
{signupPasswordRepeatText}
+ +
+ +
) } } @@ -424,6 +429,7 @@ import net.liftweb.util.Helpers._ override def screenWrap = Full() // define the order fields will appear in forms and output override def fieldOrder = List(id, firstName, lastName, email, username, password, provider) + override def signupFields = List(firstName, lastName, email, username, password) // To force validation of email addresses set this to false (default as of 29 June 2021) override def skipEmailValidation = APIUtil.getPropsAsBoolValue("authUser.skipEmailValidation", false) @@ -692,7 +698,28 @@ import net.liftweb.util.Helpers._ case _ => S.error(S.?("invalid.validation.link")); S.redirectTo(homePage) } - + override def actionsAfterSignup(theUser: TheUserType, func: () => Nothing): Nothing = { + theUser.setValidated(skipEmailValidation).resetUniqueId() + theUser.save + val privacyPolicyValue: String = getWebUiPropsValue("webui_privacy_policy", "") + val termsAndConditionsValue: String = getWebUiPropsValue("webui_terms_and_conditions", "") + // User Agreement table + UserAgreementProvider.userAgreementProvider.vend.createUserAgreement( + theUser.user.foreign.map(_.userId).getOrElse(""), "privacy_conditions", privacyPolicyValue) + UserAgreementProvider.userAgreementProvider.vend.createUserAgreement( + theUser.user.foreign.map(_.userId).getOrElse(""), "terms_and_conditions", termsAndConditionsValue) + if (!skipEmailValidation) { + sendValidationEmail(theUser) + S.notice(S.?("sign.up.message")) + func() + } else { + grantDefaultEntitlementsToAuthUser(theUser) + logUserIn(theUser, () => { + S.notice(S.?("welcome")) + func() + }) + } + } /** * Set this to redirect to a certain page after a failed login */ @@ -701,9 +728,87 @@ import net.liftweb.util.Helpers._ } - // Removed signup-related methods: agreeTermsDiv, legalNoticeDiv, agreePrivacyPolicy - // These were only used in signup forms which now redirect to OBP Portal - // Signup functionality removed - users are directed to OBP Portal for registration + def agreeTermsDiv = { + val webUi = new WebUI + val webUiPropsValue = getWebUiPropsValue("webui_terms_and_conditions", "") + val termsAndConditionsCheckboxTitle = Helper.i18n("terms_and_conditions_checkbox_text", Some("I agree to the above Terms and Conditions")) + val termsAndConditionsCheckboxLabel = Helper.i18n("terms_and_conditions_checkbox_label", Some("Terms and Conditions")) + val agreeTermsHtml = s"""
+ |
+ |
+ | $termsAndConditionsCheckboxLabel + |
${webUi.makeHtml(webUiPropsValue)}
+ |
+ | + | + |
+ | """.stripMargin + + scala.xml.Unparsed(agreeTermsHtml) + } + + def legalNoticeDiv = { + val agreeTermsHtml = getWebUiPropsValue("webui_legal_notice_html_text", "") + if(agreeTermsHtml.isEmpty){ + s"" + } else{ + scala.xml.Unparsed(s"""$agreeTermsHtml""") + } + } + + def agreePrivacyPolicy = { + val webUi = new WebUI + val privacyPolicyCheckboxText = Helper.i18n("privacy_policy_checkbox_text", Some("I agree to the above Privacy Policy")) + val privacyPolicyCheckboxLabel = Helper.i18n("privacy_policy_checkbox_label", Some("Privacy Policy")) + val webUiPropsValue = getWebUiPropsValue("webui_privacy_policy", "") + val agreePrivacyPolicy = s"""
+ |
+ |
+ | $privacyPolicyCheckboxLabel + |
${webUi.makeHtml(webUiPropsValue)}
+ |
+ | + | + |
+ |
""".stripMargin + + scala.xml.Unparsed(agreePrivacyPolicy) + } + def enableDisableSignUpButton = { + val javaScriptCode = """""".stripMargin + + scala.xml.Unparsed(javaScriptCode) + } + + def signupFormTitle = getWebUiPropsValue("webui_signup_form_title_text", S.?("sign.up")) + + override def signupXhtml (user:AuthUser) = { +
+
+

{signupFormTitle}

+ {legalNoticeDiv} +
+ {localForm(user, false, signupFields)} + {agreeTermsDiv} + {agreePrivacyPolicy} +
+ +
+ {enableDisableSignUpButton} +
+
+ } override def localForm(user: TheUserType, ignorePassword: Boolean, fields: List[FieldPointerType]): NodeSeq = { @@ -713,11 +818,18 @@ import net.liftweb.util.Helpers._ if field.show_? && (!ignorePassword || !pointer.isPasswordField_?) form <- field.toForm.toList } yield { -
- - {form} -
-
+ if(field.uniqueFieldId.getOrElse("") == "authuser_password") { +
+ + {form} +
+ } else { +
+ + {form} +
+
+ } } } @@ -1498,8 +1610,67 @@ def restoreSomeSessions(): Unit = { val usernames: List[String] = this.getResourceUsersByEmail(email).map(_.user.name) findAll(ByList(this.username, usernames)) } + def signupSubmitButtonValue() = getWebUiPropsValue("webui_signup_form_submit_button_value", S.?("sign.up")) + //overridden to allow redirect to loginRedirect after signup. This is mostly to allow + // loginFirst menu items to work if the user doesn't have an account. Without this, + // if a user tries to access a logged-in only page, and then signs up, they don't get redirected + // back to the proper page. + override def signup = { + val theUser: TheUserType = mutateUserOnSignup(createNewUserInstance()) + val theName = signUpPath.mkString("") + //Check the internal redirect, in case for open redirect issue. + // variable redir is from loginRedirect, it is set-up in OAuthAuthorisation.scala as following code: + // val currentUrl = ObpS.uriAndQueryString.getOrElse("/") + // AuthUser.loginRedirect.set(Full(Helpers.appendParams(currentUrl, List((LogUserOutParam, "false"))))) + val loginRedirectSave = loginRedirect.is + + def testSignup() { + validateSignup(theUser) match { + case Nil => + //here we check loginRedirectSave (different from implementation in super class) + val redir = loginRedirectSave match { + case Full(url) => + loginRedirect(Empty) + url + case _ => + //if the register page url (user_mgt/sign_up?after-signup=link-to-customer) contains the parameter + //after-signup=link-to-customer,then it will redirect to the on boarding customer page. + ObpS.param("after-signup") match { + case url if (url.equals("link-to-customer")) => + "/add-user-auth-context-update-request" + case _ => + homePage + } + } + if (Helper.isValidInternalRedirectUrl(redir.toString)) { + actionsAfterSignup(theUser, () => { + S.redirectTo(redir) + }) + } else { + S.error(S.?(ErrorMessages.InvalidInternalRedirectUrl)) + logger.info(ErrorMessages.InvalidInternalRedirectUrl + loginRedirect.get) + } + + case xs => + xs.foreach{ + e => S.error(e.field.uniqueFieldId.openOrThrowException("There is no uniqueFieldId."), e.msg) + } + signupFunc(Full(innerSignup _)) + } + } + + def innerSignup = { + val bind = "type=submit" #> signupSubmitButton(signupSubmitButtonValue(), testSignup _) + bind(signupXhtml(theUser)) + } + + if(APIUtil.getPropsAsBoolValue("user_invitation.mandatory", false)) + S.redirectTo("/user-invitation-info") + else + innerSignup + } def scrambleAuthUser(userPrimaryKey: UserPrimaryKey): Box[Boolean] = tryo { AuthUser.find(By(AuthUser.user, userPrimaryKey.value)) match { diff --git a/obp-api/src/main/scala/code/snippet/Login.scala b/obp-api/src/main/scala/code/snippet/Login.scala index 1ae8ce83b..a7c6a36c3 100644 --- a/obp-api/src/main/scala/code/snippet/Login.scala +++ b/obp-api/src/main/scala/code/snippet/Login.scala @@ -70,11 +70,8 @@ class Login { href getOrElse "#" } & { ".signup [href]" #> { - val portalUrl = getWebUiPropsValue("webui_obp_portal_url", "http://localhost:5174") - s"$portalUrl/register" - } & - ".signup [target]" #> "_blank" & - ".signup [rel]" #> "noopener" + AuthUser.signUpPath.foldLeft("")(_ + "/" + _) + } } } } diff --git a/obp-api/src/main/scala/code/snippet/OAuthAuthorisation.scala b/obp-api/src/main/scala/code/snippet/OAuthAuthorisation.scala index be038b035..66a598627 100644 --- a/obp-api/src/main/scala/code/snippet/OAuthAuthorisation.scala +++ b/obp-api/src/main/scala/code/snippet/OAuthAuthorisation.scala @@ -46,7 +46,6 @@ import net.liftweb.http.S import net.liftweb.util.Helpers._ import net.liftweb.util.{CssSel, Helpers, Props} import code.api.oauth1a.OauthParams._ -import code.webuiprops.MappedWebUiPropsProvider.getWebUiPropsValue import scala.xml.NodeSeq @@ -151,12 +150,8 @@ object OAuthAuthorisation { href getOrElse "#" } & - ".signup [href]" #> { - val portalUrl = getWebUiPropsValue("webui_obp_portal_url", "http://localhost:5174") - s"$portalUrl/register" - } & - ".signup [target]" #> "_blank" & - ".signup [rel]" #> "noopener" + ".signup [href]" #> + AuthUser.signUpPath.foldLeft("")(_ + "/" + _) } } case _ => error("Application not found") diff --git a/obp-api/src/main/scala/code/snippet/WebUI.scala b/obp-api/src/main/scala/code/snippet/WebUI.scala index c8861688b..5b0704a02 100644 --- a/obp-api/src/main/scala/code/snippet/WebUI.scala +++ b/obp-api/src/main/scala/code/snippet/WebUI.scala @@ -550,21 +550,8 @@ class WebUI extends MdcLoggable{ def userIsLoggedIn: CssSel = { if(AuthUser.loggedIn_?) "#register-link [href]" #> scala.xml.Unparsed(s"/already-logged-in") - else { - val portalUrl = getWebUiPropsValue("webui_obp_portal_url", "http://localhost:5174") - val registerUrl = s"$portalUrl/register" - "#register-link [href]" #> scala.xml.Unparsed(registerUrl) & - "#register-link [target]" #> "_blank" & - "#register-link [rel]" #> "noopener" - } - } - - def portalRegisterLink: CssSel = { - val portalUrl = getWebUiPropsValue("webui_obp_portal_url", "http://localhost:5174") - val registerUrl = s"$portalUrl/register" - "a [href]" #> scala.xml.Unparsed(registerUrl) & - "a [target]" #> "_blank" & - "a [rel]" #> "noopener" + else + "#register-link [href]" #> scala.xml.Unparsed(s"/user_mgt/sign_up") } def alreadyLoggedIn: CssSel = { diff --git a/obp-api/src/main/webapp/index-en.html b/obp-api/src/main/webapp/index-en.html index 32075b8b4..a0dd0210c 100644 --- a/obp-api/src/main/webapp/index-en.html +++ b/obp-api/src/main/webapp/index-en.html @@ -59,7 +59,7 @@ Berlin 13359, Germany

-

+

.

diff --git a/obp-api/src/main/webapp/index.html b/obp-api/src/main/webapp/index.html index 92fabd6ba..54b4d75a3 100644 --- a/obp-api/src/main/webapp/index.html +++ b/obp-api/src/main/webapp/index.html @@ -59,7 +59,7 @@ Berlin 13359, Germany

Create an account

-

First, create a free developer account on this sandbox and request a developer key. You will be asked to submit basic information about your app at this stage. Register for an account +

First, create a free developer account on this sandbox and request a developer key. You will be asked to submit basic information about your app at this stage. Register for an account .

diff --git a/obp-api/src/main/webapp/oauth/authorize.html b/obp-api/src/main/webapp/oauth/authorize.html index a71babac7..b4d7678a0 100644 --- a/obp-api/src/main/webapp/oauth/authorize.html +++ b/obp-api/src/main/webapp/oauth/authorize.html @@ -40,7 +40,7 @@
Don't have an account? - Register + Register
diff --git a/obp-api/src/main/webapp/templates-hidden/_login.html b/obp-api/src/main/webapp/templates-hidden/_login.html index 0b91a507c..c96de62e2 100644 --- a/obp-api/src/main/webapp/templates-hidden/_login.html +++ b/obp-api/src/main/webapp/templates-hidden/_login.html @@ -42,7 +42,7 @@
Don't have an account? - Register + Register
diff --git a/obp-api/src/main/webapp/templates-hidden/default-en.html b/obp-api/src/main/webapp/templates-hidden/default-en.html index 9da6dba6d..2b2e4f831 100644 --- a/obp-api/src/main/webapp/templates-hidden/default-en.html +++ b/obp-api/src/main/webapp/templates-hidden/default-en.html @@ -143,7 +143,7 @@ Berlin 13359, Germany @@ -198,7 +198,7 @@ Berlin 13359, Germany
  • @@ -235,7 +235,7 @@ Berlin 13359, Germany Sofit
  • - + On Board
  • diff --git a/obp-api/src/main/webapp/templates-hidden/default-footer.html b/obp-api/src/main/webapp/templates-hidden/default-footer.html index 819ba810c..74a60838b 100644 --- a/obp-api/src/main/webapp/templates-hidden/default-footer.html +++ b/obp-api/src/main/webapp/templates-hidden/default-footer.html @@ -148,7 +148,7 @@ Berlin 13359, Germany
  • @@ -208,7 +208,7 @@ Berlin 13359, Germany
  • @@ -248,7 +248,7 @@ Berlin 13359, Germany Sofit
  • - + On Board
  • diff --git a/obp-api/src/main/webapp/templates-hidden/default-header.html b/obp-api/src/main/webapp/templates-hidden/default-header.html index c5079d3d9..fba6bbb16 100644 --- a/obp-api/src/main/webapp/templates-hidden/default-header.html +++ b/obp-api/src/main/webapp/templates-hidden/default-header.html @@ -143,7 +143,7 @@ Berlin 13359, Germany
  • @@ -198,7 +198,7 @@ Berlin 13359, Germany
  • @@ -236,7 +236,7 @@ Berlin 13359, Germany Sofit
  • - + On Board
  • diff --git a/obp-api/src/main/webapp/templates-hidden/default.html b/obp-api/src/main/webapp/templates-hidden/default.html index c2ec26e45..4eb5915ca 100644 --- a/obp-api/src/main/webapp/templates-hidden/default.html +++ b/obp-api/src/main/webapp/templates-hidden/default.html @@ -143,7 +143,7 @@ Berlin 13359, Germany
  • @@ -198,7 +198,7 @@ Berlin 13359, Germany
  • @@ -235,7 +235,7 @@ Berlin 13359, Germany Sofit
  • - + On Board
  • diff --git a/obp-api/src/test/scala/code/util/OAuthClient.scala b/obp-api/src/test/scala/code/util/OAuthClient.scala index 4f81b1ad4..d930f85ee 100644 --- a/obp-api/src/test/scala/code/util/OAuthClient.scala +++ b/obp-api/src/test/scala/code/util/OAuthClient.scala @@ -67,7 +67,7 @@ trait DefaultProvider extends Provider { val requestTokenUrl = baseUrl + "/oauth/initiate" val accessTokenUrl = baseUrl + "/oauth/token" val authorizeUrl = baseUrl + "/oauth/authorize" - val signupUrl = Some(APIUtil.getPropsValue("webui_obp_portal_url", "http://localhost:5174") + "/register") + val signupUrl = Some(baseUrl + "/user_mgt/sign_up") lazy val oAuthProvider : OAuthProvider = new DefaultOAuthProvider(requestTokenUrl, accessTokenUrl, authorizeUrl)