JavaScript Login/Register Not Validating session Storage












0














I am trying to use data retrieved from session storage to validate a newly registered user. It just needs to be in session storage for this project. Basically, the new user registers on a Signup Page; the email and password are saved in session storage; then they should be able to log in through the regular login page as long as the tab is opened. Even though the user input is set in the session storage, I am unable to validate the user in the regular login screen afterwards. I keep receiving the error "username/password do not match". What am I missing that is causing it not to validate? Any help is much appreciated.



JavaScript



// TISSUE Login Script

//Function called when form is submitted
//Validates form and allows login

function validate() {
'use strict';

var UserName = document.getElementById('UserName').value;
var email = "adrian@tissue.com";
var email1 = "admin@tissue.com";
var Password = document.getElementById('Password').value;
var pass = "welcome1";
var pass1 = "admin123";

// stored data from the register-form

var storedName = sessionStorage.getItem('email');
var storedPw = sessionStorage.getItem('password');

// entered data from the login-form

var userName = document.getElementById('UserName');
var userPw = document.getElementById('Password');


if ((UserName == email) && (Password == pass)) {
window.location.href = "Issues.html";
return false;
} else if ((UserName == email1) && (Password == pass1)) {
window.location.href = "subscription_dashboard.html";
return false;
} else if ((userName == storedName) && (password == storedPw)) {
window.location.href = "Issues.html";
return false;
} else {
alert("username and/or password do not match");
return false;
}
}

// End of Validation

function init() {
'use strict';

if (document && document.getElementById) {
var loginform = document.getElementById('loginform');
loginform.onsubmit = validate;
}
}

window.onload = init;


HTML



<!DOCTYPE html>
<html lang="en">
<head>
<title>Tissue: Titan Issue Tracking</title>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="description" content="Issue Tracking System"/>
<meta name="author" content="Stephen Morris">
<link rel="stylesheet" type="text/css" href="tissue.css">
<script type="text/javascript" src="js/login.js"></script>
</head>
<body>
<div id="wrapper">
<h2>TISSUE: Titan Issue Tracker</h2>
<div class="topnav">
<a href="index.html">Home</a>
<a href="Registration.html">SignUp</a>
</div>
<div id="loginwrap">
<h1>Login</h1>
</div>
<div id="signupForm">
<form action="Issues.html" method="post" id="loginform" onsubmit="return validate()">
<div class="labels">
<label for="UserName">UserName:</label>
</div>
<div class="rightTab">
<input type="email" name="UserName" id="UserName" class="input-field" placeholder="E-mail Address" required>
</div>
<div class="labels">
<label for="Password">Password:</label>
</div>
<div class="rightTab">
<input type="password" name="Password" id="Password" class="input-field" placeholder="Password" required>
</div>
<div id="loginwrap">
<hr>
<input class="button" type="submit" value="Submit">
</div>
</form>
</div>
</div>
<div class="copyright">
Copyright &copy; 2018 Titan Issue Tracker
</div>
</body>
</html>


New User JavaScript



// UserStore Module

// Store Username and Password in sessionStorage

function newUser () {

var userName = document.getElementById('email').value;
var password = document.getElementById('password').value;

sessionStorage.setItem("userName", userName);
sessionStorage.setItem("password", password);

}


New User Registration HTML



<!DOCTYPE html>
<html lang="en">
<head>
<title>Tissue: Titan Issue Tracking</title>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="description" content="Issue Tracking System"/>
<meta name="author" content="Stephen Morris">
<link rel="stylesheet" type="text/css" href="tissue.css">
<script type="text/javascript" src="js/test.js"></script>
</head>
<body>
<div id="wrapper">
<h2>TISSUE: Titan Issue Tracker</h2>
<div class="topnav">
<a href="index.html">Home</a>
<a href="Login.html">Login</a>
</div>
<div id="loginwrap">
<h1>Create New Account</h1>
</div>
<div id="signupForm">
<form action="Issues.html" method="post" id="loginform" onsubmit="return newUser()">
<div class="labels">
<label for="email">* E-mail:</label>
</div>
<div class="rightTab">
<input type="email" name="email" id="email" class="input-field" placeholder="Enter Your E-mail" required>
</div>
<div class="labels">
<label for="Password">* Password:</label>
</div>
<div class="rightTab">
<input type="password" name="password" id="password" class="input-field" placeholder="Create Password" required>
</div>
<div class="labels">
<label for="password">* Confirm Password:</label>
</div>
<div class="rightTab">
<input type="password" name="password" id="password1" class="input-field" placeholder="Confirm Password" required>
</div>
<div id="loginwrap">
<hr>
<input class="button" type="submit" value="Submit">
</div>
</form>
</div>
</div>
<div class="copyright">
Copyright &copy; 2018 Titan Issue Tracker
</div>
</body>
</html>









