惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

S
Securelist
AI
AI
S
Schneier on Security
T
The Exploit Database - CXSecurity.com
C
CERT Recently Published Vulnerability Notes
C
Cybersecurity and Infrastructure Security Agency CISA
T
Threat Research - Cisco Blogs
T
Tenable Blog
G
GRAHAM CLULEY
腾讯CDC
L
Lohrmann on Cybersecurity
Martin Fowler
Martin Fowler
博客园 - 【当耐特】
The Cloudflare Blog
P
Proofpoint News Feed
V
Visual Studio Blog
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
AWS News Blog
AWS News Blog
D
Docker
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
Latest news
Latest news
L
LINUX DO - 热门话题
CTFtime.org: upcoming CTF events
CTFtime.org: upcoming CTF events
L
LangChain Blog
C
Cyber Attacks, Cyber Crime and Cyber Security
C
CXSECURITY Database RSS Feed - CXSecurity.com
cs.CL updates on arXiv.org
cs.CL updates on arXiv.org
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
W
WeLiveSecurity
Blog — PlanetScale
Blog — PlanetScale
云风的 BLOG
云风的 BLOG
P
Privacy International News Feed
Cloudbric
Cloudbric
Attack and Defense Labs
Attack and Defense Labs
量子位
爱范儿
爱范儿
F
Fortinet All Blogs
博客园 - 三生石上(FineUI控件)
V
Vulnerabilities – Threatpost
Schneier on Security
Schneier on Security
J
Java Code Geeks
S
Security @ Cisco Blogs
N
News and Events Feed by Topic
N
Netflix TechBlog - Medium
博客园 - 司徒正美
I
InfoQ
WordPress大学
WordPress大学
GbyAI
GbyAI
Google DeepMind News
Google DeepMind News

洛屿的小站

STM32F407 IAR环境下uC/OS-III移植完整指南 STM32 UCOS3+HAL库集成中的FPU HardFault问题 一种简单的卡尔曼滤波器设计 Cadence - 应律而动,落指成音 Zephyr - 聆风之息,为你而奏 不改一行插件代码,实现消息优先级与阻断 洛玖定时任务系统 在 butterfly 主题中添加首页点集动画(基于p2line项目) 你好,2026 stm32f4xx-ads1256驱动 stm32f4xx-ad9854并行驱动 主动式网站状态监测实现及其应用 右键菜单加入用Trae打开文件和文件夹 三角洲行动ID映射表 洛玖SDK说明 为网页文章开头添加原文连接 Hexo-Butterfly主题在主页添加GitHub贡献日历 Proteus中555定时器仿真问题 装饰器 洛玖开发日记 STS3032舵机获取力矩输出 mspm0g3507-ad9850 奇怪的bug Paddle模型转PaddleLite 人工智能考核 构建一个yolov3网络 yolo和paddle模型常见输出参数 PaddleDetection 随便写的一些东西 实验室C语言第一次考核题目讲解及相关代码解读 C语言神经网络房价预测系统 C、C++数组,指针,指针数组,数组指针的区别 C、C++的大括号是必须的部分吗? C、C++预处理详解 C、C++其他关键字详解 C、C++存储类型关键字详解 C、C++控制语句关键字详解 C、C++数据类型关键字详解 C、C++关键字 C++药品管理系统 Bi-LSTM(Attention)的PyTorch实现 C语言实现波士顿房价预测 easy库的使用 edgeboardFZ3A相关问题 Predict.py的编写 Paddle环境搭建 百度Paddle模型训练 GMD09601-0.96OLED显示屏 【LeetCode 1617】统计子树中城市之间最大距离 C语言学习相关 STM32阵列按键 CH32(F10X F20X) 最短路 拓扑排序
kotlin网页前后端那些事
洛屿 · 2024-09-07 · via 洛屿的小站

爱来自洛屿❤drluo

登出操作

使用@RequestMapping 注解接收PUT请求,销毁账号session

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
@Controller
@RequestMapping(value = ["/admin"])
interface LoginController {

@RequestMapping(value = ["/logout"], method = [RequestMethod.PUT])
fun logout(request: HttpServletRequest, response: HttpServletResponse)
}

@Component
class LoginControllerImpl : LoginController {
override fun logout(request: HttpServletRequest, response: HttpServletResponse) {
val session = request.session
try {
// 销毁session
request.getSession().invalidate();
} catch (e: Exception) {
e.printStackTrace()
}
}
}

利用javascript响应按钮事件,通过向 url/logout发送PUT请求,进行账号注销

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
const fetchPutRequest = async (url, errorFn) =>
await fetch(url, {method: "PUT"})
.then( () => window.location.href="/login")
.catch(error => errorFn(error));

const logout = () => {
hidePopup() // 此处为弹出框相关函数

fetchPutRequest('/logout',
(error) => {
// 处理错误
console.error('Logout failed:', error);
}
)
}

html/css按钮建立

1
<a class="logout-button" onclick="logout()" >Logout</a>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
.logout-button {
padding: 6px 0 6px 0;
background-color: #4CAF50;
box-shadow: 0 0 8px rgba(255, 255, 255, 0.5);
color: #ffffffc7 !important;
text-align: center;
text-decoration: none;
display: inline-block;
font-size: 18px;
border-radius: 5px;
transition: background-color 0.3s ease, box-shadow 0.3s ease;
position: absolute;
bottom: 160px;
left: 50%;
transform: translateX(-50%);
}

.logout-button::after {
content: '→';
margin-left: 10px;
font-size: 18px;
transition: margin-left 0.3s ease, transform 0.3s ease;
}

.logout-button:hover {
background-color: #45a049;
box-shadow: 0 0 16px rgba(255, 255, 255, 0.5);
}

.logout-button:hover::after {
margin-left: 40px;
}

版权声明: 本博客所有文章除特别声明外,均采用 CC BY-NC-SA 4.0 许可协议。转载请注明来自 洛屿的小站

打赏

  • wechat

    wechat

  • alipay

    alipay