Files
iAOP/web/auth/login.html
T

74 lines
3.0 KiB
HTML
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>iAOP 登录</title>
<link rel="stylesheet" href="auth.css">
</head>
<body>
<!--
iAOP 登录页(issue #150 / PRD 8.2)。
后端:core/auth/auth_api.py(POST /auth/login → token + Set-Cookie)。
会话:core/auth/session.py(HMAC token,HttpOnly cookie iaop_session)。
写操作守卫:core/auth/auth_api.py require_auth / can_write(未登录/readonly 拒绝写)。
-->
<form class="auth-card" id="loginForm" autocomplete="on" novalidate>
<div class="auth-brand">
<div class="auth-logo">iA</div>
<h1>云美工业AI优化平台</h1>
</div>
<div class="auth-sub">Template-Ti 一期 · 配置台登录</div>
<div class="alert" id="alert" role="alert" aria-live="polite"></div>
<div class="field">
<label for="username">用户名</label>
<input id="username" name="username" type="text" required
autocomplete="username" placeholder="请输入用户名" maxlength="64">
</div>
<div class="field">
<label for="password">密码</label>
<input id="password" name="password" type="password" required
autocomplete="current-password" placeholder="请输入密码" minlength="8">
</div>
<div class="auth-actions">
<button type="submit" class="btn btn-primary" id="loginBtn">登录</button>
<button type="button" class="btn btn-ghost" id="togglePwd" title="显示/隐藏密码" aria-label="显示或隐藏密码">👁</button>
</div>
<!-- issue #152:OIDC SSO 双轨入口——配置了 issuer/client_id 时显示,
未配置仅本地账号(PRD 8.2 双轨)。配置点在用户管理页维护。 -->
<div class="auth-actions" id="sso-row" hidden>
<button type="button" class="btn btn-ghost" id="ssoBtn" style="width:100%">企业 SSO 登录(OIDC)</button>
</div>
<div class="role-hint">
角色:readonly 只读 / engineer 可配置 / admin 可发布回滚。<br>
未登录或只读角色不可执行写操作(PRD 8.2)。
</div>
<div class="auth-foot">
认证后端 core/auth · 会话 HttpOnly cookie · 密码 PBKDF2-HMAC-SHA256
</div>
</form>
<script src="user_store.js"></script>
<script src="auth.js"></script>
<script>
// issue #152:OIDC 双轨——已配置 issuer/client_id 则显示 SSO 入口,
// 点击跳转标准授权码流程 authorize URL(state 已写入 sessionStorage);
// 未配置则保持纯本地账号登录。
document.addEventListener("DOMContentLoaded", function () {
if (typeof UserStore === "undefined") return;
var url = UserStore.oidcAuthorizeUrl("/auth/login.html");
if (!url) return;
var row = document.getElementById("sso-row");
row.hidden = false;
document.getElementById("ssoBtn").onclick = function () { location.href = url; };
});
</script>
</body>
</html>