• Welcome to KonaKart Community Forum. Please login or sign up.
 

konakart admin login issue

Started by sureshbabubv, April 13, 2010, 09:54:50 am

Previous topic - Next topic

sureshbabubv

Dear All,

I am developing a custom login for konakart admin, a jsp having a form with 3 fields userName and Passoword, submit button

when the user enters the details and clicks on submit button, the request will be handled by a controller class AdminLoginCheck.java as shown below



package org.test;


import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;

import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;



import com.konakartadmin.appif.KKAdminIf;


import  org.apache.struts.action.Action;
import com.konakartadmin.app.AdminCustomer;
public class AdminLoginCheck extends Action {

   
   
   
   public ActionForward execute(ActionMapping mapping, ActionForm form,
         HttpServletRequest request, HttpServletResponse response) {

      ActionForward  actionforward =null;
      try
      {
         
         
         Class engineClass = Class.forName("com.konakartadmin.bl.KKAdmin");
         KKAdminIf  eng = (KKAdminIf ) engineClass.newInstance();

            
           String sessionId = eng.login("admin@konakart.com", "kona123");
         
         // String sessionId = eng.login(request.getParameter("userName"), request.getParameter("passWord"));
         
         
           StringBuffer stringbuffer = new StringBuffer("/#kk_panel_status?id=2&sess="+sessionId);
         System.out.println("stringbuffer: "+stringbuffer);
         
         actionforward = new ActionForward(stringbuffer.toString(), true);
         
   
      } catch (Exception e) {
         return null;
      }
      
      return   actionforward ;
   }//end of execute method

}// end of the class









I am getting the sessionId value and requiest is redirected to

http://localhost:8080/konakartadmin/#kk_panel_status?id=2&sess=b464f4aa2db3cc09f54fc37483314e57


but I am getting the normal admin login panel.


Please suggest me where I am doing wrong.



Thanks & Regards,
B.V.Suresh Babu



impiastro

Maybe your problem is that you are authenticating using the admin user instead of the customer:


String sessionId = eng.login("admin@konakart.com", "kona123");
// String sessionId = eng.login(request.getParameter("userName"), request.getParameter("passWord"));


Change in this way, using customer's credentials:


// String sessionId = eng.login("admin@konakart.com", "kona123");
String sessionId = eng.login(request.getParameter("userName"), request.getParameter("passWord"));