Skip to content

Commit 31e02f4

Browse files
committed
formtools#11 refactoring sendPassword function so it uses encryption of passwords
1 parent ff365ef commit 31e02f4

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

code/Users.class.php

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -310,9 +310,19 @@ public static function sendPassword($form_id, $info, $L)
310310
$username = $submission_info[$username_col];
311311

312312
$field_info = Fields::getFormField($submission_account["password_field_id"]);
313+
$password = General::generatePassword();
313314
$password_col = $field_info["col_name"];
314-
$password = $submission_info[$password_col];
315+
$encrypted_password = General::encode($password);
315316

317+
// update the database with encrypted password
318+
$db->query("
319+
UPDATE {PREFIX}form_{$form_id}
320+
SET $password_col = :encrypted_password
321+
WHERE submission_id = :submission_id
322+
");
323+
$db->bind("encrypted_password", $encrypted_password);
324+
$db->bind("submission_id", $submission_info["submission_id"]);
325+
$db->execute();
316326

317327
// 1. build the email content
318328
$placeholders = array(

0 commit comments

Comments
 (0)