Subversion Repositories SmartDukaan

Rev

Rev 3106 | Go to most recent revision | Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
3090 mandeep.dh 1
/**
2
 * 
3
 */
4
package in.shop2020.serving.controllers;
5
 
6
import org.apache.shiro.SecurityUtils;
7
import org.apache.shiro.crypto.hash.Sha256Hash;
8
import org.apache.struts2.convention.annotation.Result;
9
import org.apache.thrift.TException;
10
 
11
/**
12
 * @author mandeep
13
 * This class manages all the login related updates for a user.
14
 */
15
@Result(name="loginPage", location="/login.html")
16
public class LoginController extends BaseController {
17
 
18
    /**
19
     * 
20
     */
21
    private static final long serialVersionUID = 1L;
22
 
23
    private String password; 
24
 
25
    public String getPassword() {
26
        return password;
27
    }
28
 
29
    public void setPassword(String password) {
30
        this.password = password;
31
    }
32
 
33
    public String updatePassword() throws TException
34
    {
35
        createServiceClients();
36
        crmServiceClient.updatePasswordForAgent(currentAgentEmailId, new Sha256Hash(password).toHex());
37
        addActionMessage("Password changed successfully!");
38
        return INPUT;
39
    }
40
 
41
    public String logout()
42
    {
43
        log.info("Logging out!");
44
        SecurityUtils.getSubject().logout();
45
        return "loginPage";
46
    }
47
}