2016-04-11 12 views
1

私は認証プロセスを強化するためにPrimefaces captchaを使用しています。私は公開鍵と秘密鍵の生成を含むすべてのステップを実行しますが、仕事。Primefaces:Captcha idは表示されませんが、検証メッセージが表示されます

captchaが表示されないのは、ですが、確認メッセージを同時に表示することで認証が妨げられているという問題があります。 - 編集 - 私は春のセキュリティによって実装HTTPSを使用してい

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> 
<html xmlns="http://www.w3.org/1999/xhtml" 
    lang="#{languageSwitcher.locale}" 
    xmlns:ui="http://java.sun.com/jsf/facelets" 
    xmlns:c="http://java.sun.com/jsp/jstl/core" 
    xmlns:f="http://java.sun.com/jsf/core" 
    xmlns:h="http://java.sun.com/jsf/html" 
    xmlns:p="http://primefaces.org/ui"> 

<ui:define name="title"> 
    <h:outputText value="Please Sign In" /> 
</ui:define> 
<ui:define name="header"> 
    <h:outputText value="Please Sign In" /> 
</ui:define> 

<h:head> 
    <title>Connexion</title> 

    <!--  <meta charset="utf-8" /> --> 
    <link rel="shortcut icon" type="image/x-icon" 
     href="${request.contextPath}/resources/images/icons/dataprotect.ico" /> 
    <meta http-equiv="X-UA-Compatible" content="IE=edge" /> 
    <meta name="viewport" content="width=device-width, initial-scale=1.0" /> 
    <meta http-equiv="cache-control" content="no-cache" /> 
    <meta http-equiv="expires" content="Thu, 19 Nov 1900 08:52:00 GMT" /> 
    <!--Loading bootstrap css--> 

    <link type="text/css" rel="stylesheet" 
     href="${request.contextPath}/resources/css/file3.css" /> 

    <link type="text/css" rel="stylesheet" 
     href="${request.contextPath}/resources/css/file1.css" /> 
    <link type="text/css" rel="stylesheet" 
     href="${request.contextPath}/resources/vendors/jquery-ui-1.10.4.custom/css/ui-lightness/jquery-ui-1.10.4.custom.css" /> 
    <link type="text/css" rel="stylesheet" 
     href="${request.contextPath}/resources/vendors/font-awesome/css/font-awesome.min.css" /> 
    <link type="text/css" rel="stylesheet" 
     href="${request.contextPath}/resources/vendors/bootstrap/css/bootstrap.min.css" /> 
    <!--Loading style vendors--> 
    <link type="text/css" rel="stylesheet" 
     href="${request.contextPath}/resources/vendors/animate.css/animate.css" /> 
    <link type="text/css" rel="stylesheet" 
     href="${request.contextPath}/resources/vendors/iCheck/skins/all.css" /> 
    <!--Loading style--> 
    <link type="text/css" rel="stylesheet" 
     href="${request.contextPath}/resources/css/themes/style1/pink-blue.css" 
     class="default-style" /> 
    <link type="text/css" rel="stylesheet" 
     href="${request.contextPath}/resources/css/themes/style1/pink-blue.css" 
     id="theme-change" class="style-change color-change" /> 
    <link type="text/css" rel="stylesheet" 
     href="${request.contextPath}/resources/css/style-responsive.css" /> 
    <link rel="shortcut icon" 
     href="${request.contextPath}/resources/images/favicon.ico" /> 
<!-- background:#eeeeee !important; --> 
<style> 
#signin-page{ 
background:white !important; 
} 

/* .header-content{ */ 
/* background:#eeeeee !important; */ 
/* } */ 


</style> 
</h:head> 

