AngularJS Email Validation Fails - angularjs

You can test from the original address: https://docs.angularjs.org/api/ng/input/input%5Bemail%5D
It fails when you remove the dot. How can I add that to requirements?

The perceived problem lies in the fact that an email without a dot is perfectly legal. bob#localhost is a valid email address. Until the RFC spec changes to require the dot, your choices are to apply extra validation client side via regex or handle this server side. See this post for a much lengthier explanation.
Using a regular expression to validate an email address

Related

Which fields are required for auth0.webAuth.authorize()?

I'm using react-native-auth0 version 1.6.0, and have been following the guide on the Github page here. In the "Web Authentication" -> "Log In" sections, it recommends passing only scope and audience to the auth0.webAuth.authorize() method. However, I also saw this documentation where in the "Database/AD/LDAP" section they say that response_type, client_id, and redirect_uri are all required.
What I Want To Know:
What is the difference between the protocols followed for auth0.webAuth.authorize() in the first and second guides? Which should I follow?
Some of the params are assumed because of the library or already input when you initialize. For instance, response type is assumed to be code, and you will have already input your client ID when initializing WebAuth.
https://auth0.com/docs/api/authentication#authorization-code-flow-with-pkce

Parsley.js Validation Requirement

Good afternoon all! I am looking for some guidance to see if this type of validation is possible. I work for a college and am using a form that pushes to our CRM when complete. I am looking for parsley to only validate the email address field IF they enter their college email address. Is this possible? I am trying to weave out personal email accounts and keep everything uniform with the same email address.
Thanks in advance!
You can do that e.g. by using data-parsley-pattern and defining a pattern that matches only the required mail addresses. The pattern to validate against the mail addresses you mentioned in your comment might look like this:
.*#(mail\.)?walshcollege.edu$
This matches everything that:
Starts with any number (*) of arbitrary characters (.)
Followed by an #
Might be followed by "mail.". The dot is escaped to avoid the special meaning "any character", the question mark means "might be there or not" and the parentheses make the question apply to the complete string.
Ends with walscollege.edu (the $ means the end of the string)
If you also want to make sure that an mail address is inserted you need to add data-parsley-required as Parsley by default does not validate empty fields.
Also keep in mind that Parsley validation is only client side, so you should add validations in the server to really make sure that no wrong mail address is used.

google oauth and variables for ClientId and Secret

I am surprised that when I submit a variable with an identical string value it is rejected when the string is accepted in google oauth
For example
$client->setClientSecret('xDDDDDDD-Tcdfgtrrfftr');
is accepted where with the same string value stored in the variable as follows
$client->setClientSecret('{$domain->GooglePlusSecret}');
is rejected.
Anyway to write this to get around it? I serve multiple domains through the same root folder and software and want to set up for individual oauths as well ???
I'm assuming you're using PHP here, since that's what your code looks like.
Single quoted strings do not have variables interpreted. The reason your OAuth token doesn't work is because you are using the literal string {$domain->GooglePlusSecret}.
You should change your code to either $client->setClientSecret($domain->GooglePlusSecret); or $client->setClientSecret("{$domain->GooglePlusSecret}");.

mail clients stripping part of angular url

I am sending a signup activation email containing a signup confirmation url with a confirmation token that points to an angular front end app:
...
Activate
...
Note that the token is a JWT and is fairly long.
This works find for most users, but for some clicking on the link takes them to https://domain/com only without the confirm-signup?token=...
It seems as though the mail client may be stripping off everything after the #, but I can't find any evidence of others having this problem, nor can I reproduce it.
My best guess so far is that some mail clients are seeing the # and somehow treating the trailing part as an internal anchor and stripping it...?
Has anyone else encountered this sort of problem? If so, have you found any solution short of replacing the whole mechanism with something else?
Some clients treat the hash-link just fine. Others don't. There's a conversation about Outlook being dirty about this here: Outlook strips URL hash from email
What we did to resolve this at our company is simply create a handler on our server that redirects. Your email link would become http://domain.com/email-link?url=https%3A%2F%2Fdomain.com%2F%23%2Fconfirm-signup%3Ftoken%3D1234 and your server side script would grab the query param url and immediately trigger a redirect.
You'd need to make sure that you find all links in your emails and replace them. Here's a PHP function for that, but you could do this in whatever backend language you're using. Regex here may be helpful at least.
function replaceLinks($html,$hash) {
return preg_replace_callback('/<a [^>]*href=[\"\']{1}(.+?)[\"\\\']{1}/', function($matches) use ($hash) {
return str_replace($matches[1],"http://domain.com/email-link?url=".rawurlencode($matches[1]),$matches[0]);
}, $html);
}
Yes I have encountered this issue before because of the #, I was trying to link to a anchor on a landingpage.. My solution ended up using a short.url service to "hide" the # from the html e.g. https://goo.gl/
Looks like you need percent encoding!
A lot of times when your href gets parsed (by angular in this case) it doesn't handle the special characters right, or strips them. Find your problem characters and replace them with %3F for ?, %26 for &, and %23 for #. The rest are in a chart in the link.
Once the encoded address hits the browser the url will be decoded in your url bar.

A Confusion about Raw query parameter

I am writing a simple migration tool in which I have to migrate gmail mailboxes to some other email provider. I am confused about raw string returned from gmail api.
In Google document, it says:
"raw": Returns the entire email message content in the raw field as a URL-safe base64 encoded string and the payload field is not used. This includes the identifiers, labels, metadata, MIME structure, and small body parts (typically less than 2KB).
So this means "raw" returns only small body parts less than 2kb and if the body parts are more than 2KB, there will be a problem. I have checked with some dummy emails containing email body(including inline attachments) more than 2KB, and it still works. It still returns the complete body without any problem. Sorry,if I missed something, please clear my confusion. If "raw" is working fine for all email body sizes , I will be using this approach in my project instead of "full" query parameter.
best regards,
messages.get(format=RAW) returns the entire email always. That document: https://developers.google.com/gmail/api/v1/reference/users/messages/get is incorrect and needs to be fixed.

Resources