How to add custom logging to TrackJS - trackjs

I have a page redirect happening on a certain page that I need to watch for in an angular 5 app. I need to get the url while it is happening. How / Where can I add such things in TrackJs. Which API should I be using

You'll either need to instrument the destination page and log the referrer so that you know the source, or add a hook before navigation occurs and check the destination.
For a hook, you'll need to know how the navigation happens: either a click, form post, or window.open. For each of these, you can add an eventListener to look for the event and log.
You'll utilize the standard TrackJS API to track() a custom error when the right event occurs.

Related

Orchard Dynamic Forms Workflow not invoked

I made a simple workflow in Orchard 1.9.1 to notify when a dynamic forms is submitted.
I didn't set any prpoperty/data on the Start Activity so that it can capture all Dynamic Forms submission. However there seems an issue and the workflow is NOT being invoked.
I followed steps from here: http://docs.orchardproject.net/Documentation/Workflows
But this notify activity or may be even the start activity doesn't seem to be invoked/working . What More settings are required to get this workflow in action ?
Also, I have set the redirect URL in "Forms" element properties but the form isn't redirecting. What can be the issue here as well ?
I have not seen this problem with a workflow before. I assume there's nothing in the logs?
My first guess would be that it's your form that is not submitting properly, try to remove that redirect, also make sure there's isn't some validation error blocking it, if you placed recaptcha element remove it and try again.
Second guess which is not very likely is that you have somehow managed to hide notification zone, either with CSS or in layout view #Zone(Model.Messages)

Liferay - Intermediate page after login and landing

I am looking to have two factor authentication. That is after login, i want to show an intermediate page. Only after some action has been done on the second page, user is taken to the landing page.
I have logic for second factor authentication ready. Its basically a jsp with some action.
However I am not sure what is the right approach to insert this intermediate page.
I have seen terms of use page, wherein the flag is maintained in db and the code is there in actual implementation class. I dont want to use extension plugin to do this. So I ruled out that option.
Second way is to have a Service Pre Action hook and do the necessary check here. But when I place the code in here, it goes to infinite loop.
Any other way I can do this? Hook is my preference.
Second way is to have a Service Pre Action hook and do the necessary
check here. But when I place the code in here, it goes to infinite
loop.
Not sure why this would happen, may be you would need to add a check or a flag which would execute your code only if the second tier authentication fails else it should just normally run the ServicePreAction code.
Another way I can think of is to use a custom struts-action to show your JSP and do the desired action in the custom action class.
Hope this helps.
I have not checked how to achieve that, but my guess is that extending the login portlet in a hook is the best way.
you can store the redirection url, redirect to the intermediate page and then load the stored url.
Regards.

Hit event on before every action in liferay means pre action event

I need to call the one method before action method calls in portlet controller.
So here I am using a hook like:
Create Hook
Create a class and extend Action.
Override run method write my own logic.
Create portal.properties file and added following line
servlet.service.events.pre=com.liferay.sample.hook.LoginAction
Pointing it fron liferay-hook.xml
Every thing was went fine but here the problem with this one is the created hook is executed each and every time page load but I want execute this hook is only when I click on the Action buttons(Action urls) in any portlet.
Can any help me out on it?
Thanks in Advance.
Naresh Kallamadi
The property you are using relates to service actions, which are invoked before or after every Action. From my experience service actions happens every time a page loads. This would explain the behavior you are seeing.
For more in-depth understanding, the article Overriding Events and working with preactions and postactions in EXT will help.
I think you may want to dig more into the portlet actions and phases to achieve what you may need. Please post back if you have more details (code example of what you have tried etc.) on the exact behavior in the portlet you need help with.
Hope this helps.

Using the browser client, how can I set the sounds.disconnect() on every call?

Using the browser client, how can I set the sounds.disconnect() on every call? Is there a way to access the device singleton to modify that setting? I know I can access when I get the device.ready callback, but I want to modify the setting on every call.
I received a helpful reply back from Twilio support:
--
That parameter will be instantiated in Twilio.Device either True or False once the web page loads, so to change it, I believe you would necessarily need to also reload the page.
This would create another control layer in effect, that isn't provided out of the box by Twilio: you'd need to build a web page to change the variable that determines sounds.outgoing(), and then trigger the page to reload.
Another option would be simply create a second Client instance running on a separate tab, and have both instances use the same outbound caller ID. That might be easier.
--
In my scenario I'll need to find a different approach, and will look in to disabling the Twilio sounds and using my own.

Google Chrome extension modifying page request

Is it possible to catch the request of a page before it is sent out? I would like to check and modify the data sent out. For example if I have a text box on a page and the form was submitted I would like to get to the data of the text box using the extension modify it and then send it on it's way.
If any one can point me in the right direction that would be grate
Chrome has chrome.experimental.webRequest API module which allows to catch web requests before they are sent, but from the docs it doesn't look like you can modify them, just observe.
I think you would be better off injecting a content script to pages and listening to onbeforesubmit event on forms.

Resources