mirror of
https://github.com/alchemy-fr/Phraseanet.git
synced 2025-10-16 22:43:19 +00:00
Merge pull request #433 from romainneutron/register-mails
[3.8] Register mails
This commit is contained in:
@@ -15,7 +15,7 @@ use Alchemy\Phrasea\Exception\InvalidArgumentException;
|
||||
use Alchemy\Phrasea\Helper\Helper;
|
||||
use Alchemy\Phrasea\Notification\Receiver;
|
||||
use Alchemy\Phrasea\Notification\Mail\MailRequestPasswordSetup;
|
||||
use Alchemy\Phrasea\Notification\Mail\MailSuccessEmailConfirmationUnregistered;
|
||||
use Alchemy\Phrasea\Notification\Mail\MailRequestEmailConfirmation;
|
||||
|
||||
/**
|
||||
*
|
||||
@@ -185,12 +185,9 @@ class Manage extends Helper
|
||||
if ($receiver) {
|
||||
$expire = new \DateTime('+3 days');
|
||||
$token = $this->app['tokens']->getUrlToken(\random::TYPE_PASSWORD, $createdUser->get_id(), $expire, $createdUser->get_email());
|
||||
$url = $this->app->url('login_register_confirm', array('code' => $token));
|
||||
|
||||
$mail = MailRequestPasswordSetup::create($this->app, $receiver);
|
||||
$mail->setLogin($createdUser->get_login());
|
||||
$mail->setButtonUrl($this->app->url('login_register_confirm', array('code' => $token)));
|
||||
$mail->setExpiration($expire);
|
||||
|
||||
$mail = MailRequestEmailConfirmation::create($this->app, $receiver, null, '', $url, $expire);
|
||||
$this->app['notification.deliverer']->deliver($mail);
|
||||
}
|
||||
}
|
||||
@@ -199,8 +196,9 @@ class Manage extends Helper
|
||||
$urlToken = $this->app['tokens']->getUrlToken(\random::TYPE_PASSWORD, $createdUser->get_id());
|
||||
|
||||
if ($receiver && false !== $urlToken) {
|
||||
$mail = MailSuccessEmailConfirmationUnregistered::create($this->app, $receiver);
|
||||
$mail->setButtonUrl($this->app->url('login_forgot_password', array('token' => $urlToken)));
|
||||
$url = $this->app->url('login_renew_password', array('token' => $urlToken));
|
||||
$mail = MailRequestPasswordSetup::create($this->app, $receiver, null, '', $url);
|
||||
$mail->setLogin($createdUser->get_login());
|
||||
$this->app['notification.deliverer']->deliver($mail);
|
||||
}
|
||||
}
|
||||
|
@@ -285,7 +285,7 @@ class ControllerUsersTest extends \PhraseanetWebTestCaseAuthenticatedAbstract
|
||||
|
||||
public function testRouteCreateUserAndValidateEmail()
|
||||
{
|
||||
$this->mockNotificationDeliverer('Alchemy\Phrasea\Notification\Mail\MailRequestPasswordSetup');
|
||||
$this->mockNotificationDeliverer('Alchemy\Phrasea\Notification\Mail\MailRequestEmailConfirmation');
|
||||
$username = uniqid('user_');
|
||||
|
||||
self::$DI['client']->request('POST', '/admin/users/create/', array(
|
||||
@@ -312,7 +312,7 @@ class ControllerUsersTest extends \PhraseanetWebTestCaseAuthenticatedAbstract
|
||||
|
||||
public function testRouteCreateUserAndSendCredentials()
|
||||
{
|
||||
$this->mockNotificationDeliverer('Alchemy\Phrasea\Notification\Mail\MailSuccessEmailConfirmationUnregistered');
|
||||
$this->mockNotificationDeliverer('Alchemy\Phrasea\Notification\Mail\MailRequestPasswordSetup');
|
||||
$username = uniqid('user_');
|
||||
|
||||
self::$DI['client']->request('POST', '/admin/users/create/', array(
|
||||
|
@@ -83,7 +83,7 @@ $(document).ready(function(){
|
||||
$('#new_user_loader').show();
|
||||
$.ajax({
|
||||
type: 'POST',
|
||||
url: '../../admin/users/create/',
|
||||
url: '../admin/users/create/',
|
||||
dataType : 'json',
|
||||
data: {
|
||||
act:'CREATENEWUSER',
|
||||
@@ -104,7 +104,7 @@ $(document).ready(function(){
|
||||
p4.users.sel = [];
|
||||
$.ajax({
|
||||
type: 'POST',
|
||||
url: '../../admin/users/rights/',
|
||||
url: '../admin/users/rights/',
|
||||
data: {
|
||||
users : data.data
|
||||
},
|
||||
@@ -148,7 +148,7 @@ $(document).ready(function(){
|
||||
$('#right-ajax').empty().addClass('loading');
|
||||
$.ajax({
|
||||
type: 'POST',
|
||||
url: '../../admin/users/search/',
|
||||
url: '../admin/users/search/',
|
||||
data: datas,
|
||||
success: function(data){
|
||||
$('#right-ajax').removeClass('loading').empty().html(data);
|
||||
@@ -163,7 +163,7 @@ $(document).ready(function(){
|
||||
$('#right-ajax').empty().addClass('loading');
|
||||
$.ajax({
|
||||
type: 'POST',
|
||||
url: '../../admin/users/search/',
|
||||
url: '../admin/users/search/',
|
||||
data: datas,
|
||||
success: function(data){
|
||||
$('#right-ajax').removeClass('loading').empty().html(data);
|
||||
@@ -334,7 +334,7 @@ $(document).ready(function(){
|
||||
p4.users.sel = [];
|
||||
$.ajax({
|
||||
type: 'POST',
|
||||
url: '../../admin/users/rights/',
|
||||
url: '../admin/users/rights/',
|
||||
data: {
|
||||
users : users
|
||||
},
|
||||
@@ -357,7 +357,7 @@ $(document).ready(function(){
|
||||
p4.users.sel = [];
|
||||
$.ajax({
|
||||
type: 'POST',
|
||||
url: '../../admin/users/delete/',
|
||||
url: '../admin/users/delete/',
|
||||
data: {
|
||||
users : users
|
||||
},
|
||||
@@ -379,7 +379,7 @@ $(document).ready(function(){
|
||||
p4.users.sel = [];
|
||||
$.ajax({
|
||||
type: 'POST',
|
||||
url: '../../admin/users/rights/',
|
||||
url: '../admin/users/rights/',
|
||||
data: {
|
||||
users : users
|
||||
},
|
||||
|
Reference in New Issue
Block a user