Had a chat with the team and removed the above solution. I modified the
existing logout JavaScript function in
site/themes/fancy/templates/user/login/js/login.js to take the current url
as the redirect url.
following is the modified one
loginbox.logout = function () {
jagg.post("/site/blocks/user/login/ajax/login.jag",
{action:"logout"}, function (result) {
if (result.error == false) {
//window.location.href="?"+urlPrefix;
window.location.href=document.URL;
} else {
jagg.message({content:result.message,type:"error"});
}
}, "json");
};
On Fri, Sep 12, 2014 at 12:41 PM, Chamila Adhikarinayake <[email protected]>
wrote:
> Hi all,
>
> I'm working on a logout issue in the API Store mentioned in this jira[1].
>
> This issue happens only when login out from the store after selecting an
> api first. Normally when an api is selected following request is done by
> adding api information as parameters.
>
> https://localhost:9443/store/apis/info?name=app1&version=1&provider=admin
>
> following is the request send when logout is clicked after selecting an
> api.
> https://localhost:9443/store/apis/info?
>
> The reason for the error page is that the page is unable to load the api
> information without the parameters.
>
> The solution I was planning to do is like following
>
> In pages/item-info.jag (where the request comes to), I store the last
> viewed api info into the session. So when a logout request comes without
> the parameters, I get them from the session and display the previously
> viewed api. It would be something like this
>
> //existing code assign name, version, provider from the request parameters
>
> if(name != null && version != null && provider != null) {
> session.put("LastSelectedAppName" ,name);
> session.put("LastSelectedAppVersion" ,version);
> session.put("LastSelectedAppProvider" ,provider);
> } else {
> //assign values when they are not in the request
> name = session.get("LastSelectedAppName");
> version = session.get("LastSelectedAppVersion");
> provider = session.get("LastSelectedAppProvider");
> }
>
> Any Comments on this approach?
>
> [1] https://wso2.org/jira/browse/APIMANAGER-2828
>
> Thanks,
> Chamila.
>
> --
> Regards,
> Chamila Adhikarinayake
> Software Engineer
> WSO2, Inc.
> Mobile - +94712346437
> Email - [email protected]
>
--
Regards,
Chamila Adhikarinayake
Software Engineer
WSO2, Inc.
Mobile - +94712346437
Email - [email protected]
_______________________________________________
Dev mailing list
[email protected]
http://wso2.org/cgi-bin/mailman/listinfo/dev