Implementing login for specific users in iOS - ios

I'm creating an app and currently working on the login/sign-up. I found this tutorial (http://www.appcoda.com/login-signup-parse-swift/) but I was wondering if there were a way to accept only certain email addresses? Some pseudocode would be
//Confirm email address if it includes "#collge.KSU.edu"
//saves user info

Well you kind of just answered your question but I guess something like:
Get username from user (or email or whatever)
if(username is valid) {
move to different screen or show notification
}
else {
display pop-up instructing the user their input is not valid
}
The main part is just parsing the String and making sure it is valid which I believe switch is already equip with. So for the case of a specific email, you could try value.contains("#collge.KSU.edu"), of course you'll have to be a bit more careful with using that to make sure they put it in the right spot.

Related

Zapier: How to send data to my Node.js web app from ScheduleOnce using Zapier

Here is my workflow:
Person clicks on my ScheduleOnce link and schedules a meeting
Upon completing the ScheduleOnce booking form, the person clicks the done button
When this done button is clicked the person is redirected to a Node JS web app that displays an application page. This application page needs to be auto-populated with the information from the ScheduleOnce page.
Between step 2 and 3 is where Zapier comes in. I am trying to use Zapier to capture the data from the ScheduleOnce booking, which it is. Then I am trying to use a Zap to send that data to the page the person is redirected to, to auto-populate some of the fields.
I thought using the Code Javascript functionality would work but it does not. So then I was thinking about using the StoreClient option or the API. I am just confused on how to get the flow to work to access the data and auto-populate the fields on the next redirected page.
Some help would be greatly appreciated.
Here is the code I have for the Javascript option:
var store = StoreClient("Secret");
store
.setMany({firstName: inputData.firstName, lastName: inputData.lastName, email: inputData.email, mobilePhone: inputData.mobilePhone, otherPhone: inputData.otherPhone, businessWebsite: inputData.businessWebsite})
.then(function() {
return store.getMany('firstName', 'lastName', 'email', 'mobilePhone', 'otherPhone', 'businessWebsite');
})
.then(function() {
callback();
})
.catch(callback);
David here, from the Zapier Platform team. This is a cool use case and is probably possible. Something you need to remember is that Zapier is running totally separately from the user, so interaction will have to be indirect. Zapier can't redirect your user anywhere, it can just store data in response to a button push.
In your case you can skip everything after the setMany, since you're not trying to use the values in the zap; you just need to store them (and verify that action completed without errors).
var store = StoreClient("Secret");
store
.setMany({firstName: inputData.firstName, lastName: inputData.lastName, email: inputData.email, mobilePhone: inputData.mobilePhone, otherPhone: inputData.otherPhone, businessWebsite: inputData.businessWebsite})
.catch(callback);
You'll need to solve a couple of problems:
Speed. the user will reach your landing page before the zap completes (as it has to make a couple of HTTP round trips and execute code). You'll want to play them a 3 second loading gif, or put a waiting message and allow them to refresh the destination
Populating the page. I'm not sure what the nature of the destination is (best case scenario is that it's a server you control), but something will need to make an http request to store.zapier.com to retrieve the stored data and surface it in the view. This is easy if
Identifying the user. You'll need some way to identify the user getting redirected to the data you stored in StoreClient. If two users fill out the form in quick succession, the second one will currently overwrite the first. Plus, it seems to be semi-sensitive data that you don't just want available to anyone on your site. To that end, you'll probably want to store all of the data as a JSON string keyed by the user's email (or something else unique). That way, when I (the user) finish the form, I'm redirected to yoursite.com/landing?email=david#zapier.com, the backend knows to look for (the david#zapier.com key in store) and can render a view with the correct info.
To that end, I'd tweak the code to the following:
var store = StoreClient("Secret");
store
.set(inputData.email, JSON.stringify({firstName: inputData.firstName, lastName: inputData.lastName, email: inputData.email, mobilePhone: inputData.mobilePhone, otherPhone: inputData.otherPhone, businessWebsite: inputData.businessWebsite}))
.catch(callback);
Hope that points you in the right direction. You're working with a pretty complicated workflow, but I bet you can do it!

add confirmation entity in dialogflow (api.ai)

I need to add a confirmation entity so I get a 'Yes' or a 'Cancel' in the parameters of a certain operation in dialogflow (api.ai).
Say a user is purchasing a coffee, I'd ask details about the coffee and the quantity and finally i need a confirmation, what entity should i apply for that? any tutorial that refers to the same will also be helpful.
DialogFlow has a concept called a follow-up intent that you could use in a case like this:
You would create a "yes" follow-up to capture if the user wants to proceed, a "no" to cancel, and a "fallback" to explain to the user what is happening and what are acceptable answers.
If you are working with Actions on Google, you could also use askForConfirmation which is done completely from within your webhook code.
You can choose the most appropriate way depending on how your code is structured.
The other way would be to create a confirmation entity and prompt for it in your intent.
Create entty: Create 2 rows, one for yes and another for no, with the appropriate synonyms.
Adding it as a parameter with the entity you just created, and add the appropriate prompt.
An answer for who jump here trying to obtain this confirmation behavior with Actions on Google.
You can take a look at the documentation for Confirmation helper of Actions SDK for Node.js.
The solution is to setup an intent with the actions_intent_CONFIRMATION event in DialogFlow in order to retrieve the user response. My advice is to check how you configured your intents and use this method, otherwise be sure to create the follow-up intents with the desired context lifespan.
Example from documentation:
app.intent('Default Welcome Intent', conv => {
conv.ask(new Confirmation('Are you sure you want to do that?'))
})
// Create a Dialogflow intent with the `actions_intent_CONFIRMATION` event
app.intent('Get Confirmation', (conv, input, confirmation) => {
if (confirmation) {
conv.close(`Great! I'm glad you want to do it!`)
} else {
conv.close(`That's okay. Let's not do it now.`)
}
})
See also this question.

