Skip to content
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

Redirect guests to login if they follow the link of a comment mention… #11185

Merged

Conversation

nickvergessen
Copy link
Member

…-notification

Fix #11184

* @NoCSRFRequired
*
* @param string $id the comment ID
* @return Response
*/
public function view($id) {
$currentUser = $this->userSession->getUser();
if (!$currentUser instanceof IUser) {
return new RedirectResponse(
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it's a bit of a hack. Would be more comfortable if that was dealt with on the middleware-level

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, fine by me. The middleware would basically do the same. Just instead of throwing an exception it makes a redirect response...

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure, but then we have it at one, reusable place, don't need to soften the restrictions of the controller and are less likely to refactor it away accidentally.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would still prefer this to be backported to 14 instead of a middleware change.
Also for the middleware, the constructor still needs to be changed to get rid of Folder I think, but we could test that later.

The other thing I'm not sure about is, if we should do that for all pages which are not PublicPage or if it should be explicit, because it makes no sense to do this for API calls.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fair enough.

If we can avoid another annotation we should go for it… I share your doubts about it, too. Thus tending towards an explicit statement.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So why isn't the default logic kicking in (to redirect if not logged in)?

Anyway lets do this as it is a bit specific to comments anyway.

Copy link
Member

@blizzz blizzz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

as discussed

…-notification

Signed-off-by: Joas Schilling <coding@schilljs.com>
@rullzer rullzer force-pushed the bugfix/noid/redirect-guests-to-login-on-mention-notification branch from dfb0ff0 to e375107 Compare October 2, 2018 06:40
Copy link
Member

@rullzer rullzer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I rebased to run the tests again lets see :)

@rullzer rullzer merged commit 0c18b4d into master Oct 2, 2018
@rullzer rullzer deleted the bugfix/noid/redirect-guests-to-login-on-mention-notification branch October 2, 2018 17:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants