Rev 1051 | Go to most recent revision | Blame | Compare with Previous | Last modification | View Log | RSS feed
/****/package in.shop2020.creation.controllers;import in.shop2020.content.security.UserManager;import java.io.IOException;import java.util.Map;import org.apache.struts2.convention.annotation.Result;/**** @author rajveer**/@Result(name="success", type="redirectAction", params = {"actionName" , "entity"})public class LoginController extends BaseController {/****/private static final long serialVersionUID = 5390035354379263121L;public String index() throws SecurityException, IOException {return "index";}public String create() throws SecurityException, Exception {if (loginUser()) {return "success";} else {addActionError("Wrong username or password.");return "index";}}private boolean loginUser() {try{String username = this.reqparams.get("username")[0];String password = this.reqparams.get("password")[0];if(UserManager.getUserManager().authenticateUser(username, password)){setUserAsLogin(username);return true;}}catch(Exception exp){}return false;}}