share|improve this question



























    0














    I am trying to use data retrieved from session storage to validate a newly registered user. It just needs to be in session storage for this project. Basically, the new user registers on a Signup Page; the email and password are saved in session storage; then they should be able to log in through the regular login page as long as the tab is opened. Even though the user input is set in the session storage, I am unable to validate the user in the regular login screen afterwards. I keep receiving the error "username/password do not match". What am I missing that is causing it not to validate? Any help is much appreciated.



    JavaScript



    // TISSUE Login Script

    //Function called when form is submitted
    //Validates form and allows login

    function validate() {
    'use strict';

    var UserName = document.getElementById('UserName').value;
    var email = "adrian@tissue.com";
    var email1 = "admin@tissue.com";
    var Password = document.getElementById('Password').value;
    var pass = "welcome1";
    var pass1 = "admin123";

    // stored data from the register-form

    var storedName = sessionStorage.getItem('email');
    var storedPw = sessionStorage.getItem('password');

    // entered data from the login-form

    var userName = document.getElementById('UserName');
    var userPw = document.getElementById('Password');


    if ((UserName == email) && (Password == pass)) {
    window.location.href = "Issues.html";
    return false;
    } else if ((UserName == email1) && (Password == pass1)) {
    window.location.href = "subscription_dashboard.html";
    return false;
    } else if ((userName == storedName) && (password == storedPw)) {
    window.location.href = "Issues.html";
    return false;
    } else {
    alert("username and/or password do not match");
    return false;
    }
    }

    // End of Validation

    function init() {
    'use strict';

    if (document && document.getElementById) {
    var loginform = document.getElementById('loginform');
    loginform.onsubmit = validate;
    }
    }

    window.onload = init;


    HTML



    <!DOCTYPE html>
    <html lang="en">
    <head>
    <title>Tissue: Titan Issue Tracking</title>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta name="description" content="Issue Tracking System"/>
    <meta name="author" content="Stephen Morris">
    <link rel="stylesheet" type="text/css" href="tissue.css">
    <script type="text/javascript" src="js/login.js"></script>
    </head>
    <body>
    <div id="wrapper">
    <h2>TISSUE: Titan Issue Tracker</h2>
    <div class="topnav">
    <a href="index.html">Home</a>
    <a href="Registration.html">SignUp</a>
    </div>
    <div id="loginwrap">
    <h1>Login</h1>
    </div>
    <div id="signupForm">
    <form action="Issues.html" method="post" id="loginform" onsubmit="return validate()">
    <div class="labels">
    <label for="UserName">UserName:</label>
    </div>
    <div class="rightTab">
    <input type="email" name="UserName" id="UserName" class="input-field" placeholder="E-mail Address" required>
    </div>
    <div class="labels">
    <label for="Password">Password:</label>
    </div>
    <div class="rightTab">
    <input type="password" name="Password" id="Password" class="input-field" placeholder="Password" required>
    </div>
    <div id="loginwrap">
    <hr>
    <input class="button" type="submit" value="Submit">
    </div>
    </form>
    </div>
    </div>
    <div class="copyright">
    Copyright &copy; 2018 Titan Issue Tracker
    </div>
    </body>
    </html>


    New User JavaScript



    // UserStore Module

    // Store Username and Password in sessionStorage

    function newUser () {

    var userName = document.getElementById('email').value;
    var password = document.getElementById('password').value;

    sessionStorage.setItem("userName", userName);
    sessionStorage.setItem("password", password);

    }


    New User Registration HTML



    <!DOCTYPE html>
    <html lang="en">
    <head>
    <title>Tissue: Titan Issue Tracking</title>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta name="description" content="Issue Tracking System"/>
    <meta name="author" content="Stephen Morris">
    <link rel="stylesheet" type="text/css" href="tissue.css">
    <script type="text/javascript" src="js/test.js"></script>
    </head>
    <body>
    <div id="wrapper">
    <h2>TISSUE: Titan Issue Tracker</h2>
    <div class="topnav">
    <a href="index.html">Home</a>
    <a href="Login.html">Login</a>
    </div>
    <div id="loginwrap">
    <h1>Create New Account</h1>
    </div>
    <div id="signupForm">
    <form action="Issues.html" method="post" id="loginform" onsubmit="return newUser()">
    <div class="labels">
    <label for="email">* E-mail:</label>
    </div>
    <div class="rightTab">
    <input type="email" name="email" id="email" class="input-field" placeholder="Enter Your E-mail" required>
    </div>
    <div class="labels">
    <label for="Password">* Password:</label>
    </div>
    <div class="rightTab">
    <input type="password" name="password" id="password" class="input-field" placeholder="Create Password" required>
    </div>
    <div class="labels">
    <label for="password">* Confirm Password:</label>
    </div>
    <div class="rightTab">
    <input type="password" name="password" id="password1" class="input-field" placeholder="Confirm Password" required>
    </div>
    <div id="loginwrap">
    <hr>
    <input class="button" type="submit" value="Submit">
    </div>
    </form>
    </div>
    </div>
    <div class="copyright">
    Copyright &copy; 2018 Titan Issue Tracker
    </div>
    </body>
    </html>









    share|improve this question

























      0












      0








      0







      I am trying to use data retrieved from session storage to validate a newly registered user. It just needs to be in session storage for this project. Basically, the new user registers on a Signup Page; the email and password are saved in session storage; then they should be able to log in through the regular login page as long as the tab is opened. Even though the user input is set in the session storage, I am unable to validate the user in the regular login screen afterwards. I keep receiving the error "username/password do not match". What am I missing that is causing it not to validate? Any help is much appreciated.



      JavaScript



      // TISSUE Login Script

      //Function called when form is submitted
      //Validates form and allows login

      function validate() {
      'use strict';

      var UserName = document.getElementById('UserName').value;
      var email = "adrian@tissue.com";
      var email1 = "admin@tissue.com";
      var Password = document.getElementById('Password').value;
      var pass = "welcome1";
      var pass1 = "admin123";

      // stored data from the register-form

      var storedName = sessionStorage.getItem('email');
      var storedPw = sessionStorage.getItem('password');

      // entered data from the login-form

      var userName = document.getElementById('UserName');
      var userPw = document.getElementById('Password');


      if ((UserName == email) && (Password == pass)) {
      window.location.href = "Issues.html";
      return false;
      } else if ((UserName == email1) && (Password == pass1)) {
      window.location.href = "subscription_dashboard.html";
      return false;
      } else if ((userName == storedName) && (password == storedPw)) {
      window.location.href = "Issues.html";
      return false;
      } else {
      alert("username and/or password do not match");
      return false;
      }
      }

      // End of Validation

      function init() {
      'use strict';

      if (document && document.getElementById) {
      var loginform = document.getElementById('loginform');
      loginform.onsubmit = validate;
      }
      }

      window.onload = init;


      HTML



      <!DOCTYPE html>
      <html lang="en">
      <head>
      <title>Tissue: Titan Issue Tracking</title>
      <meta charset="utf-8">
      <meta name="viewport" content="width=device-width, initial-scale=1.0">
      <meta name="description" content="Issue Tracking System"/>
      <meta name="author" content="Stephen Morris">
      <link rel="stylesheet" type="text/css" href="tissue.css">
      <script type="text/javascript" src="js/login.js"></script>
      </head>
      <body>
      <div id="wrapper">
      <h2>TISSUE: Titan Issue Tracker</h2>
      <div class="topnav">
      <a href="index.html">Home</a>
      <a href="Registration.html">SignUp</a>
      </div>
      <div id="loginwrap">
      <h1>Login</h1>
      </div>
      <div id="signupForm">
      <form action="Issues.html" method="post" id="loginform" onsubmit="return validate()">
      <div class="labels">
      <label for="UserName">UserName:</label>
      </div>
      <div class="rightTab">
      <input type="email" name="UserName" id="UserName" class="input-field" placeholder="E-mail Address" required>
      </div>
      <div class="labels">
      <label for="Password">Password:</label>
      </div>
      <div class="rightTab">
      <input type="password" name="Password" id="Password" class="input-field" placeholder="Password" required>
      </div>
      <div id="loginwrap">
      <hr>
      <input class="button" type="submit" value="Submit">
      </div>
      </form>
      </div>
      </div>
      <div class="copyright">
      Copyright &copy; 2018 Titan Issue Tracker
      </div>
      </body>
      </html>


      New User JavaScript



      // UserStore Module

      // Store Username and Password in sessionStorage

      function newUser () {

      var userName = document.getElementById('email').value;
      var password = document.getElementById('password').value;

      sessionStorage.setItem("userName", userName);
      sessionStorage.setItem("password", password);

      }


      New User Registration HTML



      <!DOCTYPE html>
      <html lang="en">
      <head>
      <title>Tissue: Titan Issue Tracking</title>
      <meta charset="utf-8">
      <meta name="viewport" content="width=device-width, initial-scale=1.0">
      <meta name="description" content="Issue Tracking System"/>
      <meta name="author" content="Stephen Morris">
      <link rel="stylesheet" type="text/css" href="tissue.css">
      <script type="text/javascript" src="js/test.js"></script>
      </head>
      <body>
      <div id="wrapper">
      <h2>TISSUE: Titan Issue Tracker</h2>
      <div class="topnav">
      <a href="index.html">Home</a>
      <a href="Login.html">Login</a>
      </div>
      <div id="loginwrap">
      <h1>Create New Account</h1>
      </div>
      <div id="signupForm">
      <form action="Issues.html" method="post" id="loginform" onsubmit="return newUser()">
      <div class="labels">
      <label for="email">* E-mail:</label>
      </div>
      <div class="rightTab">
      <input type="email" name="email" id="email" class="input-field" placeholder="Enter Your E-mail" required>
      </div>
      <div class="labels">
      <label for="Password">* Password:</label>
      </div>
      <div class="rightTab">
      <input type="password" name="password" id="password" class="input-field" placeholder="Create Password" required>
      </div>
      <div class="labels">
      <label for="password">* Confirm Password:</label>
      </div>
      <div class="rightTab">
      <input type="password" name="password" id="password1" class="input-field" placeholder="Confirm Password" required>
      </div>
      <div id="loginwrap">
      <hr>
      <input class="button" type="submit" value="Submit">
      </div>
      </form>
      </div>
      </div>
      <div class="copyright">
      Copyright &copy; 2018 Titan Issue Tracker
      </div>
      </body>
      </html>









      share|improve this question













      I am trying to use data retrieved from session storage to validate a newly registered user. It just needs to be in session storage for this project. Basically, the new user registers on a Signup Page; the email and password are saved in session storage; then they should be able to log in through the regular login page as long as the tab is opened. Even though the user input is set in the session storage, I am unable to validate the user in the regular login screen afterwards. I keep receiving the error "username/password do not match". What am I missing that is causing it not to validate? Any help is much appreciated.



      JavaScript



      // TISSUE Login Script

      //Function called when form is submitted
      //Validates form and allows login

      function validate() {
      'use strict';

      var UserName = document.getElementById('UserName').value;
      var email = "adrian@tissue.com";
      var email1 = "admin@tissue.com";
      var Password = document.getElementById('Password').value;
      var pass = "welcome1";
      var pass1 = "admin123";

      // stored data from the register-form

      var storedName = sessionStorage.getItem('email');
      var storedPw = sessionStorage.getItem('password');

      // entered data from the login-form

      var userName = document.getElementById('UserName');
      var userPw = document.getElementById('Password');


      if ((UserName == email) && (Password == pass)) {
      window.location.href = "Issues.html";
      return false;
      } else if ((UserName == email1) && (Password == pass1)) {
      window.location.href = "subscription_dashboard.html";
      return false;
      } else if ((userName == storedName) && (password == storedPw)) {
      window.location.href = "Issues.html";
      return false;
      } else {
      alert("username and/or password do not match");
      return false;
      }
      }

      // End of Validation

      function init() {
      'use strict';

      if (document && document.getElementById) {
      var loginform = document.getElementById('loginform');
      loginform.onsubmit = validate;
      }
      }

      window.onload = init;


      HTML



      <!DOCTYPE html>
      <html lang="en">
      <head>
      <title>Tissue: Titan Issue Tracking</title>
      <meta charset="utf-8">
      <meta name="viewport" content="width=device-width, initial-scale=1.0">
      <meta name="description" content="Issue Tracking System"/>
      <meta name="author" content="Stephen Morris">
      <link rel="stylesheet" type="text/css" href="tissue.css">
      <script type="text/javascript" src="js/login.js"></script>
      </head>
      <body>
      <div id="wrapper">
      <h2>TISSUE: Titan Issue Tracker</h2>
      <div class="topnav">
      <a href="index.html">Home</a>
      <a href="Registration.html">SignUp</a>
      </div>
      <div id="loginwrap">
      <h1>Login</h1>
      </div>
      <div id="signupForm">
      <form action="Issues.html" method="post" id="loginform" onsubmit="return validate()">
      <div class="labels">
      <label for="UserName">UserName:</label>
      </div>
      <div class="rightTab">
      <input type="email" name="UserName" id="UserName" class="input-field" placeholder="E-mail Address" required>
      </div>
      <div class="labels">
      <label for="Password">Password:</label>
      </div>
      <div class="rightTab">
      <input type="password" name="Password" id="Password" class="input-field" placeholder="Password" required>
      </div>
      <div id="loginwrap">
      <hr>
      <input class="button" type="submit" value="Submit">
      </div>
      </form>
      </div>
      </div>
      <div class="copyright">
      Copyright &copy; 2018 Titan Issue Tracker
      </div>
      </body>
      </html>


      New User JavaScript



      // UserStore Module

      // Store Username and Password in sessionStorage

      function newUser () {

      var userName = document.getElementById('email').value;
      var password = document.getElementById('password').value;

      sessionStorage.setItem("userName", userName);
      sessionStorage.setItem("password", password);

      }


      New User Registration HTML



      <!DOCTYPE html>
      <html lang="en">
      <head>
      <title>Tissue: Titan Issue Tracking</title>
      <meta charset="utf-8">
      <meta name="viewport" content="width=device-width, initial-scale=1.0">
      <meta name="description" content="Issue Tracking System"/>
      <meta name="author" content="Stephen Morris">
      <link rel="stylesheet" type="text/css" href="tissue.css">
      <script type="text/javascript" src="js/test.js"></script>
      </head>
      <body>
      <div id="wrapper">
      <h2>TISSUE: Titan Issue Tracker</h2>
      <div class="topnav">
      <a href="index.html">Home</a>
      <a href="Login.html">Login</a>
      </div>
      <div id="loginwrap">
      <h1>Create New Account</h1>
      </div>
      <div id="signupForm">
      <form action="Issues.html" method="post" id="loginform" onsubmit="return newUser()">
      <div class="labels">
      <label for="email">* E-mail:</label>
      </div>
      <div class="rightTab">
      <input type="email" name="email" id="email" class="input-field" placeholder="Enter Your E-mail" required>
      </div>
      <div class="labels">
      <label for="Password">* Password:</label>
      </div>
      <div class="rightTab">
      <input type="password" name="password" id="password" class="input-field" placeholder="Create Password" required>
      </div>
      <div class="labels">
      <label for="password">* Confirm Password:</label>
      </div>
      <div class="rightTab">
      <input type="password" name="password" id="password1" class="input-field" placeholder="Confirm Password" required>
      </div>
      <div id="loginwrap">
      <hr>
      <input class="button" type="submit" value="Submit">
      </div>
      </form>
      </div>
      </div>
      <div class="copyright">
      Copyright &copy; 2018 Titan Issue Tracker
      </div>
      </body>
      </html>






      javascript html






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked Nov 17 '18 at 7:03









      S Morris

      156




      156
























          1 Answer
          1






          active

          oldest

          votes


















          3














          I think the problem is you're setting storage with a name and trying to get item with another key name e.g:



          sessionStorage.setItem("userName", userName);
          var storedName = sessionStorage.getItem('email');


          it should be instead:



          sessionStorage.setItem("userName", userName);
          var storedName = sessionStorage.getItem("userName");


          or



          sessionStorage.setItem("email", userName);
          var storedName = sessionStorage.getItem("email");


          Hope it helps.






          share|improve this answer





















            Your Answer






            StackExchange.ifUsing("editor", function () {
            StackExchange.using("externalEditor", function () {
            StackExchange.using("snippets", function () {
            StackExchange.snippets.init();
            });
            });
            }, "code-snippets");

            StackExchange.ready(function() {
            var channelOptions = {
            tags: "".split(" "),
            id: "1"
            };
            initTagRenderer("".split(" "), "".split(" "), channelOptions);

            StackExchange.using("externalEditor", function() {
            // Have to fire editor after snippets, if snippets enabled
            if (StackExchange.settings.snippets.snippetsEnabled) {
            StackExchange.using("snippets", function() {
            createEditor();
            });
            }
            else {
            createEditor();
            }
            });

            function createEditor() {
            StackExchange.prepareEditor({
            heartbeatType: 'answer',
            autoActivateHeartbeat: false,
            convertImagesToLinks: true,
            noModals: true,
            showLowRepImageUploadWarning: true,
            reputationToPostImages: 10,
            bindNavPrevention: true,
            postfix: "",
            imageUploader: {
            brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
            contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
            allowUrls: true
            },
            onDemand: true,
            discardSelector: ".discard-answer"
            ,immediatelyShowMarkdownHelp:true
            });


            }
            });














            draft saved

            draft discarded


















            StackExchange.ready(
            function () {
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53349020%2fjavascript-login-register-not-validating-session-storage%23new-answer', 'question_page');
            }
            );

            Post as a guest















            Required, but never shown

























            1 Answer
            1






            active

            oldest

            votes








            1 Answer
            1






            active

            oldest

            votes









            active

            oldest

            votes






            active

            oldest

            votes









            3














            I think the problem is you're setting storage with a name and trying to get item with another key name e.g:



            sessionStorage.setItem("userName", userName);
            var storedName = sessionStorage.getItem('email');


            it should be instead:



            sessionStorage.setItem("userName", userName);
            var storedName = sessionStorage.getItem("userName");


            or



            sessionStorage.setItem("email", userName);
            var storedName = sessionStorage.getItem("email");


            Hope it helps.






            share|improve this answer


























              3














              I think the problem is you're setting storage with a name and trying to get item with another key name e.g:



              sessionStorage.setItem("userName", userName);
              var storedName = sessionStorage.getItem('email');


              it should be instead:



              sessionStorage.setItem("userName", userName);
              var storedName = sessionStorage.getItem("userName");


              or



              sessionStorage.setItem("email", userName);
              var storedName = sessionStorage.getItem("email");


              Hope it helps.






              share|improve this answer
























                3












                3








                3






                I think the problem is you're setting storage with a name and trying to get item with another key name e.g:



                sessionStorage.setItem("userName", userName);
                var storedName = sessionStorage.getItem('email');


                it should be instead:



                sessionStorage.setItem("userName", userName);
                var storedName = sessionStorage.getItem("userName");


                or



                sessionStorage.setItem("email", userName);
                var storedName = sessionStorage.getItem("email");


                Hope it helps.






                share|improve this answer












                I think the problem is you're setting storage with a name and trying to get item with another key name e.g:



                sessionStorage.setItem("userName", userName);
                var storedName = sessionStorage.getItem('email');


                it should be instead:



                sessionStorage.setItem("userName", userName);
                var storedName = sessionStorage.getItem("userName");


                or



                sessionStorage.setItem("email", userName);
                var storedName = sessionStorage.getItem("email");


                Hope it helps.







                share|improve this answer












                share|improve this answer



                share|improve this answer










                answered Nov 17 '18 at 7:15









                vitomadio

                491110




                491110






























                    draft saved

                    draft discarded




















































                    Thanks for contributing an answer to Stack Overflow!


                    • Please be sure to answer the question. Provide details and share your research!

                    But avoid



                    • Asking for help, clarification, or responding to other answers.

                    • Making statements based on opinion; back them up with references or personal experience.


                    To learn more, see our tips on writing great answers.





                    Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


                    Please pay close attention to the following guidance:


                    • Please be sure to answer the question. Provide details and share your research!

                    But avoid



                    • Asking for help, clarification, or responding to other answers.

                    • Making statements based on opinion; back them up with references or personal experience.


                    To learn more, see our tips on writing great answers.




                    draft saved


                    draft discarded














                    StackExchange.ready(
                    function () {
                    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53349020%2fjavascript-login-register-not-validating-session-storage%23new-answer', 'question_page');
                    }
                    );

                    Post as a guest















                    Required, but never shown





















































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown

































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown







                    Popular posts from this blog

                    Biblatex bibliography style without URLs when DOI exists (in Overleaf with Zotero bibliography)

                    ComboBox Display Member on multiple fields

                    Is it possible to collect Nectar points via Trainline?