Merge pull request #4314 from robwhitby/fly-login-link
add link to manually send login token to fly
This commit is contained in:
commit
52b3949775
|
@ -323,6 +323,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")
|
||||
}),
|
||||
}
|
||||
|
||||
|
|
|
@ -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(..))
|
||||
|
@ -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
|
||||
|
@ -44,6 +43,7 @@ init { authToken, flyPort } =
|
|||
Nothing ->
|
||||
RemoteData.Failure NoFlyPort
|
||||
, isUserMenuExpanded = False
|
||||
, flyPort = flyPort
|
||||
}
|
||||
, case flyPort of
|
||||
Just fp ->
|
||||
|
@ -168,6 +168,7 @@ body model =
|
|||
}
|
||||
, True
|
||||
)
|
||||
, (flyLoginLink model, True)
|
||||
]
|
||||
|
||||
|
||||
|
@ -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[][]
|
||||
|
||||
|
||||
|
|
|
@ -18,6 +18,7 @@ type alias Model =
|
|||
{ buttonState : ButtonState
|
||||
, authToken : String
|
||||
, tokenTransfer : TokenTransfer
|
||||
, flyPort : (Maybe Int)
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -7,6 +7,8 @@ module FlySuccess.Text exposing
|
|||
, secondParagraphFailure
|
||||
, secondParagraphSuccess
|
||||
, title
|
||||
, flyLoginLinkText
|
||||
, flyLoginLinkDescription
|
||||
)
|
||||
|
||||
import FlySuccess.Models as Models
|
||||
|
@ -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"
|
||||
|
|
Loading…
Reference in New Issue