<?php
include 'common.php';

if ($user->hasLogin() || !$options->allowRegister) {
    $response->redirect($options->siteUrl);
}
$rememberName = Typecho_Cookie::get('__typecho_remember_name');
$rememberMail = Typecho_Cookie::get('__typecho_remember_mail');
Typecho_Cookie::delete('__typecho_remember_name');
Typecho_Cookie::delete('__typecho_remember_mail');

include 'header.php';
?>

<div class="typecho-login">
    <h1>Typecho</h1>
    <form action="<?php $options->registerAction(); ?>" method="post" name="register" role="form">
        <p>
            <label for="name" class="visuallyhidden"><?php _e('用户名'); ?></label>
            <input type="text" id="name" name="name" placeholder="<?php _e('用户名'); ?>" value="<?php echo $rememberName; ?>" class="text-l w-100" />
        </p>
        <p>
            <label for="mail" class="visuallyhidden"><?php _e('Email'); ?></label>
            <input type="email" id="mail" name="mail" placeholder="<?php _e('Email'); ?>" value="<?php echo $rememberMail; ?>" class="text-l w-100" />
        </p>
        <p class="submit">
            <button type="submit" class="btn-l w-100 primary"><?php _e('注册'); ?></button>
        </p>
    </form>
    
    <p class="more-link">
        <a href="<?php $options->siteUrl(); ?>"><?php _e('返回首页'); ?></a>
        &bull;
        <a href="<?php $options->adminUrl('login.php'); ?>"><?php _e('用户登录'); ?></a>
    </p>
</div>
<?php 
include 'common-js.php';
?>
<script>
$(document).ready(function () {
    $('#name').focus();
});
</script>
<?php
include 'footer.php';
?>
