Commit graph

3 commits

Author SHA1 Message Date
Derick Alangi a9ead1938b menu: Add system generated logoutToken on logout action in Minerva
Upon building the menu components for logged in users, the logoutToken
was not properly appended to the logout URL. The URL is supposed to be

`?title=Special:UserLogout&returnto=...&logoutToken=...`

and not what was rendered previously, see below

`?title=Special:UserLogout&<token>`

The absense of the 'logoutToken' param prompted an intermediate step asking
users to confirm the logout action. We don't need this in Minerva if users want
to logout from their accounts and asking users to confirm this action is annoying.

We want the user to be able to logout when the "Logout" button is clicked
and the system would have generated a logout token and appended to the logout
URL in the format specified above. This patch has been tested locally and
everything works just fine.

Bug: T225220
Change-Id: I20f30db707915179a0604a1dc9061d8db225a230
2019-06-11 12:54:37 +01:00
Kosta Harlan b035d76d0f Add method for getting menu entry by name
* Also fix typo with $returnToQuery
* More usage of DomainException

Bug: T222834
Change-Id: I5623741779eebe4c5694bdbd7a1aa1bcdd7f04c6
2019-06-06 13:04:29 -04:00
Piotr Miazga b899286650 Encapsulate Login/profile/logout meny entry logic into AuthMenuEntry
The Growth extension would like to override the the profile link in
the main menu. We can replace the MenuEntry from group, but
modifications of each component shouldn't be allowed. That approach
is too much error prone. Furthermore it won't allow us to change
how the Login/Logout link works.

The Menu/Group accepts IMenuEntry objects, instead of building
complicated Login/Logout menu entry, let's encapsulate all that
logic into small, well-contained AuthMenuEntry object.

Now, as we have the AuthMenuEntry, we can add an `overrideProfileURL'
method to allow the profile url modifications. That approach will
allow modify profile links, and "how to modify links" logic in
one place.

Changes:
 - extracted Definitions::insertLogInOutMenuItem() body into new
AuthMenuEntry class
 - renamed some variables like $logoutUrl for better readability
 - introduced `AuthMenuEntry::overrideProfileUrl()` method that
allows modification of the Profile url, label and tracking code.

Bug: T222834
Change-Id: Ib7356acbd3373c7a4b591c9c133d7d02a55239b0
2019-06-05 21:17:31 +02:00