Commit c925dbda authored by michael.simon's avatar michael.simon
Browse files

also add no active check for token with 2fa services

parent c5441458
......@@ -52,6 +52,7 @@ import edu.kit.scc.webreg.service.reg.AttributeSourceQueryService;
import edu.kit.scc.webreg.service.reg.RegisterUserService;
import edu.kit.scc.webreg.service.twofa.TwoFaException;
import edu.kit.scc.webreg.service.twofa.TwoFaService;
import edu.kit.scc.webreg.service.twofa.linotp.LinotpToken;
import edu.kit.scc.webreg.service.twofa.linotp.LinotpTokenResultList;
import edu.kit.scc.webreg.session.SessionManager;
import edu.kit.scc.webreg.util.FacesMessageGenerator;
......@@ -232,6 +233,23 @@ public class RegisterServiceBean implements Serializable {
messageGenerator.addResolvedMessage("reqs", FacesMessage.SEVERITY_ERROR, "error",
"twofa_mandatory", true, rendererContext);
}
else {
Boolean noActive = true;
for (LinotpToken lt : tokenList) {
if (lt.getIsactive()) {
noActive = false;
break;
}
}
if (noActive) {
accessAllowed = false;
Map<String, Object> rendererContext = new HashMap<String, Object>();
rendererContext.put("service", service);
messageGenerator.addResolvedMessage("reqs", FacesMessage.SEVERITY_ERROR, "error",
"twofa_mandatory", true, rendererContext);
}
}
} catch (TwoFaException e) {
logger.warn("There is a problem communicating with twofa server" + e.getMessage());
errorState = true;
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment