how to do email verification?

0 votes

Hello Shephertz,

I have been trying to wrap my head around email verification, since my knowledge in HTML and server scripting limited, I am looking for a little help. By searching the forum, I found the following statement :

"You can share the verify link using our Email Service. In which, you can specify an event that when user open that link, you trigger an event where a json should be inserted in the App42 data base with emailVerified is true along with user info.

So that, you can easily validate at the time of login that if emailVerified is true in App42 data base,  allow user to login into app else redirect into verified process." 

However I am having a lot of trouble understanding this. So apparently I have to send an Email with the Email service, containing the vericfication link. First question is, What is this link pointing to? Is it pointing to the html file ? and if yes where should I upload this html file?

asked Aug 13, 2015 in App42 Cloud API-BaaS by armin65 (39 points)
Is something like this what I need ?

<!DOCTYPE html>
    <meta content="text/html; charset=utf-8" http-equiv="content-type">
    <title>Verify Email Address</title>
    <script type="text/javascript" src=""></script>
    <script type="text/javascript" src="../App42-all-2.6.min.js"></script>
    <script type="text/javascript" src="../jqueryAlert.js"></script>
    function insertJSONDocument()
        var storage = new App42Storage();
        var dbName = "TEST";  
        var collectionName = "subscriptions";
        var json = "{\"VERIFIED\":\"TRUE\"}";
        var result;
        storage.insertJSONDocument(dbName, collectionName, json,
                          var storageObj = JSON.parse(object)
                          $('#success').html("Insert JSON Document");
                          jAlert('Document has been successfully Inserted',"Insert JSON Document");
              error:  function(error)
    function verifyFunction()
  <body onload="verifyFunction()">
      Your account is verified.

1 Answer

0 votes
You can create a HTML5 file and upload it at server using File Upload Service. You can also upload it from AppHQ console Storage > File > Upload File option. Select HTML type while uploading it.
Your HTML file looks fine, however there should be userName along on the JSON to check for which user this has been verified. UserName will be passed from parameter to this page which you can use to save the record.
Let me know if it makes sense.
answered Aug 13, 2015 by ajay123 (899 points)
Thanks for the answer, I am still unclear how I should implement username. You mentioned  "UserName will be passed from parameter to this page" , which "parameter" are you talking about here?
Hello Admin,

At the time of sending email to user, you can append a String in Html URL which will contain the information of user like his name and email address as shown below:

String url = ""+ "?name=" +"Armin" +"&"  + "email=" +"" +"&";

Once that URL is open, you will get these value using the below code:

function getQueryStringValue (key) {  
          return unescape( RegExp("^(?:.*[&\\?]" + escape(key).replace(/[\.\+\*]/g, "\\$&") + "(?:\\=([^&]*))?)?.*$", "i"), "$1"));  
var userName = getQueryStringValue("name");
var emailId = getQueryStringValue("email");

Let me know if it helps.

Himanshu Sharma
thanks for the answer, I am currently working on this one, where can I get the javascript address of App42? I need the src so that I can put in the script part of the html document. downloading the js sdk and uploading it to my files seems like a waste.

Furthermore how can I get the url of a file (by name) that I have uploaded ?(from APIs not from AppHq)

and the final question regarding email service, is it possible to add a message to a custom template email that I have made from AppHq? It seems like if I use the custom template the parameters "sendSubject" and "sendMsg" are ignored.
Download Widgets
Welcome to ShepHertz Product line forum, where you can ask questions and receive answers from the community. You can also reach out to us on