5

EZ Publish CMS を使用しています。

現在起こっていること:

  1. パスワードを忘れた場合のページから、ユーザーは登録に使用したメールアドレスを入力して送信します

  2. ユーザーは、ID を確認するためにハッシュを使用するパスワード生成リンクが記載された電子メールを受け取ります。

  3. ユーザーは、新しく生成されたパスワードが記載された電子メールを受け取ります

  4. ユーザーは電子メールのリンクを使用してサイトに戻り、古いパスワード (生成されて電子メールに送信されたもの) を要求するフォームに移動し、新しいパスワードを入力します。

私がしたいこと:

  1. 「パスワードを忘れた」ページから、ユーザーは登録に使用したメールアドレスを入力して送信します

  2. ユーザーは、「新しいパスワードを入力してください」フォームへのリンクが記載された電子メールを受け取ります

  3. 「新しいパスワードの入力」フォームでは、ID がハッシュによって既に確認されているため、ユーザーは古いパスワードを入力する必要がなく、新しいパスワードを入力するだけで済みます。

オリジナルの 4 ステップのプロセスを持つ EZMBPAEX エクステンションを使用しています。「ユーザーに新しいパスワードを電子メールで送信する」手順を削除することについてのドキュメントや議論はないようですが、私のクライアントには非常に厳格な電子メール ポリシーでパスワードを送信しないポリシーがあるため、これに柔軟に対応することはできません。

この機能を編集する方法に関するドキュメントがどこにあるか知っている人はいますか?

編集する必要があるファイルは次の場所にあると思います。
/extension/ezmbpaex/modules/userpaex/forgotpassword.php

4

2 に答える 2

1

First of All create a function to generate a random string for you, let's say you need to create a random string of 32 caracters, choose any number of caracters you want

Function to generate random code which will be sent by email and added to db

 function genRandomString() {
 $length = 32;
 $characters = "0123456789abcdefghijklmnopqrstuvwxyz";
$string ="";
for ($p = 0; $p < $length; $p++) {
    $string .= $characters[mt_rand(0, (strlen($characters))-1)];
}

return $string;
}

Next, create a new table using php myAdmin, a table names forgotten_passes which contain three columns, let's say you already did that

   $key = genRandomString(); // assign random code
$assign = $db->query("INSERT INTO `YOUR_DB_NAME`.`forgotten_pass` (`email` ,`randomKey` , `time`)

    VALUES ('$email', '$key', CURRENT_TIMESTAMP );"); 

Next send an email which contain a link to your resetpassword.php page ( the page where user asked to choose a new password and confirm it, but do not forget to assign the generated key to a get variable , that's easy, just when you the link

www.yourdomain.com/pass_reset.php ( ADD ?secretkey=THE_GENERATED_HERE )

so the link sent to the email adresse of the person who need to reset the password should contain something like :

Hello username, to reset your password click on the link below or copy/past it into your browser

The link : http://www.yourdomain.com/pass_reset.php?secretKey=a12s236d5c8d4fkejus10a1s2d4c8741

When user click on the link, he will go to a page which verify his email and its corresponding random key in sql database, if it found that there are really an email and that random kay, then the user is really confirmed it's email, so this page should contain something like below :

    <?php 
   if (isset($_GET['secretKey'])) {
   $secretKey = $_GET['secretKey'];

     // Check wether it really exist in database
   $sql = 'select * from forgotten_pass WHERE email=$The_User_Email and  randomKey='$secretKey'';

       }

Now, just count the number of rows to see if there are returned data, if there are returned data than the user really connected to its inbox and clicked the link.

Just do the following :

     if mysql_num_rows($sql)>0 {         echo "Success, ";
     ?>
     // in this part type the html code which displays two inputs text, password
     // and confirm password that connect to database and update the user's password

     <form method="post" action="passupdate.php">
     <input name="password" value =""/>
     <input name"confirmedPassword" value=""/>
     <input type="submit" value="Save my new password"> 
     </form>
      <?php

      } else {

     echo "Sorry, invalid reset link";

     }
于 2012-01-05T18:24:00.350 に答える
0

プラグインを更新したとき、必要な数のステップがありました。

于 2012-01-11T21:01:29.703 に答える