Commit 2b72e84
committed
Redirect to /admin (not host root) after successful SSO sign-in
OmniauthCallbacksController previously relied on Devise's default
`after_sign_in_path_for`, which falls back to the host app's `/`
route. Hosts without a `root` defined hit a routing error; hosts
that do define one (e.g. Rails' welcome page) land somewhere they
don't want to be.
Override `after_sign_in_path_for` to return `/admin` directly, so
the gem keeps working for any ActiveAdmin host without assuming a
root route. Honours `stored_location_for` for deep-link returns.
Also drop the `root to: redirect("/admin")` line from the dummy app
routes — the request spec would previously pass either way because
`/` forwarded to `/admin`. The tighter assertion (response.location
path == "/admin") would have been a false green there.1 parent b51a33f commit 2b72e84
3 files changed
Lines changed: 28 additions & 3 deletions
File tree
- app/controllers/active_admin/oidc/devise
- spec
- dummy/config
- requests
Lines changed: 12 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
45 | 45 | | |
46 | 46 | | |
47 | 47 | | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
48 | 60 | | |
49 | 61 | | |
50 | 62 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3 | 3 | | |
4 | 4 | | |
5 | 5 | | |
6 | | - | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
7 | 11 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
57 | 57 | | |
58 | 58 | | |
59 | 59 | | |
60 | | - | |
61 | 60 | | |
62 | | - | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
63 | 72 | | |
64 | 73 | | |
65 | 74 | | |
| |||
0 commit comments