This topic is locked
[SOLVED]

 Password reminder in bulk mode

12/31/2020 12:26:36 PM
PHPRunner General questions
Myr0n author

Hello everybody

I added a custom button on the header of the header of Admin-Add/edit user and I would like send a password reminder to all users in the table users, the only code that I need is how to send it using the remind.php

I found that passing the email address as a parameter to remind.php will show me the page remind.php and the email address and this is my code.



arrayWithAllUsersEmails.forEach(sendPasswordReminderToEveryUser)

//

function sendPasswordReminderToEveryUser(userEmail, index, arr) {

urlToOpen="remind.php?username_email="+userEmail;

window.open(urlToOpen); //<---- HERE WILL FAIL BECAUSE OPEN THE remind.php for every user

}


and this is the code that I use in a custom button per user, and goes in the OnAfter and works



var win = Runner.displayPopup( {

url: "remind.php?username_email="+result['email'],

footer: '<a class="myCloseButton" href="#" onclick="window.win.close();return false;">'+Runner.getCustomLabel('CloseThisWindow')+'</a>',

afterCreate: function(win) {

window.win = win;

$('iframe').contents().find('html body.function-remind form#form1 div.r-panel-page div.bs-pagepanel.panel.panel-primary div.panel-heading').remove();

$('iframe').contents().find('html body.function-remind form#form1 div.r-panel-page div.bs-pagepanel.panel.panel-primary div.panel-body div#form_footer_1.r-form div.row div.col-md-6 span a.btn.btn-default').remove();

$('iframe').contents().find('html body.function-remind form#form1 div.r-panel-page div.bs-pagepanel.panel.panel-primary div.panel-body div#form_footer_1.r-form div.row div.col-md-6 span a.btn.btn-primary').click();

}

});


The inconvenience with the above code is that shows a popup and stays open, to let the admin know that the email was send it to the user.
Somebody have a how to or clue?
will be nice to include this function in the Security API, like

RemindPasswordPage::sendRemindEmail($email)
Sergey Kornilov admin 1/1/2021

Could you explain your whole scenario to us, what are you trying to achieve?

Myr0n author 1/1/2021

I would like that clicking in a custom button in the server side get all the users emails and in the afterClient send a remind password to every email that I get in the server side, if is possible send the email from the server side will be amazing.

Thank you so much

Sergey Kornilov admin 1/4/2021

I see what you saying. No, we do not have such a function in the API.
You can take a look at function remindPassword() in classes/remindpwdpage.php file and do something similar in your code. Basically, you need to create a reset token, save it in the database and send the email.

Myr0n author 1/4/2021

Ok, thank you for the advice, I'll do it

Thank you so much.
> I see what you saying. No, we do not have such a function in the API.
You can take a look at function remindPassword() in classes/remindpwdpage.php file and do something similar in your code. Basically, you need to create a reset token, save it in the database and send the email.