mirror of
https://github.com/OpenBankProject/API-Explorer.git
synced 2026-02-06 10:47:23 +00:00
Merge pull request #8 from OpenBankProject/issue5
issue #5 - display username next to exit button
This commit is contained in:
commit
146f5c2f40
@ -57,7 +57,9 @@ object ObpAPI extends Loggable {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
def currentUser : Box[CurrentUserJson]= {
|
||||
ObpGet("/v2.0.0/users/current").flatMap(_.extractOpt[CurrentUserJson])
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -534,6 +536,13 @@ object ObpJson {
|
||||
full_name: Option[String],
|
||||
logo: Option[String],
|
||||
website: Option[String])
|
||||
|
||||
case class CurrentUserJson(user_id: String,
|
||||
email: String,
|
||||
provider_id: String,
|
||||
provider: String,
|
||||
display_name: String
|
||||
)
|
||||
|
||||
case class UserJson(id: Option[String],
|
||||
provider: Option[String],
|
||||
|
||||
@ -36,7 +36,7 @@ import net.liftweb.http.js.JsCmd
|
||||
import net.liftweb.util.Helpers
|
||||
import Helpers._
|
||||
import net.liftweb.http.SHtml
|
||||
import code.lib.OAuthClient
|
||||
import code.lib.{ObpAPI, OAuthClient}
|
||||
import net.liftweb.http.js.JsCmds.Noop
|
||||
|
||||
class Login {
|
||||
@ -44,6 +44,7 @@ class Login {
|
||||
// TODO show currently logged-in user / name
|
||||
private def loggedIn = {
|
||||
".logged-out *" #> "" &
|
||||
".username *" #> ObpAPI.currentUser.map(u => u.display_name) &
|
||||
"#logout [onclick+]" #> SHtml.onEvent(s => {
|
||||
OAuthClient.logoutAll()
|
||||
Noop
|
||||
|
||||
@ -80,6 +80,7 @@ along with this program. If not, see www.gnu.org/licenses/
|
||||
<a class="settings-imgs__link" id="logout">
|
||||
<img src="./media/images/logout-icon.png" alt="Log out icon" class="settings-logout__icon" >
|
||||
</a>
|
||||
<span class="username"></span>
|
||||
<!--
|
||||
<a href="#" class="settings-imgs__link">
|
||||
<img src="./media/images/settings-icon.png" alt="Settings icon" class="settings-imgs__icon">
|
||||
|
||||
Loading…
Reference in New Issue
Block a user