Few fast questions as I'm unable to find such info in docs.
How to validate a single checkbox while creating user using Auth's create_user()?
Any ideas how to validate captcha?
Cheers!
if (isset($_POST['captcha_response']))
{
if (Captcha::valid($_POST['captcha_response']))
{ // you code here 'captcha_response' implies the input name of captcha
}}
I would prefer Validation using client side scripting language such as jquery and not with server side
Related
What is the recommended method of handling user authentication and token creation using Node/Graphql? I see a lot of tutorials out there that use a REST endpoint to authorize the user and generate the token.
While I'm new to the GraphQL scene, I don't see why you wouldn't use GraphQL for this.
For example, why not have a query like this which gets sent to a resolver that checks the user/pass and generates a token? :
mutation {
loginUser (
username: "YOURUSERNAME",
password:"YOURPASSWORD"
)
{
token
}
}
Is there a specific reason that the tutorials I've gone through haven't done it this way? Is there some sort of flaw in this method that I'm not aware of?
The official docs explain the reasoning a bit: https://graphql.org/graphql-js/authentication-and-express-middleware/
Reading between the lines a bit, it seems there isn't any official recommendation to not do this, but existing tools expect headers to be used and classic endpoints so this fits better.
If you start talking about OAUTH you're going to have to implement classic URLs anyways as well to complete that dance.
SDK
Homepage: https://github.com/Microsoft/BotBuilder
SDK Platform: Node.js
SDK Version: 3.14.0
Issue Description
Hi, I searched for this for a long time now but I haven't found an answer.
I was wondering if there is a way to bind some URL parameters to the User's Bot Session.
For example, if for a specific chat dialog, I set my Endpoint URL to:
http://localhost:3978/api/messages?pronuntiation=british
is there a way to get that url parameter named "pronuntiation" down in the session object like...
bot.dialog("/", function(session){
var desiredPronuntiation = session.someUrlParameters.pronuntiation;
if( desiredPronuntiation == "british"){
///blah
}
});
I think it is possible in C# SDK but I was trying to do this in NodeJS...
I already debugged the proces from the server.post('/api/messages', connector.listen()) down to the ChatConnector.verifyBotFramework() where at the end I found it calls _this.dispatch(req.body, res, next); (ChatbotConnector.js on line 149) passing only the post body but not the request object itself...
So at a first glance I think this is not possible, I just wanted to be sure that I didn't miss anything...
Thanks,
Luis
As far as I know, this isn't supported by the Bot Framework, however I don't see why you need to do it this way. This is something you want to store in the state, for example the userData. You can read more here about managing state in the Bot Framework.
If you want to pass user data to the bot, it depends on the channel. For example Facebook and Webchat allow you to pass data direct to the bot, without user input.
I need to do some server side validation with some of my forms built using the dynamic forms module. What's the best way to do this? Through workflows?
Specifically, we are getting spam in a customer form and I want to filter out those that include web address in the message field.
I ended up adding a Decision to my workflow before the Email action that let me enter C# code into the script field. Here is the code I used in the Decision script field.
var message = "#{FormSubmission.Field:message}";
if (message.ToLower().Contains("http://") || message.ToLower().Contains("https://")) {
SetOutcome("Spam");
}
else {
SetOutcome("Real");
}
If the message was real, I sent the email. If not, I just end the process.
In my app, i have the choise to do search in facebook using the next sentences:
var uri="https://graph.facebook.com/search?access_token=#KEY#&q=#QUERY#&type=post";
uri=uri.replace("#QUERY#", busqueda);
uri=uri.replace("#KEY#", apiKey);
But now in the new api,
var uri="https://graph.facebook.com/search?access_token=#KEY#&q=#QUERY#&type=post"; is deprecated. I will like to know is it possible to do something similar to this.
I have tried to use app id and app secret but it dosent works, i want to avoid to chance code. Exist any option to do the similar without using the next function?
FB.init({
appId : '{your-app-id}',
status : true,
xfbml : true,
version : 'v2.3' // or v2.0, v2.1, v2.0
});
Not sure how you want to use the FB JS SDK with Node.js, but coming to your main question:
No, it's no longer possible to search for public posts:
Public Post search is no longer available. (/search?type=post&q=foobar)
And no, there's no workaround for this.
See
https://developers.facebook.com/docs/apps/changelog#v2_0_graph_api
In my node.js express app I'm submitting a form, to an action on a controller.
All this controller does is:
send(req.body)
(I'm using RailwayJS (but that's not all that important to this question I don't think)
I'm doing this is to get the values in the form
However, it comes back as 'Forbidden'
If I restart node, and refresh the page (confirming i want to post back) then I get the desired result...
Any idea how to get the values of the form without restarting?
I think this is related to 'protect from forgery' beforeFilter. Do you pass authencity_token to your post?
Possible solution: skipBeforeFiler('protect from forgery'); -- it disables CSRF protection
Better solution: use form_for helper, or pass authencity_token manually. Check apidocs to learn more about CSRF protection: http://jsdoc.info/1602/express-on-railway/helpers.html#instance/csrf_tag