<moya xmlns="http://moyaproject.com"
      xmlns:m="http://moyaproject.com"
      xmlns:db="http://moyaproject.com/db"
      xmlns:admin="http://moyaproject.com/admin"
      xmlns:w="http://moyaproject.com/widgets"
      xmlns:html="http://moyaproject.com/html"
      xmlns:let="http://moyaproject.com/let"
      xmlns:widgets="http://noyaproject.com/widgets">

    <content libname="content.base" template="base.html" />

    <content libname="content.login" extends="#content.base">
        <title>Log In</title>
        <section name="body">
            <node template="login_container.html">
                <w:info if=".user">
                    <markdown>
                        You are currently signed in as **${.user.username}**
                    </markdown>
                </w:info>
                <if test=".libs['moya.signup'] and validate_email">
                    <w:well>
                        <markdown>
                            We sent you an email with a link to verify your email address.

                            If you didn't receive the email, please check your spam folder, or click the button below to re-send.
                        </markdown>
                        <w:button-link name="send_validate_email" app="moya.signup" let:username="form.data.username">
                            Send Again
                        </w:button-link>
                    </w:well>
                </if>
                <render src="form"/>
            </node>
        </section>
    </content>

    <content libname="content.user_edit" extends="#content.base">
        <title>Edit User Details</title>
        <section name="body">
            <w:tab-panel active="${tab or 'details'}">
                <w:tab id="details" title="Details">
                    <w:info if="not user_form.errors"><m:markdown>Use this form to edit your details</m:markdown></w:info>
                    <w:success if="details_success">Details updated successfully</w:success>
                    <render src="user_form"/>
                </w:tab>
                <w:tab id="password" title="Password">
                    <w:info if="not password_form.errors"><m:markdown>Use this form to change your password</m:markdown></w:info>
                    <w:success if="password_success">Your password was updated</w:success>
                    <render src="password_form"/>
                </w:tab>
            </w:tab-panel>
        </section>
    </content>

    <content libname="content.forgot_password" extends="#content.base">
        <title>Forgotten Password</title>
        <section name="body">
            <node template="login_container.html">
                <if test="not reset_password">
                    <w:info if="not form.errors">
                        <markdown>Enter your email address below and we will email you a link to reset your password</markdown>
                    </w:info>
                    <render src="form"/>
                </if>
                <w:success if="reset_password">
                    <markdown>
    We have sent an email to **${reset_password.user.email}** with instructions how to reset your password.

    If you don't receive this email within a few minutes, please check your *spam* folder.
                    </markdown>
                </w:success>
            </node>
        </section>
    </content>

    <content libname="content.reset_password" extends="#content.base">
        <title>Reset Password</title>
        <section name="body">
            <node template="login_container.html">
                <w:danger if="badtoken">
                    <markdown>
    **Reset token not found**!

    The link may have been used, or has expired. You can request a new password reset [here](${forgot_password_url}).
                    </markdown>
                </w:danger>
                <render src="form" if="not success and not badtoken"/>
                <if test="success">
                    <w:success if="success">
                        <markdown>
        **Your password has been reset!**

        You may now log in with your new password.
                        </markdown>
                    </w:success>
                    <w:button-link url="${login_url}" visual="primary">Log In</w:button-link>
                </if>
            </node>
        </section>
    </content>

</moya>
