68 lines
2.8 KiB
HTML
68 lines
2.8 KiB
HTML
{% extends "base.html" %}
|
|
|
|
{% block title %}登录信息{% endblock %}
|
|
|
|
{% block content %}
|
|
<h2>🔐 登录信息</h2>
|
|
<form method="post" action="/login">
|
|
<div class="mb-3">
|
|
<label for="user" class="form-label" id="user-label">用户名</label>
|
|
<input type="text" class="form-control" id="user" name="user">
|
|
</div>
|
|
<div class="mb-3">
|
|
<label for="pw" class="form-label" id="pw-label">密码</label>
|
|
<input type="password" class="form-control" id="pw" name="pw">
|
|
</div>
|
|
<div class="mb-3">
|
|
<label for="token" class="form-label">Token</label>
|
|
<input type="text" class="form-control" id="token" name="token" value="{{ token }}">
|
|
</div>
|
|
<div class="mb-3">
|
|
<label for="scheme" class="form-label">协议</label>
|
|
<select class="form-select" id="scheme" name="scheme">
|
|
<option value="http" {% if scheme == 'http' %}selected{% endif %}>http</option>
|
|
<option value="https" {% if scheme == 'https' %}selected{% endif %}>https</option>
|
|
</select>
|
|
</div>
|
|
<div class="mb-3">
|
|
<label for="url" class="form-label">服务器地址</label>
|
|
<input type="text" class="form-control" id="url" name="url" placeholder="127.0.0.1 或 plex.sample.com" value="{{ server_url }}">
|
|
</div>
|
|
<div class="mb-3">
|
|
<label for="port" class="form-label">端口</label>
|
|
<input type="text" class="form-control" id="port" name="port" value="{{ port }}">
|
|
</div>
|
|
<button type="submit" class="btn btn-primary">连接</button>
|
|
</form>
|
|
|
|
{% if message %}
|
|
<div class="alert alert-{{ 'success' if success else 'danger' }} mt-4">{{ message }}</div>
|
|
{% endif %}
|
|
<script>
|
|
document.addEventListener('DOMContentLoaded', function () {
|
|
const tokenInput = document.getElementById('token');
|
|
const userInput = document.getElementById('user');
|
|
const pwInput = document.getElementById('pw');
|
|
const userLabel = document.getElementById('user-label');
|
|
const pwLabel = document.getElementById('pw-label');
|
|
|
|
function toggleCredFields() {
|
|
const hasToken = tokenInput.value.trim() !== '';
|
|
[userInput, pwInput].forEach(el => {
|
|
el.readOnly = hasToken;
|
|
el.classList.toggle('bg-body-secondary', hasToken);
|
|
el.classList.toggle('text-decoration-line-through', hasToken);
|
|
el.classList.toggle('text-body-secondary', hasToken);
|
|
});
|
|
[userLabel, pwLabel].forEach(el => {
|
|
el.classList.toggle('text-decoration-line-through', hasToken);
|
|
el.classList.toggle('text-body-secondary', hasToken);
|
|
});
|
|
}
|
|
|
|
tokenInput.addEventListener('input', toggleCredFields);
|
|
toggleCredFields();
|
|
});
|
|
</script>
|
|
{% endblock %}
|