import { html } from "lit-html"; import { __ } from '@converse/headless/i18n'; import tpl_spinner from './spinner.js'; const i18n_anon_login = __('Click here to log in anonymously'); const i18n_disconnected = __('Disconnected'); const i18n_login = __('Log in'); const i18n_hint_no_account = __("Don't have a chat account?"); const i18n_password = __('Password'); const i18n_trusted = __('This is a trusted device'); const i18n_xmpp_address = __("XMPP Address"); const i18n_create_account = __("Create an account"); const i18n_hint_trusted = __( 'To improve performance, we cache your data in this browser. '+ 'Uncheck this box if this is a public computer or if you want your data to be deleted when you log out. '+ 'It\'s important that you explicitly log out, otherwise not all cached data might be deleted. '+ 'Please note, when using an untrusted device, OMEMO encryption is NOT available.') const trust_checkbox = (o) => html`
`; const password_input = () => html`
`; const register_link = (o) => html`

${i18n_hint_no_account}

`; const show_register_link = (o) => { const _converse = o._converse; return _converse.allow_registration && !_converse.auto_login && _converse.pluggable.plugins['converse-register'].enabled(_converse); } const auth_fields = (o) => html`
${ (o.authentication !== o.EXTERNAL) ? password_input() : '' } ${ o.show_trust_checkbox ? trust_checkbox(o) : '' }
${ show_register_link(o) ? register_link(o) : '' } `; const form_fields = (o) => html` ${ (o.authentication == o.LOGIN || o.authentication == o.EXTERNAL) ? auth_fields(o) : '' } ${ o.authentication == o.ANONYMOUS ? html`` : '' } ${ o.authentication == o.PREBIND ? html`

${i18n_disconnected}

` : '' } `; export default (o) => html`
${ (o._converse.CONNECTION_STATUS[o.connection_status] === 'CONNECTING') ? tpl_spinner() : form_fields(o) }
`;