<body id="signin-page"> 

    <h:form style="float: right; 
    margin-bottom: 0; 
    padding-left: 0; 
    padding-right: 0; 
    border-radius: 0; 
    background: transparent; 
    padding-top: 17px; 
    margin-left: 0px;"> 
     <p:commandLink action="#{languageSwitcher.changeLanguage2('en')}" ajax="false" onclick="PF('enCours2').show();" oncomplete="PF('enCours2').hide();" > 
      <img src="${request.contextPath}/resources/images/imgs/en.png" /> 

     </p:commandLink> 
     <p:commandLink ajax="false" onclick="PF('enCours2').show();" oncomplete="PF('enCours2').hide();" action="#{languageSwitcher.changeLanguage2('fr')}"> 
      <img src="${request.contextPath}/resources/images/imgs/fr.png" /> 

     </p:commandLink> 
     <p:commandLink ajax="false" onclick="PF('enCours2').show();" oncomplete="PF('enCours2').hide();" action="#{languageSwitcher.changeLanguage2('ar')}"> 
      <img src="${request.contextPath}/resources/images/imgs/ma.png" /> 

     </p:commandLink> 


    </h:form> 
    <div class="page-form"> 

     <h:form id="loginForm"> 
      <div class="header-content"> 
       <h1> 
       <p:graphicImage style="width:45%;" 
       value="/resources/images/sensipro_dp.png" /> 
       </h1> 
      </div> 
      <p:focus /> 
      <p:messages id="messages" /> 
      <div class="body-content"> 
       <div class="form-group"> 
        <div class="input-icon right"> 
         <i class="fa fa-user"></i> 
         <h:inputText id="email" value="#{user.email}" required="true" 
          label="Email" placeholder="Identifiant" name="email" 
          requiredMessage="Identifiant ou email est requis" 
          styleClass="form-control" title="Enter your Email!" > 
          <f:validator binding="#{sizeValidator}" /> 
          </h:inputText> 
         <p:message for="email" display="icon" /> 
        </div> 
       </div> 
       <div class="form-group"> 
        <div class="input-icon right"> 
         <i class="fa fa-key"></i> 
         <h:inputSecret id="pass" placeholder="Mot de passe" 
          name="password" styleClass="form-control" 
          value="#{user.password}" required="true" 
          requiredMessage="Mot de passe est requis" label="Password" 
          title="Please enter a password!" > 
          <f:validator binding="#{sizeValidator}" /> 
          </h:inputSecret> 

        </div> 
       </div> 

       <p:captcha label="Captcha" rendered="true" /> 


       <div class="form-group pull-left"> 
        <div class="checkbox-list"> 
         <label> <input type="checkbox" name="remember-me" />&nbsp; 
          Se souvenir de moi 
         </label> 
        </div> 
       </div> 
       <div class="form-group pull-right"> 
        <p:commandLink id="submitButton" styleClass="btn btn-success" ajax="false" 
         action="confirmSignIn" onsuccess="PF('enCours').hide();" onclick="PF('enCours').show();" update="messages @all">#{msg['signin']} &nbsp;<i 
          class="fa fa-sign-in"></i> 

        </p:commandLink> 
       </div> 
       <div class="clearfix"></div> 
       <div class="forget-password"> 
        <h6>Mot de passe oublié ?</h6> 

        <p> 
         Veuillez cliquer <a 
          href="${facesContext.externalContext.requestContextPath}/forgottenPwd.jsf" 
          class='btn-forgot-pwd'><b>ici</b></a> pour rénitialiser votre mot de 
         passe. 
        </p> 
       </div> 
       <hr /> 
      </div> 

     </h:form> 
    </div> 

    <p:dialog modal="true" id="guns" widgetVar="enCours" header="En cours" 
      style="position:fixed;" draggable="false" width="350px" 
      height="120px" closable="false"> 
      <center> 
      <p:outputPanel id="mark"> 
     <h:outputLabel value="Authentification en cours..."> </h:outputLabel> 
      </p:outputPanel> 
    <p:graphicImage 
       value="/resources/vendors/pageloader/images/loader100.gif" /> 
       </center> 
     </p:dialog> 

     <p:dialog modal="true" id="guns2" widgetVar="enCours2" header="En cours" 
      style="position:fixed;" draggable="false" width="350px" 
      height="120px" closable="false"> 
      <center> 
      <p:outputPanel id="mark2"> 
     <h:outputLabel value="Changement du langue en cours..."> </h:outputLabel> 
      </p:outputPanel> 
    <p:graphicImage 
       value="/resources/vendors/pageloader/images/loader100.gif" /> 
       </center> 
     </p:dialog> 

</body> 

</html> 

:ここenter image description here

はコードです。

誰かがこの問題を理解している場合は、躊躇しないで感謝してください。

+0

web.xmlで公開鍵と非公開鍵を更新しましたか? –

+0

はい、私はちょうど今テーマを生成しました –

答えて

0

あなたのcaptchaタグが設定されていないdivのため、表示されませんprimefacesコンポーネントは、formタグ内のdivまたはpanelgridに設定する必要があります。 必要に応じてdivタグを使用し、div位置を設定する必要があります。 または テーマを使用しても、テーマは使用されておらず、secure = "true"となります。私のために働いて、私はそれがあなた

<div height="50px" width="130px"> 
    <p:captcha label="Captcha" rendered="true" secure="true" theme="white" > 
</div> 
+0

申し訳ありませんが動作しませんでした。問題はSSL保護と関連していると思いますが、ブラウザで無効にしても動作しません。 。 –

+0

問題はsslだったので、解答を投稿しました^^ –

+0

私は自分の答えを修正しました。 –

0

ソリューションは =安全な「真」キャプチャタグに追加しているために働くことを願っています。

<div height="50px" width="130px"> 
     <p:captcha label="Captcha" rendered="true" secure="true" theme="white"/> 
    </div> 
関連する問題