<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"
      xmlns:tal="http://xml.zope.org/namespaces/tal"
      xmlns:metal="http://xml.zope.org/namespaces/metal"
      xmlns:i18n="http://xml.zope.org/namespaces/i18n"
      i18n:domain="plone"
      tal:define="dummy python:request.response.setHeader('X-Theme-Disabled', 'True');">
<head>
  <title i18n:translate="heading_sign_in">Please log in</title>
</head>

<body>

<div tal:define="checkPermission nocall:context/portal_membership/checkPermission;
                 actions python:context.portal_actions.listActionInfos('user/join', object=context);
                 auth nocall:context/acl_users/credentials_cookie_auth|nothing;
                 came_from request/came_from|request/HTTP_REFERER|nothing;
                 came_from python:test(context.portal_url.isURLInPortal(came_from), came_from, None);
                 ztutils modules/ZTUtils;
                 errors options/state/getErrors;">

<h1 class="documentFirstHeading"
    i18n:translate="heading_sign_in">Please log in</h1>

<p i18n:translate="description_sign_in">
To access this part of the site, you need to log in with your user name and password.
</p>

<p i18n:translate="description_no_account"
   tal:define="join python:[a['url'] for a in actions]"
   tal:condition="python: join and checkPermission('Add portal member', context)">

If you do not have an account here, head over to the

<span i18n:name="registration_form">
    <a href=""
       tal:define="join python:join.pop();
                   join join;
                   join python:join+test(join.find('?')==-1, '?', '&amp;')+ztutils.make_query(came_from=came_from);"
       tal:attributes="href join"
       i18n:translate="description_no_account_registration_linktext">
        registration form</a></span>.

</p>


<dl class="portalMessage error"
    id="enable_cookies_message"
    style="display:none">
    <dt i18n:translate="">
        Error
    </dt>
    <dd i18n:translate="enable_cookies_message_before_login">
        Cookies are not enabled. You must enable cookies before you can log in.
    </dd>
</dl>


<div tal:condition="python: not auth" i18n:translate="login_form_disabled">
    Since cookie authentication is disabled, cookie-based login is not available.
</div>

<form tal:attributes="action python:context.absolute_url()+'/'+template.id"
      method="post"
      id="login_form"
      tal:condition="python:auth">

    <fieldset tal:define="ac_name auth/name_cookie|string:__ac_name;
                          ac_password auth/pw_cookie|string:__ac_password;
                          ac_persist auth/persist_cookie|nothing">

        <legend i18n:translate="legend_account_details">Account details</legend>

        <input type="hidden"
            name="came_from"
            value=""
	    tal:attributes="value came_from" />

        <input type="hidden" name="form.submitted" value="1" />
        <input type="hidden" name="js_enabled" id="js_enabled" value="0" />
        <input type="hidden" name="cookies_enabled" id="cookies_enabled" value="" />
        <input type="hidden" name="login_name" id="login_name" value="" />
        <input type="hidden" name="pwd_empty" id="pwd_empty" value="0" />

        <div class="field"
             tal:define="error python:errors.get(ac_name, None);
                         value python:request.get('login_name', request.get(ac_name, None));"
             tal:attributes="class python:test(error, 'field error', 'field')">

            <label i18n:translate="label_login_name"
                   tal:attributes="for ac_name">Login Name</label>

            <div i18n:translate="help_login_name_caps"
                 class="formHelp">
                Login names are case sensitive, make sure the caps lock key is not enabled.
            </div>

            <div tal:content="error">Validation error output</div>

            <input type="text"
                   size="15"
                   tal:attributes="name ac_name;
                                   id ac_name;
                                   value value;"
                   />

        </div>

        <div class="field"
             tal:define="error python:errors.get(ac_password, None);"
             tal:attributes="class python:test(error, 'field error', 'field')">

            <label i18n:translate="label_password"
                   tal:attributes="for ac_password">Password</label>

            <div class="formHelp">
                <div i18n:translate="help_capslock_password">
                    Case sensitive, make sure caps lock is not enabled.
                </div>
                <div tal:condition="python:checkPermission('Mail forgotten password', context)"
                     i18n:translate="help_password_retrieval">
                    If you have forgotten your password,
                    <span i18n:name="click_here">
                        <a href="mail_password_form"
                           i18n:translate="label_click_here_to_retrieve">we can send you a new one</a>
                    </span>.
                </div>
            </div>

            <div tal:content="error">Validation error output</div>

            <input type="password"
                   size="15"
                   tal:attributes="name ac_password;
                                   id ac_password;"
                   />
        </div>

        <div class="field" tal:condition="ac_persist">

            <input type="checkbox"
                   class="noborder formRememberName"
                   value="1"
                   checked="checked"
                   id="cb_remember"
                   tal:attributes="name ac_persist;
                                   checked python:request.get(ac_name, '') and 'checked' or None;"
                   />

            <label for="cb_remember" i18n:translate="label_remember_my_name">Remember my name.</label>

            <div i18n:translate="help_remember_my_name"
                 class="formHelp">
                Check this to have your user name filled in automatically when you log in later.
            </div>

        </div>

        <div class="formControls">

            <input class="context"
                   type="submit"
                   name="submit"
                   value="Log in"
                   i18n:attributes="value label_log_in;" />

        </div>

        <p i18n:translate="remember_to_log_out">
            Please log out or exit your browser when you're done.
        </p>

    </fieldset>

</form>
</div>

</body>
</html>
