hash should survive login
authorSteve Hackbarth <stephenhackbarth@gmail.com>
Wed, 13 Aug 2014 17:27:43 +0000 (13:27 -0400)
committerSteve Hackbarth <stephenhackbarth@gmail.com>
Wed, 13 Aug 2014 17:27:43 +0000 (13:27 -0400)
node-datasource/routes/auth.js
node-datasource/views/login.ejs

index 1f242e8..28e5504 100644 (file)
@@ -19,9 +19,12 @@ regexp:true, undef:true, strict:true, trailing:true, white:true */
     //passport.authenticate('local', { successReturnToOrRedirect: '/login/scope', failureRedirect: '/', failureFlash: 'Invalid username or password.' }),
     passport.authenticate('local', { failureRedirect: '/?login=fail' }),
     function (req, res, next) {
-
+      var pathName = "/app";
       if (req && req.session && !req.session.oauth2 && req.session.passport && req.session.passport.user && req.session.passport.user.organization) {
-        res.redirect("/" + req.session.passport.user.organization + '/app');
+        if (req.body.hash && req.body.hash.charAt(0) === "#") {
+          pathName = pathName + req.body.hash;
+        }
+        res.redirect("/" + req.session.passport.user.organization + pathName);
         //next();
       } else {
         exports.scopeForm(req, res, next);
index bdcd2e3..4289283 100644 (file)
@@ -22,6 +22,7 @@
     <section id="main">
       <div style="transform: translateZ(0px); opacity: 1;" id="form-fields">
         <form name="loginForm" action="/login" method="post">
+          <input type="hidden" id="hash" name="hash">
           <div class="login-label" id="form-fields_idLabel">Username</div>
           <input class="login-input" id="form-fields_id" name="id" placeholder="Username">
           <div class="login-label" id="form-fields_passwordLabel">Password</div>
     <% } %>
   </section>
 
-  <!-- <div class="footer">
-    <div class="footer-container">
-      <p>
-        Visit the <a href='http://www.xtuple.org/docs/mobile-web-demo-guide'>Mobile Web Demo Guide</a>,
-        or send email to <a href='mailto:demo@xtuple.com'>demo@xtuple.com</a> for help.
-      </p>
-
-      <p>
-        This MOBILE WEB CLIENT provides access the CRM, Project and Sales modules of xTuple.
-        You must use the DESKTOP CLIENT to access the full application, including CRM, Projects, Sales, Purchasing, Inventory, Manufacturing, Scheduling and Accounting modules.
-      </p>
-
-      <p>
-        Download the xTuple Desktop client here: <a href=''>Windows</a>,
-        <a href=''>Mac</a>, <a href=''>Linux</a>
-      </p>
-
-      <p>v1.4.5</p>
-    </div>
-  </div> -->
-
   <script>
     document.loginForm.id.focus();
+    document.loginForm.hash.value = window.location.hash;
   </script>
   </body>
 </html>