Ask Questions and Find Answers
Important:
Ask is now read-only. You can review any existing questions and answers, but not add anything new.
But - don't panic! While ask is no more, we've replaced it with discuss - the new Liferay Discussion Forum! Read more here here or just visit the site here:
discuss.liferay.com
Session problem with webscreenlet for iOS
Hello,
We’re trying to go to a relative url using a webscreenlet component (Liferay 6.2) for iOS using the native liferay sdk.
For redirecting user to this url, we’re previously checking the session validity, so the user is logged in.
SessionContext.loadStoredCredentials()
if(SessionContext.isLoggedIn) {
……
}
When the webscreenlet loads the url, the method self.webSreenlet?.load() inserts the user, password and webUrl in the html string correctly.
let webScreenletConfiguration = WebScreenletConfigurationBuilder(url: self.url).load()
webScreenlet?.configuration = webScreenletConfiguration
webScreenlet?.loggingEnabled = true
self.webScreenlet?.load(
)
This is the HTML string loaded by the webscreenlet
"<html>\n\n<head>\n\t<script>\n\t\tfunction post() {\n\t\t\tvar method = \'post\';\n\t\t\tvar form = document.createElement(\'form\');\n\t\t\tform.setAttribute(\'method\', method);\n\t\t\tform.setAttribute(\'action\', \'/c/portal/login?redirect=XXXXX');\n\n\t\t\tvar params = {\n\t\t\t\tlogin: \’XXXX\',\n\t\t\t\tpassword: \’XXXX\',\n\t\t\t\trememberMe: true\n\t\t\t};\n\n\t\t\tfor (var key in params) {\n\t\t\t\tif (params.hasOwnProperty(key)) {\n\t\t\t\t\tvar hiddenField = document.createElement(\'input\');\n\t\t\t\t\thiddenField.setAttribute(\'type\', \'hidden\');\n\t\t\t\t\thiddenField.setAttribute(\'name\', key);\n\t\t\t\t\thiddenField.setAttribute(\'value\', params[key]);\n\n\t\t\t\t\tform.appendChild(hiddenField);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tdocument.body.appendChild(form);\n\t\t\tform.submit();\n\t\t}\n\t</script>\n</head>\n\n<body onload=post()>\n</body>\n\n</html>\n"
My issue is that the URL is not the one that I want, but the initial one where the user must log in.
If I try to load again the same URL using the same method, this time the page is loaded and shown.
My question is, why the first time the URL is not loaded, as if the user were not logged in?
Many thanks in advance!
Hi!
self.url is an absolute URL? It should be a relative URL if you want to use that method. do you have the screenlet delegate set? are you receiving any error on it?
Regards
Powered by Liferay™