Getting the user's timezone in fulfillment - dialogflow-es

I'm using Dialogflow alongside the Actions on Google and I'm looking to save content to a database with the date as they key.
Is there a way to get the user's correct timezone date? I don't want to request location permission. I've tested other actions that haven't requested the permissions and are using dates properly, so there must be a way.
Can I ask the user to specify a date as an entity? Will that provide the local time zone? It's an extra step from the user but if it would tell the correct time then I'll do it.

It is not possible to get a user's timezone without getting their location, or by explicitly asking them for their timezone.

Related

Campaign tracking on Cross-Domain without redirect (no linker)

Lets say we have the following url:
https://www.sale.com/?utm_source=CDTest3Newsletter&utm_medium=CDTest3Email&utm_campaign=CDTest3FallSale&utm_id=CDT3ID
A user clicks on the link and surf through it and then close the session.
An hour later he/she navigates to www.purchase.com and a conversion occurs, is there a way to track and relate the conversion to the utm_id=cdt3id?
In Summary the conversion happens in the second domain and we want to relate that to the first domain marketing campaign!
Please note i know hot to enable linker while redirecting from origin domain to target domain!
You have to realize that this kind of behavior is not standard. Therefore, it will require non-standard solutions.
Having said that, your real problem is not the attribution. In the described scenario, you are likely to lose the user completely. Purchase.com will have no idea that this client is supposed to have the same id as on the previous site. The linker adds an explicit _ga query param to the url for the ga library on the purchase.com to know to use that as a user id and not to generate a new one.
If you're not able to reliably pass the client id to the checkout TLD through front-end, you have to use your backend to match the user by the BE auth/session token. Same exact logic applies if you want to pass the attribution data. You just keep it on the backend, bound to the user session token and throw it to the user's cookie on checkout, then grab it with GTM and populate it however you like. Or you can as well just conduct a BE redirect, appending both the _ga and the UTM query params to the url.
There are a bit more options if you're not using GA for your actual analysis. If you're able to match users and calculate attributions on your own either through ETL or persistent derived tables/SQL. So, basically, if you download your GA data to a third party storage like snowflake, asure or BQ and then use a BI tool on top of that. But at this point those options should be pretty apparent from the issue and possible solution described above.

How to persist data in a command-line application?

I want to build a command-line application using Go or Node.js. I want to make it multiuser, so a login feature is needed. I can implement the login feature but I don't understand where should I store the user data which can be fetched any moment at runtime.
The user data is needed to check if a user is logged in or not if he is logged in which user it is.
Need help with a method to store user data to check logged in status
Edit:
I had thought of this- If the config file is present that the user is logged in else not. Then I realized that if one tampers the file, the whole point of login feature will get invalid. I am guessing there must be a better way to do it, which I am trying to know by asking here
Many cli utilities opt to store their configuration as a plain text file on the user's home directory.
You can use any of the available configuration formats such as JSON, TOML, etc.
Although it's good to mention that this is not a secure way of storing data and if users should not be able to see others information in any way this is not the preferred way.

How to generate login code with expiration in Nodejs?

I'm setting up a website using Node.js Express and MongoDB that allow user register and login and it's work nice and no issue with it. But now i want to generate multiple login code (something like a coupon code) with an expiration date so user can only use it once. and if the login code expired, user cannot login anymore. Is there a way to do that?
I was looking authentication strategy on passportjs but i cannot find any of it.
Thank you
For setting this up with mongo with a schema like { createdAt: timestamp, code: string }
Create a unique index on code so that you can't create the same code twice. In client-side code, you'll end up needing to retry creating some codes. (You could instead pre-generate codes & put them into a queue and pull them off, but that sounds a little bit more complicated)
Add a TTL index on createdAt for expiration to automatically remove the documents. If you instead want to "expire" the documents but track that the code used to exist, you'd need to manually check the timestamp.
When a code is used, you'll want to delete it (or mark it as used).
You'll likely want to include some sort of rate-limiting by ip so that people can't brute force codes.
With passport, you'll want to specify a "custom" strategy. With a custom strategy, you can do anything you'd like to set up authentication. Passport-js How to create a custom strategy has a little bit of guidance.

How to create expiration date logic for a link shared via email

I am sending a transaction ID as a link via email, using this link anyone can search for the details of transaction happened in my system. I would like to enforce expiry time for the link, say for 1 month link should work and post 1 month, link should expire.
I am using nodejs for implementing my software. I would like to send only transaction ID as the parameter for creating the link.
I planned to combine Transaction ID and expiry_timestamp and encode/encrypt and send the encoded/encrypted data as the parameter in the URL. Later when link is clicked and request is received to server, I should be able to retrieve the expiry_timestamp and compare it with current data and decide to proceed or no. Here if Iam sending timestamp in plaintext, user may change the timestamp and request, so I am planning to encode or encrypt it.
Please suggest some cryptographic techniques for implementing this.
Thanks in advance.
You can do this by following way.
Create another column name something like token
Store expiry date and time on another column as you are already doing this.
Pass token as a query string that has been stored in DB rather than the timestamp.
when user click on the link you can check either validate or not using token (query string)
You can use this( https://www.npmjs.com/package/rand-token) package to generate tokens.

CAS Jasig remember me uses old user attributes

It seems that when login with remember me feature, the user attributes (comming from AttributeRepository) are not refreshed.
The use case :
A user logs on monday. Its attributes are retrieved.
On tuesday, its attributes change (roles for examples).
On Wednesday, when it returns to the sit and authenticate via Rememberme, its old attributes values are returned by CAS server.
If the user logs out and then logs in, its attributes are normally refreshed.
How to refresh the user attributes when login via remember me ?
I'm using CAS server 3.5.2.
Currently, those attributes are not refreshed. The attributes are retrieved at TGT generation time and serialized to the database (they are stored with the principal which is attached to the ticket). The CAS4-api branch solved that issue by always delegating to the underlying attribute repository which could decide to cache the attributes for a period of time. There is some work being done to transfer some of the API-branch code into the trunk, but not all of it is. If you want to see this in there, you should open a JIRA issue with this bug. I can provide details in the ticket on why this is happening and ways it can be fixed.

Resources