Parse and Swift: How use advance targeting push to specific devices without users?

I currently creating an app where the users can add a posting without logging into the app or using any credentials.
Other users of the app can open the app and directly comment on the posts(the comments are an array of the post object).
I read the parse docs and I believe that this will use advance targeting. I saw PFInstallation.currentInstallation() for advanced targeting but I believe that is based on the users class and I am not using the Parse.com users class
What I would like to do is to send a push notification to the original poster when a comment is added to their post... So, I was wondering how I would go completing that?
Thanks!
It couldn't be easier,
Installation has a "user" column. Just make a query that matches the "user" of interest. So, your code will look something like this....
if ( .. comment made, need to send a push .. )
{
console.log(">>> 'comment' was added....");
var query = new Parse.Query(Parse.Installation);
query.equalTo('user', .. whoWroteThePost .. );
alert = "Wow! You have a new comment on a post you wrote!!!";
Parse.Push.send(
{
where:query,
data:{ alert: alert, badge: "Increment" }
});
return;
}
Note that you said ...
"What I would like to do is to send a push notification to the original poster when a comment is added to their post... "
In that sentence you speak of the "original poster". So, that's going to be a variable like originalPoster. So this line of code
query.equalTo('user', .. whoWroteThePost .. );
will be
query.equalTo('user', originalPoster );
Note that this is extremely common, and you can find endless examples on the web! Here's just one: example
Note that:
Parse's term "advanced targeting" is very confusing.
To phrase the same thought another way,
Parse's 'channels' are just silly, ignore them.
That is to say, simply ignore the "channels" nonsense, and just search on users. It's easier and less confusing than the channels business, which is just an extra field you have to fill-out al the time.
It's just one of those weird things about Parse.
I've never used the "non-advanced targeting" - it's stupid and pointless. And the "advanced" targeting is trivial to use: assuming you can write cloud code at all you can do "advanced" targeting. If you can write a query in cloud code, you can do "advanced" targeting.
Essentially,
query.equalTo('user', .. whoWroteThePost .. );
Note that, of course, you may have to first look up who wrote the post, and then from there you can make the query for the Push.
Note, in this process it makes:
no difference at all if the user is anonymous.
You can and should go ahead and send pushes, in the same way.
Advanced targeting is not done against users. It's just that is the easiest way to show an example.
You need to store the installation against the objects you want to push to. So in this case store the installation against the post. Then when the comment comes in you can send a notification to the installation connected to the post it relates to.
I think you are looking something called anonymous users. There is almost impossible to send notification without user's data. But, Parse.com provides something called anonymous users so that app users are not necessary to sign up in order to fully function something user related operations.
Then, you will need to store some information in order to find the target.
Parse.com Anonymous Users

mIRC parsing for a name

So I've been getting a bothersome someone who keeps using my nickname. What I want to be able to do is perform the following command every time someone with exactly my nickname (let's say UserName) joins the channel I currently reside in:
/msg NickServ ghost UserName n0ideaHwatPassIs?
n0ideaHwatPassIs? is a sample password for our sample registered user of UserName
This sort of script would have to be able to check (in more or less real-time) if a separate user changed his/her nick to said UserName as well. If someone would be so kind as to help me with my dilemma by either pointing me to the proper documentation or working out such a script (no idea if this is as cut-and-dry as I imagined it would be at first) for me?
you can use a on notify event
but first, you have to put that nickname on notify list
type
/notify nickname
then use this script, press alt+r click on file, then new and put this script in there
on *:notify:{
if ($nick != $me) && ($nick == Nickyouwanthere) {
msg NickServ ghost UserName n0ideaHwatPassIs
}
every time someone with exactly my nickname (let's say UserName) joins the channel I currently reside in
This can't happen on IRC. (Except in exceptional circumstances like netsplits, but is immediately resolved then (by dropping one or both parties))

Set up multiple Facebook applications in one solution and fan page tap url problem

I have looked and searched for an answer for that question and I found an answer in Nathan Totten blog you can find the answer here:
https://gist.github.com/820881
The problem is I am trying to get the application settings according to the application which the user uses, which comes from the url by seeing your app name or id if you were in fan page.
It works with me within the user profile context by using:
var CurrentUrl = HttpContext.Current.Request.UrlReferrer;
and i can get the application name but within facebook fan page when using the same way it gives me a strange url :
http://static.ak.facebook.com/platform/page_proxy.php?v=4
However, it is supposed to give me:
http://www.facebook.com/pages/Mypagename/130736200342432?sk=app_myappId
Any help will be great and any new way to get which app id or tap url the user clicked will be even better.
this problem was exist within the user profile before ,and i think that you use the ifacebookapplication current method that will not give you the chance to get any thing about the context it only take you to an infinite loop ,i think that you have to send to Nathan Totten him self may be he has an answer because in the article he mentioned :
private IFacebookApplication GetCurrent()
{
var url = HttpContext.Current.Request.Url;
// Get the settings based on the url or whatever
var simpleApp = new DefaultFacebookApplication();
// Set the settings
return simpleApp;
}
may be he has a way to get the url within fan page or another way which i am sure it is not exist at least in my mind now .
Thanks ,I found an answer to my case :) now i can get my application id the way is i have to applications i try to decode the sign request with the app secret of each one if the decode result was clear then it is my target app if not then i will try the other one

Resources