Subversion Repositories SmartDukaan

Rev

Rev 832 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 832 Rev 924
Line 9... Line 9...
9
import in.shop2020.thrift.clients.UserContextServiceClient;
9
import in.shop2020.thrift.clients.UserContextServiceClient;
10
 
10
 
11
import java.io.IOException;
11
import java.io.IOException;
12
import java.util.Date;
12
import java.util.Date;
13
 
13
 
14
import org.apache.juli.logging.Log;
-
 
15
import org.apache.juli.logging.LogFactory;
-
 
16
import org.apache.log4j.Logger;
14
import org.apache.log4j.Logger;
17
import org.apache.struts2.convention.annotation.Result;
15
import org.apache.struts2.convention.annotation.Result;
18
 
16
 
19
/**
17
/**
20
 * 
18
 * 
21
 * @author rajveer
19
 * @author rajveer
22
 * 
20
 * 
23
 */
21
 */
24
 
22
 
25
@Result(name = "redirect", location = "${url}", type = "redirect")
23
@Result(name = "redirect", location = "${redirectUrl}", type = "redirect")
26
public class LoginController extends BaseController {
24
public class LoginController extends BaseController {
27
 
25
 
28
	/**
26
	/**
29
	 * 
27
	 * 
30
	 */
28
	 */
31
	private static final long serialVersionUID = 5390035354379263121L;
29
	private static final long serialVersionUID = 5390035354379263121L;
32
 
30
 
33
	private static Logger log = Logger.getLogger(Class.class);
31
	private static Logger log = Logger.getLogger(Class.class);
34
	private DesEncrypter desEncrypter = new DesEncrypter("saholic");
32
	private DesEncrypter desEncrypter = new DesEncrypter("saholic");
35
	
33
	
36
	private String redirectUrl;
34
	private String redirectUrl = null;
37
 
35
 
38
	public LoginController() {
36
	public LoginController() {
39
		super();
37
		super();
40
	}
38
	}
41
 
39
 
Line 44... Line 42...
44
		return "index";
42
		return "index";
45
	}
43
	}
46
 
44
 
47
	public String create() throws SecurityException, Exception {
45
	public String create() throws SecurityException, Exception {
48
		if (loginUser()) {
46
		if (loginUser()) {
49
			redirectUrl = (String) this.session.getAttribute(LoginInterceptor.REDIRECT_URL);
-
 
50
			if (redirectUrl == null) {
-
 
51
				redirectUrl = "";
-
 
52
			}
-
 
53
			log.info(redirectUrl);
47
			log.info(redirectUrl);
54
			resetRedirectUrl();
-
 
55
			return "redirect";
48
			return "redirect";
56
		} else {
49
		} else {
57
			addActionError("Either email or password is wrong.");
50
			addActionError("Either email or password is wrong.");
58
			return "login";
51
			return "login";
59
		}
52
		}
Line 103... Line 96...
103
			log.error("Wrong username or password.");
96
			log.error("Wrong username or password.");
104
			return false;
97
			return false;
105
		}
98
		}
106
	}
99
	}
107
 
100
 
108
	public String getUrl() {
101
	public String getRedirectUrl() {
109
		return this.redirectUrl;
102
		return redirectUrl;
-
 
103
	}
-
 
104
 
-
 
105
	public void setRedirectUrl(String redirectUrl) {
-
 
106
		this.redirectUrl = redirectUrl;
110
	}
107
	}
111
 
108
 
112
	public String getLoginHeaderSnippet() {
109
	public String getLoginHeaderSnippet() {
113
		return htmlSnippets.get("LOGIN_HEADER");
110
		return htmlSnippets.get("LOGIN_HEADER");
114
	}
111
	}