Search code examples
javascripthtmlparsingauthenticationnode-webkit

Need help to create a simple login for a node-webkit application


I am totally stumped on this project.... I am attempting to create a node-webkit application witch required a login feature. I dont need a sign up. I need just a user and pass input that i can enter in the information that is defined in a text file or something.. literally does not need any function other than login with predefined user and pass of witch has multiple logins pre-defined in a text file or json, and to parse the name of the individual into text on the application based on the information provided into the form.. I know that an odd request but thats the job and i am quite stummmmmped! Any help pointing me in the correct direction would be greatly appreciated.


Solution

  • Javascript:

    function login(){<br> var id={"name":"User Name",<br> "pw":"User Password"};<br> var user_id=prompt("User Name:")<br> if (user_id!=null){<br> var user_pw=prompt("Password:");<br> }if (user_pw!=null){<br> if(user_id == id.name && user_pw == id.pw){<br> window.open("//"); // open html website or file<br> }else{<br> alert("Error Password or Username!")}}}


    Call in Html:

    a href="#' onclick="login()"
    Good Luck with your project! =)
    Hope you find this helpful :)