2021-11-24 14:53:12 +00:00
|
|
|
<StateChart
|
|
|
|
@src={{this.chart}}
|
|
|
|
as |State Guard ChartAction dispatch state|>
|
|
|
|
{{#let
|
|
|
|
(hash
|
|
|
|
State=State
|
|
|
|
Guard=Guard
|
|
|
|
Action=ChartAction
|
|
|
|
dispatch=dispatch
|
|
|
|
state=state
|
|
|
|
)
|
|
|
|
as |chart|}}
|
|
|
|
{{#let
|
|
|
|
(hash
|
2020-05-11 15:37:11 +00:00
|
|
|
reset=(action dispatch "RESET")
|
2021-11-24 14:53:12 +00:00
|
|
|
focus=this.focus
|
|
|
|
disabled=(state-matches state "loading")
|
|
|
|
error=(queue
|
|
|
|
(action dispatch "ERROR")
|
|
|
|
(action (mut this.error) value="error.errors.firstObject")
|
|
|
|
)
|
|
|
|
submit=(queue
|
|
|
|
(action (mut this.value))
|
|
|
|
(action dispatch "SUBMIT")
|
|
|
|
)
|
|
|
|
)
|
|
|
|
as |exported|}}
|
|
|
|
<Guard
|
|
|
|
@name="hasValue"
|
|
|
|
@cond={{this.hasValue}}
|
|
|
|
/>
|
2021-10-01 10:07:58 +00:00
|
|
|
{{!TODO: Call this reset or similar }}
|
2021-11-24 14:53:12 +00:00
|
|
|
<chart.Action
|
|
|
|
@name="clearError"
|
|
|
|
@exec={{queue (action (mut this.error) undefined) (action (mut this.secret) undefined)}}
|
|
|
|
/>
|
|
|
|
<div
|
|
|
|
class="auth-form"
|
|
|
|
...attributes
|
|
|
|
>
|
|
|
|
<StateChart
|
|
|
|
@src={{this.tabsChart}}
|
|
|
|
as |TabState IgnoredGuard IgnoredAction tabDispatch tabState|>
|
|
|
|
{{#if (can 'use SSO')}}
|
|
|
|
<TabNav
|
|
|
|
@items={{array
|
|
|
|
(hash
|
|
|
|
label='Token'
|
|
|
|
selected=(state-matches tabState 'token')
|
|
|
|
)
|
|
|
|
(hash
|
|
|
|
label='SSO'
|
|
|
|
selected=(state-matches tabState 'sso')
|
|
|
|
)
|
|
|
|
}}
|
|
|
|
@onclick={{queue (action tabDispatch) (action dispatch "RESET")}}
|
|
|
|
/>
|
|
|
|
{{/if}}
|
2020-05-11 15:37:11 +00:00
|
|
|
<State @matches="error">
|
2021-11-24 14:53:12 +00:00
|
|
|
{{#if this.error.status}}
|
2020-10-26 16:51:53 +00:00
|
|
|
<Notice
|
|
|
|
@type="error"
|
|
|
|
role="alert"
|
|
|
|
as |notice|>
|
|
|
|
<notice.Body>
|
|
|
|
<p>
|
2021-11-24 14:53:12 +00:00
|
|
|
{{#if this.value.Name}}
|
|
|
|
{{#if (eq this.error.status '403')}}
|
2020-10-26 16:51:53 +00:00
|
|
|
<strong>Consul login failed</strong><br />
|
|
|
|
We received a token from your OIDC provider but could not log in to Consul with it.
|
2021-11-24 14:53:12 +00:00
|
|
|
{{else if (eq this.error.status '401')}}
|
2020-10-26 16:51:53 +00:00
|
|
|
<strong>Could not log in to provider</strong><br />
|
|
|
|
The OIDC provider has rejected this access token. Please have an administrator check your auth method configuration.
|
2021-11-24 14:53:12 +00:00
|
|
|
{{else if (eq this.error.status '499')}}
|
2020-10-26 16:51:53 +00:00
|
|
|
<strong>SSO log in window closed</strong><br />
|
|
|
|
The OIDC provider window was closed. Please try again.
|
|
|
|
{{else}}
|
|
|
|
<strong>Error</strong><br />
|
2021-11-24 14:53:12 +00:00
|
|
|
{{this.error.detail}}
|
2020-10-26 16:51:53 +00:00
|
|
|
{{/if}}
|
|
|
|
{{else}}
|
2021-11-24 14:53:12 +00:00
|
|
|
{{#if (eq this.error.status '403')}}
|
2020-10-26 16:51:53 +00:00
|
|
|
<strong>Invalid token</strong><br />
|
|
|
|
The token entered does not exist. Please enter a valid token to log in.
|
2021-11-24 14:53:12 +00:00
|
|
|
{{else if (eq this.error.status '404')}}
|
|
|
|
<strong>No providers</strong><br />
|
2021-12-13 15:04:35 +00:00
|
|
|
No SSO providers are configured for that Partition.
|
2020-10-26 16:51:53 +00:00
|
|
|
{{else}}
|
|
|
|
<strong>Error</strong><br />
|
2021-11-24 14:53:12 +00:00
|
|
|
{{this.error.detail}}
|
2020-10-26 16:51:53 +00:00
|
|
|
{{/if}}
|
|
|
|
{{/if}}
|
|
|
|
</p>
|
|
|
|
</notice.Body>
|
|
|
|
</Notice>
|
2020-05-11 15:37:11 +00:00
|
|
|
{{/if}}
|
|
|
|
</State>
|
2021-11-24 14:53:12 +00:00
|
|
|
<TabState @matches="token">
|
|
|
|
<form
|
|
|
|
onsubmit={{action dispatch "SUBMIT"}}
|
|
|
|
>
|
2020-05-11 15:37:11 +00:00
|
|
|
<fieldset>
|
2021-11-24 14:53:12 +00:00
|
|
|
<label
|
|
|
|
class={{concat "type-password" (if (and (state-matches state 'error') (not this.error.status)) ' has-error')}}
|
|
|
|
>
|
2020-05-11 15:37:11 +00:00
|
|
|
<span>Log in with a token</span>
|
2021-11-24 14:53:12 +00:00
|
|
|
|
|
|
|
{{! Blink/Webkit based seem to leak password inputs }}
|
|
|
|
{{! this will only occur during acceptance testing so }}
|
|
|
|
{{! turn them into text inputs during acceptance testing }}
|
2020-05-11 15:37:11 +00:00
|
|
|
<input
|
2021-11-24 14:53:12 +00:00
|
|
|
{{did-insert (set this 'input')}}
|
2020-05-11 15:37:11 +00:00
|
|
|
disabled={{state-matches state "loading"}}
|
2021-11-24 14:53:12 +00:00
|
|
|
type={{if (eq (env 'environment') 'testing') 'text' 'password'}}
|
2020-05-11 15:37:11 +00:00
|
|
|
name="auth[SecretID]"
|
|
|
|
placeholder="SecretID"
|
2021-11-24 14:53:12 +00:00
|
|
|
value={{this.secret}}
|
2020-05-11 15:37:11 +00:00
|
|
|
oninput={{queue
|
2021-11-24 14:53:12 +00:00
|
|
|
(action (mut this.secret) value="target.value")
|
|
|
|
(action (mut this.value) value="target.value")
|
2020-05-11 15:37:11 +00:00
|
|
|
(action dispatch "TYPING")
|
|
|
|
}}
|
|
|
|
/>
|
|
|
|
<State @matches="error">
|
2021-11-24 14:53:12 +00:00
|
|
|
{{#if (not this.error.status)}}
|
2020-05-11 15:37:11 +00:00
|
|
|
<strong role="alert">
|
|
|
|
Please enter your secret
|
|
|
|
</strong>
|
|
|
|
{{/if}}
|
|
|
|
</State>
|
|
|
|
</label>
|
|
|
|
</fieldset>
|
2021-11-24 14:53:12 +00:00
|
|
|
<Action
|
|
|
|
@type="submit"
|
|
|
|
disabled={{state-matches state "loading"}}
|
|
|
|
>
|
2020-05-11 15:37:11 +00:00
|
|
|
Log in
|
2021-11-24 14:53:12 +00:00
|
|
|
</Action>
|
2020-05-11 15:37:11 +00:00
|
|
|
</form>
|
2021-11-24 14:53:12 +00:00
|
|
|
</TabState>
|
|
|
|
|
|
|
|
{{yield (assign exported (hash Method=TabState))}}
|
|
|
|
|
|
|
|
<em>
|
|
|
|
Contact your administrator for login credentials.
|
|
|
|
</em>
|
|
|
|
</StateChart>
|
|
|
|
|
|
|
|
|
2020-05-11 15:37:11 +00:00
|
|
|
</div>
|
|
|
|
<State @matches="loading">
|
|
|
|
<TokenSource
|
2021-11-24 14:53:12 +00:00
|
|
|
@dc={{@dc}}
|
|
|
|
@nspace={{or this.value.Namespace @nspace}}
|
|
|
|
@partition={{or this.value.Partition @partition}}
|
|
|
|
@type={{if this.value.Name 'oidc' 'secret'}}
|
2022-01-11 11:02:46 +00:00
|
|
|
@value={{this.value}}
|
2021-11-24 14:53:12 +00:00
|
|
|
@onchange={{queue (action dispatch "RESET") @onsubmit}}
|
|
|
|
@onerror={{queue (action (mut this.error) value="error.errors.firstObject") (action dispatch "ERROR")}}
|
2020-05-11 15:37:11 +00:00
|
|
|
/>
|
|
|
|
</State>
|
2021-11-24 14:53:12 +00:00
|
|
|
{{/let}}
|
|
|
|
{{/let}}
|
2020-05-11 15:37:11 +00:00
|
|
|
</StateChart>
|