Fixed login 'intended' redirect for custom urls.
Also changed social account detach wording.
Showing
3 changed files
with
15 additions
and
5 deletions
| ... | @@ -145,7 +145,9 @@ class AuthController extends Controller | ... | @@ -145,7 +145,9 @@ class AuthController extends Controller |
| 145 | auth()->login($user); | 145 | auth()->login($user); |
| 146 | } | 146 | } |
| 147 | 147 | ||
| 148 | - return redirect()->intended($this->redirectPath()); | 148 | + $path = session()->pull('url.intended', '/'); |
| 149 | + $path = baseUrl($path, true); | ||
| 150 | + return redirect($path); | ||
| 149 | } | 151 | } |
| 150 | 152 | ||
| 151 | /** | 153 | /** | ... | ... |
| ... | @@ -215,7 +215,7 @@ class SocialAuthService | ... | @@ -215,7 +215,7 @@ class SocialAuthService |
| 215 | { | 215 | { |
| 216 | session(); | 216 | session(); |
| 217 | auth()->user()->socialAccounts()->where('driver', '=', $socialDriver)->delete(); | 217 | auth()->user()->socialAccounts()->where('driver', '=', $socialDriver)->delete(); |
| 218 | - \Session::flash('success', $socialDriver . ' account successfully detached'); | 218 | + session()->flash('success', title_case($socialDriver) . ' account successfully detached'); |
| 219 | return redirect(auth()->user()->getEditUrl()); | 219 | return redirect(auth()->user()->getEditUrl()); |
| 220 | } | 220 | } |
| 221 | 221 | ... | ... |
| ... | @@ -64,13 +64,21 @@ function setting($key, $default = false) | ... | @@ -64,13 +64,21 @@ function setting($key, $default = false) |
| 64 | 64 | ||
| 65 | /** | 65 | /** |
| 66 | * Helper to create url's relative to the applications root path. | 66 | * Helper to create url's relative to the applications root path. |
| 67 | - * @param $path | 67 | + * @param string $path |
| 68 | + * @param bool $forceAppDomain | ||
| 68 | * @return string | 69 | * @return string |
| 69 | */ | 70 | */ |
| 70 | -function baseUrl($path) | 71 | +function baseUrl($path, $forceAppDomain = false) |
| 71 | { | 72 | { |
| 72 | - if (strpos($path, 'http') === 0) return $path; | 73 | + $isFullUrl = strpos($path, 'http') === 0; |
| 74 | + if ($isFullUrl && !$forceAppDomain) return $path; | ||
| 73 | $path = trim($path, '/'); | 75 | $path = trim($path, '/'); |
| 76 | + | ||
| 77 | + if ($isFullUrl && $forceAppDomain) { | ||
| 78 | + $explodedPath = explode('/', $path); | ||
| 79 | + $path = implode('/', array_splice($explodedPath, 3)); | ||
| 80 | + } | ||
| 81 | + | ||
| 74 | return rtrim(config('app.url'), '/') . '/' . $path; | 82 | return rtrim(config('app.url'), '/') . '/' . $path; |
| 75 | } | 83 | } |
| 76 | 84 | ... | ... |
-
Please register or sign in to post a comment