feat: make login land on protected portal

This commit is contained in:
Codex
2026-03-24 17:07:40 +08:00
parent dfbe28a047
commit da1586f6fe
4 changed files with 24 additions and 23 deletions

View File

@@ -80,6 +80,7 @@
<version>${jetty.version}</version>
<configuration>
<scanIntervalSeconds>0</scanIntervalSeconds>
<webAppSourceDirectory>${project.basedir}/web</webAppSourceDirectory>
<webApp>
<contextPath>/</contextPath>
</webApp>

View File

@@ -37,7 +37,7 @@
</action>
<action name="login" class="com.demo.action.LoginAction" method="execute">
<result name="success" type="redirectAction">dashboard</result>
<result name="success" type="redirectAction">index</result>
<result name="input">/WEB-INF/views/user/login.jsp</result>
</action>

View File

@@ -155,7 +155,7 @@
<div class="lang-warning" id="heroWarning">登录后才能看到完整课程导航与实验入口。</div>
<div class="hero-actions">
<a class="btn" href="dashboard.action" id="heroActionPrimary">进入仪表盘</a>
<a class="btn-soft" href="loginPage.action" id="heroActionSecondary">立即登录</a>
<a class="btn-soft" href="logout.action" id="heroActionSecondary">退出登录</a>
<button class="btn-ghost" type="button" id="languageBtnHero">EN</button>
</div>
<div class="session-note" id="heroSessionNote">
@@ -240,10 +240,10 @@
text: {
heroEyebrow: "Struts2 学习门户",
heroTitle: "登录之后才能继续学习",
heroDesc: "所有入口都由 Session + AuthInterceptor 保护,未登录将自动跳回登录页。",
heroWarning: "未登录不能访问实验页;登录后可畅玩全部模块。",
heroDesc: "所有入口都由 Session + AuthInterceptor 保护,未登录将自动跳回登录页;登录成功后会先回到这个统一门户。",
heroWarning: "当前门户本身也在登录保护之下,适合用来总览各实验模块。",
heroActionPrimary: "进入仪表盘",
heroActionSecondary: "立即登录",
heroActionSecondary: "退出登录",
portalEyebrow: "学习模块导航",
portalTitle: "分步骤理解 Struts2",
portalDesc: "每个 `.action` 路径都在登录后才能访问Session 鉴权串联整个体验。",
@@ -262,10 +262,10 @@
text: {
heroEyebrow: "Struts2 Learning Portal",
heroTitle: "Login before you explore",
heroDesc: "All modules are protected by Session + AuthInterceptor. Unauthenticated access goes back to login.",
heroWarning: "Access denied until login; dashboard and labs available after authentication.",
heroDesc: "All modules are protected by Session + AuthInterceptor. After login, this protected portal becomes the unified entry.",
heroWarning: "The portal itself is protected and serves as the overview for every lab module.",
heroActionPrimary: "Go to dashboard",
heroActionSecondary: "Login now",
heroActionSecondary: "Log out",
portalEyebrow: "Module guide",
portalTitle: "Step-by-step Struts2",
portalDesc: "Every `.action` route sits behind login; the session chain secures the experience.",

View File

@@ -151,14 +151,14 @@
</div>
<div class="stat">
<strong id="statTwoTitle">下一步看什么</strong>
<span id="statTwoText">登录成功后先看仪表盘,再进入用户表单、校验页和上传页。</span>
<span id="statTwoText">登录成功后会先回到学习门户,再进入仪表盘、用户表单、校验页和上传页。</span>
</div>
</div>
<div class="links">
<a class="link-btn" href="../index.action" id="backPortalLink">返回门户</a>
<s:if test="#session.demoUser != null">
<a class="link-btn" href="../dashboard.action" id="dashboardLink">进入仪表盘</a>
<a class="link-btn" href="../index.action" id="dashboardLink">进入学习门户</a>
<a class="link-btn" href="../logout.action" id="logoutLink">退出登录</a>
</s:if>
<s:else>
@@ -174,10 +174,10 @@
<s:if test="#session.demoUser != null">
<div class="note">
<strong id="loggedInTitle">当前已登录</strong>
<p id="loggedInText" style="margin-top: 8px;">你已经拥有可访问的 Session可以直接进入仪表盘或退出后重新体验登录过程。</p>
<p id="loggedInText" style="margin-top: 8px;">你已经拥有可访问的 Session可以先进入学习门户总览全部模块,也可以退出后重新体验登录过程。</p>
</div>
<div class="links">
<a class="link-btn" href="../dashboard.action" id="loggedInDashboardLink">打开仪表盘</a>
<a class="link-btn" href="../index.action" id="loggedInDashboardLink">打开学习门户</a>
<a class="link-btn" href="../logout.action" id="loggedInLogoutLink">退出后重试</a>
</div>
</s:if>
@@ -199,7 +199,7 @@
<div class="error"><s:fielderror fieldName="password"/></div>
</div>
<button class="submit-btn" type="submit" id="submitBtn">写入 Session 并进入仪表盘</button>
<button class="submit-btn" type="submit" id="submitBtn">写入 Session 并进入学习门户</button>
</s:form>
</s:else>
</section>
@@ -219,20 +219,20 @@
statOneTitle: "这一页讲什么",
statOneText: "Action 校验、错误回显、Session 写入、登录后跳转。",
statTwoTitle: "下一步看什么",
statTwoText: "登录成功后先看仪表盘,再进入用户表单、校验页和上传页。",
statTwoText: "登录成功后会先回到学习门户,再进入仪表盘、用户表单、校验页和上传页。",
backPortalLink: "返回门户",
dashboardLink: "进入仪表盘",
dashboardLink: "进入学习门户",
logoutLink: "退出登录",
formEyebrow: "登录表单",
formTitle: "输入演示账号",
loggedInTitle: "当前已登录",
loggedInText: "你已经拥有可访问的 Session可以直接进入仪表盘或退出后重新体验登录过程。",
loggedInDashboardLink: "打开仪表盘",
loggedInText: "你已经拥有可访问的 Session可以先进入学习门户总览全部模块,也可以退出后重新体验登录过程。",
loggedInDashboardLink: "打开学习门户",
loggedInLogoutLink: "退出后重试",
helloLink: "运行 Hello Action",
usernameLabel: "用户名",
passwordLabel: "密码",
submitBtn: "写入 Session 并进入仪表盘"
submitBtn: "写入 Session 并进入学习门户"
},
html: {
credentialBody: "用户名:<code>admin</code><br/>密码:<code>123456</code>"
@@ -248,20 +248,20 @@
statOneTitle: "What this page teaches",
statOneText: "Action validation, error echoing, session writes, and post-login routing.",
statTwoTitle: "What to open next",
statTwoText: "After login, open the dashboard first, then continue to the user form, validation page, and upload page.",
statTwoText: "After login, return to the learning portal first, then continue to the dashboard, user form, validation page, and upload page.",
backPortalLink: "Back to portal",
dashboardLink: "Open dashboard",
dashboardLink: "Open learning portal",
logoutLink: "Log out",
formEyebrow: "Login form",
formTitle: "Enter the demo account",
loggedInTitle: "Already logged in",
loggedInText: "A valid session already exists. You can open the dashboard directly or log out and replay the login flow.",
loggedInDashboardLink: "Open dashboard",
loggedInText: "A valid session already exists. Open the learning portal for the full overview or log out and replay the login flow.",
loggedInDashboardLink: "Open learning portal",
loggedInLogoutLink: "Log out and retry",
helloLink: "Run hello action",
usernameLabel: "Username",
passwordLabel: "Password",
submitBtn: "Write session and enter dashboard"
submitBtn: "Write session and enter learning portal"
},
html: {
credentialBody: "Username: <code>admin</code><br/>Password: <code>123456</code>"