Last active
May 10, 2021 23:25
-
-
Save JamoCA/6f46af76a3f8b9975ccc0623602a92f1 to your computer and use it in GitHub Desktop.
ColdFusion UDF to remove optional "dots" and "plus addressing" from Gmail addresses to normalize the username. (Created due to comment spam from randomized gmail usernames.)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<cfscript> | |
string function sanitizeGmail(required string email) output=false hint="I strip dot notation and plus extras from a gmail address" { | |
if (listLast(trim(arguments.email),"@") is "gmail.com"){ | |
local.username = ListFirst(trim(arguments.email), "@"); | |
local.username = replace(listFirst(local.username, "+"), ".", "", "all"); | |
arguments.email = local.username & "@gmail.com"; | |
} | |
return arguments.email; | |
} | |
</cfscript> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment