How can I see my decrypted password in the formBuilder field (Symfony 4)?












0















I have a form, that I created via Symfony formBuilder



Like this I see the encrypted password in my field:



$formBuilder->add('password', TextType::class, array('attr' => array('class' => 'form-control')));


But actually I need to use a plainPassword field (to encode the password later):



$formBuilder->add('plainPassword', TextType::class, array('attr' => array('class' => 'form-control')));


But this field is empty. I would like to see the decrypted password from the database. How can I realize this?










share|improve this question



























    0















    I have a form, that I created via Symfony formBuilder



    Like this I see the encrypted password in my field:



    $formBuilder->add('password', TextType::class, array('attr' => array('class' => 'form-control')));


    But actually I need to use a plainPassword field (to encode the password later):



    $formBuilder->add('plainPassword', TextType::class, array('attr' => array('class' => 'form-control')));


    But this field is empty. I would like to see the decrypted password from the database. How can I realize this?










    share|improve this question

























      0












      0








      0








      I have a form, that I created via Symfony formBuilder



      Like this I see the encrypted password in my field:



      $formBuilder->add('password', TextType::class, array('attr' => array('class' => 'form-control')));


      But actually I need to use a plainPassword field (to encode the password later):



      $formBuilder->add('plainPassword', TextType::class, array('attr' => array('class' => 'form-control')));


      But this field is empty. I would like to see the decrypted password from the database. How can I realize this?










      share|improve this question














      I have a form, that I created via Symfony formBuilder



      Like this I see the encrypted password in my field:



      $formBuilder->add('password', TextType::class, array('attr' => array('class' => 'form-control')));


      But actually I need to use a plainPassword field (to encode the password later):



      $formBuilder->add('plainPassword', TextType::class, array('attr' => array('class' => 'form-control')));


      But this field is empty. I would like to see the decrypted password from the database. How can I realize this?







      symfony oop passwords encode formbuilder






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked Nov 20 '18 at 10:49









      JarlaJarla

      2,40911640




      2,40911640
























          1 Answer
          1






          active

          oldest

          votes


















          1














          Ideally your password is hashed in a way, that you can't easily retrieve the actual password from the stored string. Instead you hash the user input with the same options and compare if both hashes match. You are trying to circumvent a security mechanism by displaying the plain password.



          Preferably you would not show the user the original password. Either they know it or they should request a new password which you send them via mail or even better give them a token with which they can enter a new password without specifying the existing one.



          If for some reason you have to dismiss this advice and actually display the plain password (again, this is highly insecure) then you have to store it in a way where you can read it either alongside the hashed password or instead of hashing it. You could also use encryption instead of hashing, e.g. by using openssl_encrypt for storing the password and then the decrypt-counterpart when displaying it.






          share|improve this answer
























          • I think for me would be ok, if there would be some points to demonstrate, that there is actually a password already existing. Because an empty field indicates, that no password is set

            – Jarla
            Nov 20 '18 at 12:33











          • I mean can I show the password as dots (points). This is secure, right? It just indicates that there is a password already in the database

            – Jarla
            Nov 20 '18 at 12:37








          • 1





            Yes, looking into the password property whether it's empty (if that can even be the case) and then using something like .... as field value or placeholder if it's not, should be safe. Since the password is hashed and you don't know the original length it doesn't make sense to place the dots dynamically by reading anything from the password. As far as I can tell, that sounds like a secure way to handle this.

            – dbrumann
            Nov 20 '18 at 12:42











          Your Answer






          StackExchange.ifUsing("editor", function () {
          StackExchange.using("externalEditor", function () {
          StackExchange.using("snippets", function () {
          StackExchange.snippets.init();
          });
          });
          }, "code-snippets");

          StackExchange.ready(function() {
          var channelOptions = {
          tags: "".split(" "),
          id: "1"
          };
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function() {
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled) {
          StackExchange.using("snippets", function() {
          createEditor();
          });
          }
          else {
          createEditor();
          }
          });

          function createEditor() {
          StackExchange.prepareEditor({
          heartbeatType: 'answer',
          autoActivateHeartbeat: false,
          convertImagesToLinks: true,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: 10,
          bindNavPrevention: true,
          postfix: "",
          imageUploader: {
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          },
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          });


          }
          });














          draft saved

          draft discarded


















          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53391356%2fhow-can-i-see-my-decrypted-password-in-the-formbuilder-field-symfony-4%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown

























          1 Answer
          1






          active

          oldest

          votes








          1 Answer
          1






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes









          1














          Ideally your password is hashed in a way, that you can't easily retrieve the actual password from the stored string. Instead you hash the user input with the same options and compare if both hashes match. You are trying to circumvent a security mechanism by displaying the plain password.



          Preferably you would not show the user the original password. Either they know it or they should request a new password which you send them via mail or even better give them a token with which they can enter a new password without specifying the existing one.



          If for some reason you have to dismiss this advice and actually display the plain password (again, this is highly insecure) then you have to store it in a way where you can read it either alongside the hashed password or instead of hashing it. You could also use encryption instead of hashing, e.g. by using openssl_encrypt for storing the password and then the decrypt-counterpart when displaying it.






          share|improve this answer
























          • I think for me would be ok, if there would be some points to demonstrate, that there is actually a password already existing. Because an empty field indicates, that no password is set

            – Jarla
            Nov 20 '18 at 12:33











          • I mean can I show the password as dots (points). This is secure, right? It just indicates that there is a password already in the database

            – Jarla
            Nov 20 '18 at 12:37








          • 1





            Yes, looking into the password property whether it's empty (if that can even be the case) and then using something like .... as field value or placeholder if it's not, should be safe. Since the password is hashed and you don't know the original length it doesn't make sense to place the dots dynamically by reading anything from the password. As far as I can tell, that sounds like a secure way to handle this.

            – dbrumann
            Nov 20 '18 at 12:42
















          1














          Ideally your password is hashed in a way, that you can't easily retrieve the actual password from the stored string. Instead you hash the user input with the same options and compare if both hashes match. You are trying to circumvent a security mechanism by displaying the plain password.



          Preferably you would not show the user the original password. Either they know it or they should request a new password which you send them via mail or even better give them a token with which they can enter a new password without specifying the existing one.



          If for some reason you have to dismiss this advice and actually display the plain password (again, this is highly insecure) then you have to store it in a way where you can read it either alongside the hashed password or instead of hashing it. You could also use encryption instead of hashing, e.g. by using openssl_encrypt for storing the password and then the decrypt-counterpart when displaying it.






          share|improve this answer
























          • I think for me would be ok, if there would be some points to demonstrate, that there is actually a password already existing. Because an empty field indicates, that no password is set

            – Jarla
            Nov 20 '18 at 12:33











          • I mean can I show the password as dots (points). This is secure, right? It just indicates that there is a password already in the database

            – Jarla
            Nov 20 '18 at 12:37








          • 1





            Yes, looking into the password property whether it's empty (if that can even be the case) and then using something like .... as field value or placeholder if it's not, should be safe. Since the password is hashed and you don't know the original length it doesn't make sense to place the dots dynamically by reading anything from the password. As far as I can tell, that sounds like a secure way to handle this.

            – dbrumann
            Nov 20 '18 at 12:42














          1












          1








          1







          Ideally your password is hashed in a way, that you can't easily retrieve the actual password from the stored string. Instead you hash the user input with the same options and compare if both hashes match. You are trying to circumvent a security mechanism by displaying the plain password.



          Preferably you would not show the user the original password. Either they know it or they should request a new password which you send them via mail or even better give them a token with which they can enter a new password without specifying the existing one.



          If for some reason you have to dismiss this advice and actually display the plain password (again, this is highly insecure) then you have to store it in a way where you can read it either alongside the hashed password or instead of hashing it. You could also use encryption instead of hashing, e.g. by using openssl_encrypt for storing the password and then the decrypt-counterpart when displaying it.






          share|improve this answer













          Ideally your password is hashed in a way, that you can't easily retrieve the actual password from the stored string. Instead you hash the user input with the same options and compare if both hashes match. You are trying to circumvent a security mechanism by displaying the plain password.



          Preferably you would not show the user the original password. Either they know it or they should request a new password which you send them via mail or even better give them a token with which they can enter a new password without specifying the existing one.



          If for some reason you have to dismiss this advice and actually display the plain password (again, this is highly insecure) then you have to store it in a way where you can read it either alongside the hashed password or instead of hashing it. You could also use encryption instead of hashing, e.g. by using openssl_encrypt for storing the password and then the decrypt-counterpart when displaying it.







          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered Nov 20 '18 at 11:17









          dbrumanndbrumann

          9,88912142




          9,88912142













          • I think for me would be ok, if there would be some points to demonstrate, that there is actually a password already existing. Because an empty field indicates, that no password is set

            – Jarla
            Nov 20 '18 at 12:33











          • I mean can I show the password as dots (points). This is secure, right? It just indicates that there is a password already in the database

            – Jarla
            Nov 20 '18 at 12:37








          • 1





            Yes, looking into the password property whether it's empty (if that can even be the case) and then using something like .... as field value or placeholder if it's not, should be safe. Since the password is hashed and you don't know the original length it doesn't make sense to place the dots dynamically by reading anything from the password. As far as I can tell, that sounds like a secure way to handle this.

            – dbrumann
            Nov 20 '18 at 12:42



















          • I think for me would be ok, if there would be some points to demonstrate, that there is actually a password already existing. Because an empty field indicates, that no password is set

            – Jarla
            Nov 20 '18 at 12:33











          • I mean can I show the password as dots (points). This is secure, right? It just indicates that there is a password already in the database

            – Jarla
            Nov 20 '18 at 12:37








          • 1





            Yes, looking into the password property whether it's empty (if that can even be the case) and then using something like .... as field value or placeholder if it's not, should be safe. Since the password is hashed and you don't know the original length it doesn't make sense to place the dots dynamically by reading anything from the password. As far as I can tell, that sounds like a secure way to handle this.

            – dbrumann
            Nov 20 '18 at 12:42

















          I think for me would be ok, if there would be some points to demonstrate, that there is actually a password already existing. Because an empty field indicates, that no password is set

          – Jarla
          Nov 20 '18 at 12:33





          I think for me would be ok, if there would be some points to demonstrate, that there is actually a password already existing. Because an empty field indicates, that no password is set

          – Jarla
          Nov 20 '18 at 12:33













          I mean can I show the password as dots (points). This is secure, right? It just indicates that there is a password already in the database

          – Jarla
          Nov 20 '18 at 12:37







          I mean can I show the password as dots (points). This is secure, right? It just indicates that there is a password already in the database

          – Jarla
          Nov 20 '18 at 12:37






          1




          1





          Yes, looking into the password property whether it's empty (if that can even be the case) and then using something like .... as field value or placeholder if it's not, should be safe. Since the password is hashed and you don't know the original length it doesn't make sense to place the dots dynamically by reading anything from the password. As far as I can tell, that sounds like a secure way to handle this.

          – dbrumann
          Nov 20 '18 at 12:42





          Yes, looking into the password property whether it's empty (if that can even be the case) and then using something like .... as field value or placeholder if it's not, should be safe. Since the password is hashed and you don't know the original length it doesn't make sense to place the dots dynamically by reading anything from the password. As far as I can tell, that sounds like a secure way to handle this.

          – dbrumann
          Nov 20 '18 at 12:42




















          draft saved

          draft discarded




















































          Thanks for contributing an answer to Stack Overflow!


          • Please be sure to answer the question. Provide details and share your research!

          But avoid



          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.


          To learn more, see our tips on writing great answers.




          draft saved


          draft discarded














          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53391356%2fhow-can-i-see-my-decrypted-password-in-the-formbuilder-field-symfony-4%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown





















































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown

































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown







          Popular posts from this blog

          Guess what letter conforming each word

          Port of Spain

          Run scheduled task as local user group (not BUILTIN)