Skip to content

Commit bab2b62

Browse files
authored
Fix some redirections after logging in (#175)
Signed-off-by: Cintia Sánchez García <[email protected]>
1 parent dce05b1 commit bab2b62

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

ocg-server/templates/event/attend_button.html

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313

1414
<!-- Sign in prompt (hidden initially) -->
1515
<button id="signin-btn"
16+
data-path="{{ path }}"
1617
class="hidden group btn-primary-outline-anchor w-52 h-[40px] sm:h-[30px] flex items-center justify-center space-x-2">
1718
<div class="svg-icon size-3 icon-user-plus group-hover:bg-white transition-colors"></div>
1819
<span>Attend event</span>
@@ -175,8 +176,9 @@
175176
const signinBtn = document.getElementById("signin-btn");
176177
if (signinBtn) {
177178
signinBtn.addEventListener("click", () => {
179+
const path = signinBtn.dataset.path || window.location.pathname;
178180
showInfoAlert(
179-
"You need to be <a href='/log-in' class='underline font-medium' hx-boost='true'>logged in</a> to attend this event.",
181+
`You need to be <a href='/log-in?next_url=${path}' class='underline font-medium' hx-boost='true'>logged in</a> to attend this event.`,
180182
true,
181183
);
182184
});

ocg-server/templates/group/membership_button.html

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212

1313
<!-- Sign in prompt (hidden initially) -->
1414
<button id="signin-btn"
15+
data-path="{{ path }}"
1516
class="hidden group btn-primary-outline-anchor w-40 h-[40px] md:h-[30px] flex items-center justify-center space-x-2">
1617
<div class="svg-icon size-3 icon-user-plus group-hover:bg-white transition-colors"></div>
1718
<span>Join group</span>
@@ -135,8 +136,9 @@
135136
const signinBtn = document.getElementById("signin-btn");
136137
if (signinBtn) {
137138
signinBtn.addEventListener("click", () => {
139+
const path = signinBtn.dataset.path || window.location.pathname;
138140
showInfoAlert(
139-
"You need to be <a href='/log-in' class='underline font-medium' hx-boost='true'>logged in</a> to join this group.",
141+
`You need to be <a href='/log-in?next_url=${path}' class='underline font-medium' hx-boost='true'>logged in</a> to join this group.`,
140142
true,
141143
);
142144
});

0 commit comments

Comments
 (0)