mirror of
https://github.com/OpenBankProject/OBP-API.git
synced 2026-02-06 15:27:01 +00:00
Add redirect_url to Consumer registration form #320
This commit is contained in:
parent
4f0e079340
commit
238ed969ee
@ -37,7 +37,7 @@ import code.api.util.{APIUtil, ErrorMessages}
|
||||
import code.api.{DirectLogin, OAuthHandshake}
|
||||
import code.bankconnectors.Connector
|
||||
import net.liftweb.common._
|
||||
import net.liftweb.http.{S, SHtml, SessionVar, Templates}
|
||||
import net.liftweb.http._
|
||||
import net.liftweb.mapper._
|
||||
import net.liftweb.util.Mailer.{BCC, From, Subject, To}
|
||||
import net.liftweb.util._
|
||||
@ -229,6 +229,37 @@ import net.liftweb.util.Helpers._
|
||||
|
||||
return ""
|
||||
}
|
||||
/**
|
||||
* Find current APIUser_UserId from OBPUser ,it is only used for Consumer registration form to save the USER_ID when register new consumer.
|
||||
*/
|
||||
//TODO may not be a good idea, need modify after refactoring User Models.
|
||||
def getCurrentAPIUserUserId: String = {
|
||||
for {
|
||||
current <- OBPUser.currentUser
|
||||
userId <- tryo{current.user.foreign.get.userId}
|
||||
if (userId.nonEmpty)
|
||||
} yield {
|
||||
return userId
|
||||
}
|
||||
|
||||
for {
|
||||
current <- OAuthHandshake.getUser
|
||||
userId <- tryo{current.userId}
|
||||
if (userId.nonEmpty)
|
||||
} yield {
|
||||
return userId
|
||||
}
|
||||
|
||||
for {
|
||||
current <- DirectLogin.getUser
|
||||
userId <- tryo{current.userId}
|
||||
if (userId.nonEmpty)
|
||||
} yield {
|
||||
return userId
|
||||
}
|
||||
|
||||
return ""
|
||||
}
|
||||
|
||||
/**
|
||||
* The string that's generated when the user name is not found. By
|
||||
|
||||
@ -32,6 +32,7 @@ Berlin 13359, Germany
|
||||
package code.snippet
|
||||
|
||||
import code.model._
|
||||
import code.model.dataAccess.{OBPUser}
|
||||
import net.liftweb.http.{RequestVar, S}
|
||||
import net.liftweb.util.FieldError
|
||||
import net.liftweb.util.Helpers
|
||||
@ -69,7 +70,8 @@ class ConsumerRegistration extends Loggable {
|
||||
def register = {
|
||||
".register" #> {
|
||||
".appTypeClass" #> SHtml.select(appTypes, Empty, appType(_)) &
|
||||
".appNameClass" #> SHtml.text(nameVar.is, nameVar(_)) &
|
||||
".appNameClass" #> SHtml.text(nameVar.is, nameVar(_)) &
|
||||
".appRedirectUrlClass" #> SHtml.text(redirectionURLVar, redirectionURLVar(_)) &
|
||||
".appDevClass" #> SHtml.text(devEmailVar, devEmailVar(_)) &
|
||||
".appDescClass" #> SHtml.textarea(descriptionVar, descriptionVar (_)) &
|
||||
".appUserAuthenticationUrlClass" #> SHtml.text(authenticationURLVar.is, authenticationURLVar(_)) &
|
||||
@ -83,6 +85,7 @@ class ConsumerRegistration extends Loggable {
|
||||
val urlDirectLoginEndpoint = Props.get("hostname", "") + "/my/logins/direct"
|
||||
//thanks for registering, here's your key, etc.
|
||||
".app-name *" #> consumer.name.get &
|
||||
".app-redirect-url *" #> consumer.redirectURL &
|
||||
".app-user-authentication-url *" #> consumer.userAuthenticationURL &
|
||||
".app-type *" #> consumer.appType.get.toString &
|
||||
".app-description *" #> consumer.description.get &
|
||||
@ -142,8 +145,9 @@ class ConsumerRegistration extends Loggable {
|
||||
appType(appTypeSelected.get).
|
||||
description(descriptionVar.is).
|
||||
developerEmail(devEmailVar.is).
|
||||
userAuthenticationURL(redirectionURLVar.is)
|
||||
|
||||
redirectURL(redirectionURLVar.is).
|
||||
createdByUserId(OBPUser.getCurrentAPIUserUserId)
|
||||
|
||||
val errors = consumer.validate
|
||||
nameVar.set(nameVar.is)
|
||||
appTypeVar.set(appTypeSelected.get)
|
||||
|
||||
@ -51,7 +51,10 @@ Berlin 13359, Germany
|
||||
<label for="appName">Application Name</label>
|
||||
<input type="text" name="app-name" id="appName" class="appNameClass">
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<label for="appRedirectUrl">Redirect URL</label>
|
||||
<input type="text" name="app-redirect-url" id="appRedirectUrl" class="appRedirectUrlClass">
|
||||
</div>
|
||||
<!--Note for the commented div : 719aa7fd 04/10/15 Stefan. Hongwei just reformatted the code -->
|
||||
<!--<div>-->
|
||||
<!--<label for="appUserAuthenticationUrl">Authentication URL</label>-->
|
||||
@ -100,6 +103,14 @@ Berlin 13359, Germany
|
||||
<span class="app-name">ABC</span>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
User redirect URL
|
||||
</td>
|
||||
<td>
|
||||
<span class="app-redirect-url">ABC</span>
|
||||
</td>
|
||||
</tr>
|
||||
<!-- <tr>
|
||||
<td>
|
||||
User authentication URL
|
||||
|
||||
Loading…
Reference in New Issue
Block a user