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

add link to manually send login token to fly #4314

Merged
merged 2 commits into from Sep 11, 2019
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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions fly/commands/login.go
Expand Up @@ -258,6 +258,7 @@ func listenForTokenCallback(tokenChannel chan string, errorChannel chan error, p
w.Header().Set("Access-Control-Allow-Origin", targetUrl)
tokenChannel <- r.FormValue("token")
w.WriteHeader(200)
_,_ = fmt.Fprint(w, "token received by fly")
}),
}

Expand Down
26 changes: 24 additions & 2 deletions web/elm/src/FlySuccess/FlySuccess.elm
Expand Up @@ -17,7 +17,7 @@ import FlySuccess.Models
import FlySuccess.Styles as Styles
import FlySuccess.Text as Text
import Html exposing (Html)
import Html.Attributes exposing (attribute, id, style)
import Html.Attributes exposing (attribute, id, style, href)
import Html.Events exposing (onClick, onMouseEnter, onMouseLeave)
import Login.Login as Login
import Message.Callback exposing (Callback(..))
Expand All @@ -31,7 +31,6 @@ import Views.Icon as Icon
import Views.Styles
import Views.TopBar as TopBar


init : { authToken : String, flyPort : Maybe Int } -> ( Model, List Effect )
init { authToken, flyPort } =
( { buttonState = Unhovered
Expand All @@ -44,6 +43,7 @@ init { authToken, flyPort } =
Nothing ->
RemoteData.Failure NoFlyPort
, isUserMenuExpanded = False
, flyPort = flyPort
}
, case flyPort of
Just fp ->
Expand Down Expand Up @@ -168,6 +168,7 @@ body model =
}
, True
)
, (flyLoginLink model, True)
]


Expand Down Expand Up @@ -199,3 +200,24 @@ button { authToken, buttonState } =
]
, Html.text <| Text.button buttonState
]

flyLoginLink : Model -> Html Message
flyLoginLink { flyPort, authToken } =
case flyPort of
Just fp ->
Html.div
[ id "fly-direct-link" ]
[ Html.p
Styles.paragraph
[ Html.text Text.flyLoginLinkDescription ]
, Html.a
[ href (Routes.tokenToFlyRoute authToken fp)
, style "text-decoration" "underline"
]
[ Html.text Text.flyLoginLinkText ]
]

Nothing ->
Html.div[][]


1 change: 1 addition & 0 deletions web/elm/src/FlySuccess/Models.elm
Expand Up @@ -18,6 +18,7 @@ type alias Model =
{ buttonState : ButtonState
, authToken : String
, tokenTransfer : TokenTransfer
, flyPort : (Maybe Int)
}


Expand Down
11 changes: 11 additions & 0 deletions web/elm/src/FlySuccess/Text.elm
Expand Up @@ -7,6 +7,8 @@ module FlySuccess.Text exposing
, secondParagraphFailure
, secondParagraphSuccess
, title
, flyLoginLinkText
, flyLoginLinkDescription
)

import FlySuccess.Models as Models
Expand Down Expand Up @@ -72,3 +74,12 @@ button buttonState =

else
"copy token to clipboard"


flyLoginLinkDescription : Line
flyLoginLinkDescription =
"Or try manually sending the token to fly:"

flyLoginLinkText : Line
flyLoginLinkText =
"send token to fly directly"