Skip to content

Commit

Permalink
possibilité de désactiver la demande de mdp pour connexion cas
Browse files Browse the repository at this point in the history
  • Loading branch information
khergalant committed Feb 7, 2024
1 parent 804eb15 commit a93617e
Show file tree
Hide file tree
Showing 7 changed files with 32 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -332,7 +332,7 @@ private CompteMinima saveCompteMinima(CompteMinima cptMin, final Boolean createB
}
cptMin.setCampagne(campagne);
final String prefix = parametreController.getPrefixeNumDossCpt();
Integer sizeNumDossier = ConstanteUtils.GEN_SIZE;
Integer sizeNumDossier = ConstanteUtils.GEN_SIZE_NUM_DOSSIER;
if (prefix != null) {
sizeNumDossier = sizeNumDossier - prefix.length();
}
Expand All @@ -358,10 +358,15 @@ private CompteMinima saveCompteMinima(CompteMinima cptMin, final Boolean createB
try {
/* Si le compte est créé par un gestionnaire, on attribue un mot de passe temporaire */
if (createByGest) {
final String pwd = passwordHashUtils.generateRandomPassword(ConstanteUtils.GEN_SIZE, ConstanteUtils.GEN_PWD);
final String pwd = passwordHashUtils.generateRandomPassword(ConstanteUtils.GEN_SIZE_PWD, ConstanteUtils.GEN_PWD);
cptMin.setPwdCptMin(passwordHashUtils.createHash(pwd));
cptMin.setInitPwdKeyCptMin(getNewInitPwdKeyCptMin());
cptMin.setDatFinInitPwdCptMin(datValid);
}
/* Si l'etablissement ne souhaite pas demander un mdp pour individus connectés via CAS, on attribue un mot de passe temporaire */
else if (!parametreController.getIsMdpConnectCAS() && cptMin.getLoginCptMin() != null) {
final String pwd = passwordHashUtils.generateRandomPassword(ConstanteUtils.GEN_SIZE_PWD, ConstanteUtils.GEN_PWD);
cptMin.setPwdCptMin(passwordHashUtils.createHash(pwd));
} else {
cptMin.setPwdCptMin(passwordHashUtils.createHash(cptMin.getPwdCptMin()));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -750,6 +750,10 @@ private void nomenclatureParametres(final Locale locale) {
applicationContext.getMessage("parametrage.codParam.utiliseSiScolPj", null, locale),
ConstanteUtils.TYP_BOOLEAN_YES, NomenclatureUtils.TYP_PARAM_BOOLEAN, false, true));

majParametre(new Parametre(NomenclatureUtils.COD_PARAM_CANDIDAT_IS_MDP_CONNECT_CAS,
applicationContext.getMessage("parametrage.codParam.isMdpConnectCas", null, locale),
ConstanteUtils.TYP_BOOLEAN_YES, NomenclatureUtils.TYP_PARAM_BOOLEAN, false, true));

/* Paramètres OPI */
majParametre(new Parametre(NomenclatureUtils.COD_PARAM_OPI_IS_UTILISE,
applicationContext.getMessage("parametrage.codParam.utiliseOpi", null, locale),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -597,6 +597,11 @@ public Boolean getIsUtiliseSyncIne() {
return getBooleanValue(NomenclatureUtils.COD_PARAM_CANDIDAT_IS_UTILISE_SYNCHRO_INE);
}

/** @return si on demande un mot de passe à un candidat qui se connect via CAS */
public Boolean getIsMdpConnectCAS() {
return getBooleanValue(NomenclatureUtils.COD_PARAM_CANDIDAT_IS_MDP_CONNECT_CAS);
}

/** @return si l'application bloque le paramétrage CC (mails, type decision, motivation) */
public Boolean getIsParamCC() {
return getBooleanValue(NomenclatureUtils.COD_PARAM_SCOL_IS_PARAM_CC_DECISION);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -251,9 +251,11 @@ public class ConstanteUtils {
public static final String TYP_FORM_CANDIDAT = "TYP_FORM_CANDIDAT";

/* Constantes generation */
public static final String GEN_PWD = "abcdefghjkmnpqrstuvwxyzABCDEFGHJKMNPQRSTUVWXYZ23456789";
public static final String GEN_NUM_DOSS = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ";
public static final Integer GEN_SIZE = 8;
public static final Integer GEN_SIZE_NUM_DOSSIER = 8;

public static final String GEN_PWD = "abcdefghjkmnpqrstuvwxyzABCDEFGHJKMNPQRSTUVWXYZ23456789@#$%^&+=-!*";
public static final Integer GEN_SIZE_PWD = 10;
public static final String GEN_PWD_TYPE_PBKDF2 = "P";
public static final String GEN_PWD_TYPE_BCRYPT = "B";

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ public class NomenclatureUtils {

/* Version */
public static final String VERSION_NOMENCLATURE_COD = "VERSION_NOMENCLATURE";
public static final String VERSION_NOMENCLATURE_VAL = "2.4.4.0";
public static final String VERSION_NOMENCLATURE_VAL = "2.4.5.0";
public static final String VERSION_NO_VERSION_VAL = "-";
public static final String VERSION_APPLICATION_COD = "VERSION_APPLICATION";
public static final String VERSION_DB = "VERSION_DB";
Expand Down Expand Up @@ -268,6 +268,7 @@ public class NomenclatureUtils {
public static final String COD_PARAM_CANDIDAT_IS_GET_CURSUS_INTERNE = "CANDIDAT_IS_GET_CURSUS_INTERNE";
public static final String COD_PARAM_CANDIDAT_IS_UTILISE_SYNCHRO_INE = "CANDIDAT_IS_UTILISE_SYNCHRO_INE";
public static final String COD_PARAM_CANDIDAT_IS_GET_SISCOL_PJ = "CANDIDAT_IS_GET_SISCOL_PJ";
public static final String COD_PARAM_CANDIDAT_IS_MDP_CONNECT_CAS = "CANDIDAT_IS_MDP_CONNECT_CAS";

/* Paramètres Candidature */
public static final String COD_PARAM_CANDIDATURE_NB_VOEUX_MAX = "CANDIDATURE_NB_VOEUX_MAX";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
import com.vaadin.ui.themes.ValoTheme;

import fr.univlorraine.ecandidat.controllers.CandidatController;
import fr.univlorraine.ecandidat.controllers.ParametreController;
import fr.univlorraine.ecandidat.entities.ecandidat.CompteMinima;
import fr.univlorraine.ecandidat.entities.ecandidat.CompteMinima_;
import fr.univlorraine.ecandidat.vaadin.components.CustomPanel;
Expand All @@ -59,15 +60,16 @@ public class CandidatCompteMinimaWindow extends Window {
private static final String codeConfirmMailPerso = "confirmMailPersoCptMin";
private static final String codeConfirmPwd = "confirmPwdCptMin";

public static final String[] FIELDS_ORDER_GEST = { CompteMinima_.nomCptMin.getName(), CompteMinima_.prenomCptMin.getName(), CompteMinima_.mailPersoCptMin.getName(), codeConfirmMailPerso };
public static final String[] FIELDS_ORDER_CAND =
public static final String[] FIELDS_ORDER_WITHOUT_PWD = { CompteMinima_.nomCptMin.getName(), CompteMinima_.prenomCptMin.getName(), CompteMinima_.mailPersoCptMin.getName(), codeConfirmMailPerso };
public static final String[] FIELDS_ORDER_WHITH_PWD =
{ CompteMinima_.nomCptMin.getName(), CompteMinima_.prenomCptMin.getName(), CompteMinima_.mailPersoCptMin.getName(), codeConfirmMailPerso, CompteMinima_.pwdCptMin.getName(), codeConfirmPwd };
public String[] FIELDS_ORDER;

@Resource
private transient ApplicationContext applicationContext;
@Resource
private transient CandidatController candidatController;
@Resource
private transient ParametreController parametreController;

/* Composants */
private CompteMinimaWindowListener compteMinimaWindowListener;
Expand All @@ -80,11 +82,7 @@ public class CandidatCompteMinimaWindow extends Window {
* @param compteMinima la compteMinima à éditer
*/
public CandidatCompteMinimaWindow(final CompteMinima compteMinima, final Boolean createByGestionnaire) {
if (createByGestionnaire) {
FIELDS_ORDER = FIELDS_ORDER_GEST;
} else {
FIELDS_ORDER = FIELDS_ORDER_CAND;
}
final Boolean pwdAsked = (createByGestionnaire || (!parametreController.getIsMdpConnectCAS() && compteMinima.getLoginCptMin() != null)) ? false : true;

/* Style */
setModal(true);
Expand All @@ -101,7 +99,7 @@ public CandidatCompteMinimaWindow(final CompteMinima compteMinima, final Boolean

/* Titre */
setCaption(applicationContext.getMessage("compteMinima.window", null, UI.getCurrent().getLocale()));
if (!createByGestionnaire) {
if (pwdAsked) {
layout.addComponent(new Label(applicationContext.getMessage("compteMinima.create.warning", null, UI.getCurrent().getLocale())));

/* Panel d'infos mot de passe */
Expand All @@ -120,7 +118,7 @@ public CandidatCompteMinimaWindow(final CompteMinima compteMinima, final Boolean
final FormLayout formLayout = new FormLayout();
formLayout.setWidth(100, Unit.PERCENTAGE);
formLayout.setSpacing(true);
for (final String fieldName : FIELDS_ORDER) {
for (final String fieldName : (pwdAsked ? FIELDS_ORDER_WHITH_PWD : FIELDS_ORDER_WITHOUT_PWD)) {
final String caption = applicationContext.getMessage("compteMinima.table." + fieldName, null, UI.getCurrent().getLocale());
Field<?> field;
if (fieldName.equals(CompteMinima_.pwdCptMin.getName()) || fieldName.equals(codeConfirmPwd)) {
Expand Down Expand Up @@ -187,7 +185,7 @@ public CandidatCompteMinimaWindow(final CompteMinima compteMinima, final Boolean
}

/* Verif la confirmation de mdp est égale au mdp */
if (!createByGestionnaire &&
if (pwdAsked &&
StringUtils.isNotBlank(pwdField.getValue())
&& StringUtils.isNotBlank(pwdConfirmField.getValue())
&&
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -251,6 +251,7 @@ parametrage.codParam.isDematMaintenance = Si le service de d\u00E9mat\u00E9
parametrage.codParam.isDownloadMultipleAddPj = Si les pi\u00E8ces sont ajout\u00E9es dans le dossier lors d'un t\u00E9l\u00E9chargement multiple
parametrage.codParam.isExportBlocNote = Si le bloc note est disponible dans l'export de candidatures
parametrage.codParam.isGetCursusInterne = Si le cursus interne du SiScol est remont\u00E9
parametrage.codParam.isMdpConnectCas = Si un mot de passe est demand\u00E9 \u00E0 un candidat qui se connecte via CAS
parametrage.codParam.isStatutAttWhenChangeTT = Si un changement de type de traitement entra\u00EEne le passage du statut de dossier \u00E0 "En attente"
parametrage.codParam.isUtiliseRegStu = Si la saisie du r\u00E9gime et du statut est disponible aux gestionnaires
parametrage.codParam.isWarningCandSelect = Si apr\u00E8s une action dans l'\u00E9cran de candidature, si des candidatures sont s\u00E9lectionn\u00E9es, un message d'alerte tr\u00E8s visible est affich\u00E9
Expand Down

0 comments on commit a93617e

Please sign in to comment.