Commit f78da0e
DSpace9/Redirect back to originating page after DiscoJuice local login (#1472)
* Clarin9/Redirect back to originating page after DiscoJuice local login (#876)
On the standalone login page the post-login redirect ignored the `redirectUrl`
query param that the DiscoJuice local-auth flow (src/aai/aai.js) appends as the
absolute page URL, so signing in from e.g. the search page always landed on the
home page. `LogInPasswordComponent.submit()` now reads that query param, reduces
it to an app-relative path (the same format `HardRedirectService.getCurrentRoute()`
produces, which `reloadGuard` already consumes), and uses it as the redirect
target; it prefers a nested `redirectUrl` so login is never the target, and keeps
the previous `setRedirectUrlIfNotSet('/')` fallback when no param is present.
Fixes the dspace-ui-tests LINDAT-013 scenario (loginPage.spec.ts "login from
search page should redirect back to search page"). Mirrors the dtq-dev fix
9dff6af, adapted to the refactored v9 component.
Refs #876
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
* Clarin9/Trim inline comments in log-in-password redirect fix
Shorten the multiline comments/JSDoc added for the redirect-from-search fix
to one-liners; the fuller rationale now lives in the PR description.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
* Clarin9/Address Copilot review: harden redirectUrl parsing
- getRedirectUrlFromQueryParams() now returns `string | null` and guards against
non-string (e.g. repeated `string[]`) query params, so login submission falls
back to the default redirect instead of throwing.
- Normalize the redirect with a string `.replace(/^https?:\/\/[^/]+/i, '')`
(v7-style, can't throw) instead of `new URL(...)`.
- Add unit tests for an already-relative redirectUrl and a non-string value.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
---------
Co-authored-by: Matus Kasak <matus.kasak@dataquest.sk>
Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>1 parent dd506ab commit f78da0e
2 files changed
Lines changed: 108 additions & 2 deletions
File tree
Lines changed: 76 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
158 | 158 | | |
159 | 159 | | |
160 | 160 | | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
| 207 | + | |
| 208 | + | |
| 209 | + | |
| 210 | + | |
| 211 | + | |
| 212 | + | |
| 213 | + | |
| 214 | + | |
| 215 | + | |
| 216 | + | |
| 217 | + | |
| 218 | + | |
| 219 | + | |
| 220 | + | |
| 221 | + | |
| 222 | + | |
| 223 | + | |
| 224 | + | |
| 225 | + | |
| 226 | + | |
| 227 | + | |
| 228 | + | |
| 229 | + | |
| 230 | + | |
| 231 | + | |
| 232 | + | |
| 233 | + | |
| 234 | + | |
| 235 | + | |
| 236 | + | |
161 | 237 | | |
162 | 238 | | |
163 | 239 | | |
| |||
Lines changed: 32 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
17 | 17 | | |
18 | 18 | | |
19 | 19 | | |
20 | | - | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
21 | 24 | | |
22 | 25 | | |
23 | 26 | | |
| |||
145 | 148 | | |
146 | 149 | | |
147 | 150 | | |
| 151 | + | |
148 | 152 | | |
149 | 153 | | |
150 | 154 | | |
| |||
239 | 243 | | |
240 | 244 | | |
241 | 245 | | |
242 | | - | |
| 246 | + | |
| 247 | + | |
| 248 | + | |
| 249 | + | |
| 250 | + | |
| 251 | + | |
| 252 | + | |
243 | 253 | | |
244 | 254 | | |
245 | 255 | | |
| |||
249 | 259 | | |
250 | 260 | | |
251 | 261 | | |
| 262 | + | |
| 263 | + | |
| 264 | + | |
| 265 | + | |
| 266 | + | |
| 267 | + | |
| 268 | + | |
| 269 | + | |
| 270 | + | |
| 271 | + | |
| 272 | + | |
| 273 | + | |
| 274 | + | |
| 275 | + | |
| 276 | + | |
| 277 | + | |
| 278 | + | |
| 279 | + | |
| 280 | + | |
| 281 | + | |
252 | 282 | | |
253 | 283 | | |
254 | 284 | | |
| |||
0 commit comments