basic contact overview
This commit is contained in:
38
src/main/old/de/jottyfan/timetrack/modules/SessionModel.java
Normal file
38
src/main/old/de/jottyfan/timetrack/modules/SessionModel.java
Normal file
@ -0,0 +1,38 @@
|
||||
package de.jottyfan.timetrack.modules;
|
||||
|
||||
import java.sql.SQLException;
|
||||
|
||||
import javax.faces.application.FacesMessage;
|
||||
|
||||
import org.jooq.exception.DataAccessException;
|
||||
|
||||
import de.jooqfaces.JooqFacesContext;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author henkej
|
||||
*
|
||||
*/
|
||||
public class SessionModel {
|
||||
|
||||
public boolean doLogin(JooqFacesContext facesContext, SessionBean bean) {
|
||||
try {
|
||||
return new SessionGateway(facesContext).seekAndSetLogin(bean);
|
||||
} catch (DataAccessException | ClassNotFoundException | SQLException e) {
|
||||
FacesMessage msg = new FacesMessage(FacesMessage.SEVERITY_ERROR, "error on login", e.getMessage());
|
||||
facesContext.addMessage(null, msg);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public boolean doChangePassword(JooqFacesContext facesContext, String secretNew) {
|
||||
try {
|
||||
SessionBean bean = (SessionBean) facesContext.getExternalContext().getSessionMap().get("sessionBean");
|
||||
return new SessionGateway(facesContext).changePassword(bean, secretNew);
|
||||
} catch (DataAccessException | ClassNotFoundException | SQLException e) {
|
||||
FacesMessage msg = new FacesMessage(FacesMessage.SEVERITY_ERROR, "error on changing password", e.getMessage());
|
||||
facesContext.addMessage(null, msg);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user