<script setup>
// Copyright 2024 FlexCDN root@flexcdn.cn. All rights reserved. Official site: https://flexcdn.cn .

import ctxRef from "@/utils/ctx_ref.js"
import Context from "./index.js"
import TInputText from "@/components/ui/TInputText.vue";
import PostForm from "@/components/form/PostForm.vue";
import SubmitButton from "@/components/form/SubmitButton.vue";
import DefinitionTable from "@/components/common/DefinitionTable.vue";

const ctx = ctxRef(new Context())

</script>

<template>
	<PostForm action="$" @success="ctx.success">
		<DefinitionTable>
			<tbody>
			<tr>
				<td class="title">登录用户名 *</td>
				<td>
					<TInputText name="username" maxlength="50" v-model="ctx.user.username" autofocus class="w-full"/>
					<p class="comment">只能含有英文、数字或下划线。</p>
				</td>
			</tr>
			<tr>
				<td>登录密码</td>
				<td>
					<TInputText type="password" name="password" maxlength="50" v-model="ctx.password" class="w-full"/>
					<p class="comment">不填表示保留原有密码<span v-if="ctx.password.length > 0 && ctx.complexPassword">；不小于6位，只能包含英文字母、数字、下划线</span>。
					</p>
				</td>
			</tr>
			<tr>
				<td>确认密码</td>
				<td>
					<TInputText type="password" name="password2" maxlength="50" class="w-full"/>
					<p class="comment">不填表示保留原有密码。</p>
				</td>
			</tr>
			</tbody>
		</DefinitionTable>
		<SubmitButton></SubmitButton>
	</PostForm>
</template>

<style lang="postcss" scoped>
</style>