generated from filamentphp/plugin-skeleton
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Save Previous Panel URL for after Login #34
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Refactored SocialmentPlugin to support multi-panel functionality, and added new routes for handling panel-based redirects. Improved error handling in SocialmentController's callback method. Updated providers-list view to support dynamic provider URLs based on panel configuration.
This commit modifies the redirect after a successful login to direct the user to their intended URL. This is achieved by pulling the intended URL from the session, falling back to the home route if not found.
…ation A new `redirectSpa` method has been added to the SocialmentController, which stores the referring URL in the session and initiates a socialite redirect. The callback method now also supports intended URL redirection and has been configured to consider 'spa' as the authentication guard. This change will allow the application to handle Single Page Application (SPA) authentication flows more elegantly. Additional changes include updates to the routes configuration to incorporate the new `redirectSpa` method, and modifications to the `providers-list.blade.php` view to reflect the updated routing. Updated `socialment.php` configuration file to include a new `spa` array containing the home URL for SPAs, making it easily customizable. This will ensure that users are redirected to the correct location after a successful login in an SPA context. This enhancement will improve the application's flexibility in handling different authentication scenarios and improve the user experience for SPA-based log
The user model reference in the socialment configuration file has been updated to use a string representation instead of directly referring to the class.
This has expanded to include Social SPA authentication as well. |
Reformatted README to enhance readability and maintain line width consistency. Expanded documentation to include new SPA authentication feature, detailing setup, middleware configuration, and necessary environment variable adjustments. The new SPA guard setup is especially significant for developers integrating front-end SPAs with backend Laravel applications, offering a more streamlined authentication process between the two systems. The changes also include a warning about the experimental nature of the SPA feature, advising developers to use it cautiously. Added a new file `SpaAuthentication.php` to handle SPA authentication middleware logic, enforcing user authentication for designated SPA routes and providing a more secure user experience for SPA applications. Note: While the feature is still in development, the documentation outlines the current setup process and acknowledges the potential for future changes.
Import Closure class to ensure proper type hinting and function resolution within the middleware
Refactor `SpaAuthentication` middleware to accept a guard parameter. This change simplifies auth checks, allowing dynamic guard assignment. Removed redundant comments and outdated response handling. Improved API error response for unauthenticated access in SPA context.
- Moved SocialmentController to Http namespace - Added handling for SPA authentication - Created new UserResponse and SpaAuthController - Implemented CSRF cookie for SPA login - Refactored SocialmentPlugin to support global pre/post login callbacks - Added new routes for SPA authentication - Simplified OAuth callback logic in SocialmentController This change streamlines the social authentication process by organizing controllers, adding SPA-specific endpoints, and allowing global hooks for pre and post login actions. It enhances the security and structure of the codebase, making it more maintainable and easier to understand.
- Deprecate old redirect method in favor of centralized one - Ensure intended URL is stored before redirecting to OAuth provider - Redirect directly to intended URL after login instead of route - Clean up unnecessary code and comments for clarity and maintainability By centralizing the redirect logic and handling of intended URLs, this commit aims to reduce complexity and potential for bugs in the social authentication flow. It simplifies the callback method by removing fallbacks that are no longer necessary and ensures users are redirected to their intended URL immediately after login, improving the user experience. 🚀
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This is WIP but was originally intended for sending the user back to the panel of the login page they used.