Subversion Repositories SmartDukaan

Rev

Rev 3090 | Rev 3269 | Go to most recent revision | Blame | Compare with Previous | Last modification | View Log | RSS feed

/**
 * 
 */
package in.shop2020.serving.controllers;

import org.apache.shiro.SecurityUtils;
import org.apache.shiro.crypto.hash.Sha256Hash;
import org.apache.struts2.convention.annotation.Result;
import org.apache.thrift.TException;

/**
 * @author mandeep
 * This class manages all the login related updates for a user.
 */
@Result(name="loginPage", location="/login.html")
public class LoginController extends BaseController {

    /**
     * 
     */
    private static final long serialVersionUID = 1L;

    private String password; 

    public String updatePassword() throws TException
    {
        createServiceClients();
        crmServiceClient.updatePasswordForAgent(currentAgentEmailId, new Sha256Hash(password).toHex());
        addActionMessage("Password changed successfully!");
        return INPUT;
    }

    public String logout()
    {
        log.info("Logging out!");
        SecurityUtils.getSubject().logout();
        return "loginPage";
    }

    public String getPassword() {
        return password;
    }

    public void setPassword(String password) {
        this.password = password;
    }
}