From f6644a033d66ad0f80bd93afaa262c2ac51822aa Mon Sep 17 00:00:00 2001 From: Rich Lott / Artful Robot Date: Mon, 2 Oct 2023 17:07:27 +0100 Subject: [PATCH] standalone: minor fixes --- .../WorkflowMessage/PasswordReset.php | 14 ++++++------- ext/standaloneusers/ang/crmResetPassword.js | 21 ++++++++++++------- .../crmResetPassword/crmResetPassword.html | 2 +- 3 files changed, 20 insertions(+), 17 deletions(-) diff --git a/ext/standaloneusers/CRM/Standaloneusers/WorkflowMessage/PasswordReset.php b/ext/standaloneusers/CRM/Standaloneusers/WorkflowMessage/PasswordReset.php index 3968694e39..3797232262 100644 --- a/ext/standaloneusers/CRM/Standaloneusers/WorkflowMessage/PasswordReset.php +++ b/ext/standaloneusers/CRM/Standaloneusers/WorkflowMessage/PasswordReset.php @@ -58,21 +58,19 @@ class CRM_Standaloneusers_WorkflowMessage_PasswordReset extends GenericWorkflowM * Generate/regenerate a token for the user and load the tplParams */ public function setDataFromUser(array $user, string $token) { - // xxx this is not generating https://blah - just the path. Why? $resetUrlPlaintext = \CRM_Utils_System::url('civicrm/login/password', ['token' => $token], TRUE, NULL, FALSE); $resetUrlHtml = htmlspecialchars($resetUrlPlaintext); - $usernamePlaintext = $user['name']; - $usernameHtml = htmlspecialchars($user['name']); $this->logParams = [ - 'userID' => $user['id'], - 'username' => $usernamePlaintext, - 'email' => $user['uf_name'], + 'userID' => $user['id'], + 'username' => $user['username'], + 'email' => $user['uf_name'], + 'url' => $resetUrlPlaintext, ]; $this ->setResetUrlPlaintext($resetUrlPlaintext) ->setResetUrlHtml($resetUrlHtml) - ->setUsernamePlaintext($usernamePlaintext) - ->setUsernameHtml($usernameHtml) + ->setUsernamePlaintext($user['username']) + ->setUsernameHtml(htmlspecialchars($user['username'])) ->setTo($user['uf_name']); return $this; } diff --git a/ext/standaloneusers/ang/crmResetPassword.js b/ext/standaloneusers/ang/crmResetPassword.js index d86a6b1902..a32b93213f 100644 --- a/ext/standaloneusers/ang/crmResetPassword.js +++ b/ext/standaloneusers/ang/crmResetPassword.js @@ -14,16 +14,21 @@ var ts = $scope.ts = CRM.ts(null), ctrl = this; - console.log('init crmResetPassword component starting'); + // console.log('init crmResetPassword component starting'); // $onInit gets run after the this controller is called, and after the bindings have been applied. // this.$onInit = function() { console.log('user', ctrl.userId); }; - ctrl.formSubmitted = false; - ctrl.newPassword = ''; - ctrl.newPasswordAgain = ''; - ctrl.identifier = ''; - ctrl.busy = ''; - ctrl.pwnd = false; - ctrl.resetSuccessfullySubmitted = false; + + ctrl.completeReset = () => { + ctrl.busy=''; + ctrl.formSubmitted = false; + ctrl.identifier = ''; + ctrl.newPassword = ''; + ctrl.newPasswordAgain = ''; + ctrl.pwnd = false; + ctrl.resetSuccessfullySubmitted=false; + ctrl.token=''; + }; + ctrl.completeReset(); let updateAngular = (prop, newVal) => { $timeout(() => { diff --git a/ext/standaloneusers/ang/crmResetPassword/crmResetPassword.html b/ext/standaloneusers/ang/crmResetPassword/crmResetPassword.html index f81f3c3949..26793c848e 100644 --- a/ext/standaloneusers/ang/crmResetPassword/crmResetPassword.html +++ b/ext/standaloneusers/ang/crmResetPassword/crmResetPassword.html @@ -54,7 +54,7 @@

{{ts("This password reset link has expired or is otherwise invalid.")}}

-

{{ts('Send new password reset link')}}

+

{{ts('Send new password reset link')}}

-- 2.25.1