2021-03-17 15:58:17 +00:00
|
|
|
---
|
|
|
|
class: ember
|
|
|
|
---
|
|
|
|
# AuthDialog
|
2020-05-11 15:37:11 +00:00
|
|
|
|
2021-03-17 15:58:17 +00:00
|
|
|
```hbs preview-template
|
2021-11-24 14:53:12 +00:00
|
|
|
<AuthDialog
|
|
|
|
@dc={{'dc-1'}}
|
|
|
|
@nspace={{'default'}}
|
|
|
|
@partition={{'default'}}
|
|
|
|
@onchange={{action (noop)}}
|
|
|
|
as |api components|>
|
2020-05-11 15:37:11 +00:00
|
|
|
{{#let components.AuthForm components.AuthProfile as |AuthForm AuthProfile|}}
|
|
|
|
<BlockSlot @name="unauthorized">
|
|
|
|
Here's the login form:
|
|
|
|
<AuthForm />
|
|
|
|
</BlockSlot>
|
|
|
|
<BlockSlot @name="authorized">
|
|
|
|
Here's your profile:
|
|
|
|
<AuthProfile />
|
2021-03-17 15:58:17 +00:00
|
|
|
<button onclick={{action api.logout}}>Logout</button>
|
2020-05-11 15:37:11 +00:00
|
|
|
</BlockSlot>
|
|
|
|
{{/let}}
|
|
|
|
</AuthDialog>
|
|
|
|
```
|
|
|
|
|
|
|
|
### Arguments
|
|
|
|
|
|
|
|
A component to help orchestrate a login/logout flow.
|
|
|
|
|
|
|
|
| Argument | Type | Default | Description |
|
|
|
|
| --- | --- | --- | --- |
|
|
|
|
| `dc` | `String` | | The name of the current datacenter |
|
|
|
|
| `nspace` | `String` | | The name of the current namespace |
|
2021-11-24 14:53:12 +00:00
|
|
|
| `partition` | `String` | | The name of the current partition |
|
2020-05-11 15:37:11 +00:00
|
|
|
| `onchange` | `Function` | | An action to fire when the users token has changed (logged in/logged out/token changed) |
|
|
|
|
|
|
|
|
### Methods/Actions/api
|
|
|
|
|
|
|
|
| Method/Action | Description |
|
|
|
|
| --- | --- |
|
|
|
|
| `login` | Login with a specified token |
|
|
|
|
| `logout` | Logout (delete token) |
|
|
|
|
| `token` | The current token itself (as a property not a method) |
|
|
|
|
|
|
|
|
### Components
|
|
|
|
|
|
|
|
| Name | Description |
|
|
|
|
| --- | --- |
|
|
|
|
| [`AuthForm`](../auth-form/README.mdx) | Renders an Authorization form |
|
|
|
|
| [`AuthProfile`](../auth-profile/README.mdx) | Renders a User Profile |
|
|
|
|
|
|
|
|
### Slots
|
|
|
|
|
|
|
|
| Name | Description |
|
|
|
|
| --- | --- |
|
|
|
|
| `unauthorized` | This slot is only rendered when the user doesn't have a token |
|
|
|
|
| `authorized` | This slot is only rendered whtn the user has a token.|
|
|
|
|
|
|
|
|
### See
|
|
|
|
|
|
|
|
- [Component Source Code](./index.js)
|
|
|
|
- [Template Source Code](./index.hbs)
|
|
|
|
|
|
|
|
---
|