diff --git a/application/Espo/Controllers/User.php b/application/Espo/Controllers/User.php
index 621dc8f96a..0eab3b7032 100644
--- a/application/Espo/Controllers/User.php
+++ b/application/Espo/Controllers/User.php
@@ -55,22 +55,16 @@ class User extends \Espo\Core\Controllers\Record
return $this->getAclManager()->getMap($user);
}
- public function actionChangeOwnPassword($params, $data, $request)
+ public function postActionChangeOwnPassword($params, $data, $request)
{
- if (!$request->isPost()) {
- throw new BadRequest();
- }
if (!array_key_exists('password', $data) || !array_key_exists('currentPassword', $data)) {
throw new BadRequest();
}
return $this->getService('User')->changePassword($this->getUser()->id, $data['password'], true, $data['currentPassword']);
}
- public function actionChangePasswordByRequest($params, $data, $request)
+ public function postActionChangePasswordByRequest($params, $data, $request)
{
- if (!$request->isPost()) {
- throw new BadRequest();
- }
if (empty($data['requestId']) || empty($data['password'])) {
throw new BadRequest();
}
@@ -89,23 +83,27 @@ class User extends \Espo\Core\Controllers\Record
$this->getEntityManager()->removeEntity($p);
- return $this->getService('User')->changePassword($userId, $data['password']);
+ if ($this->getService('User')->changePassword($userId, $data['password'])) {
+ return array(
+ 'url' => $p->get('url')
+ );
+ }
}
- public function actionPasswordChangeRequest($params, $data, $request)
+ public function postActionPasswordChangeRequest($params, $data, $request)
{
- if (!$request->isPost()) {
- throw new Forbidden();
- }
-
if (empty($data['userName']) || empty($data['emailAddress'])) {
throw new BadRequest();
}
$userName = $data['userName'];
$emailAddress = $data['emailAddress'];
+ $url = null;
+ if (!empty($data['url'])) {
+ $url = $data['url'];
+ }
- return $this->getService('User')->passwordChangeRequest($userName, $emailAddress);
+ return $this->getService('User')->passwordChangeRequest($userName, $emailAddress, $url);
}
}
diff --git a/application/Espo/Modules/Crm/Resources/i18n/en_US/Campaign.json b/application/Espo/Modules/Crm/Resources/i18n/en_US/Campaign.json
index c3e366c9eb..19214f0fae 100644
--- a/application/Espo/Modules/Crm/Resources/i18n/en_US/Campaign.json
+++ b/application/Espo/Modules/Crm/Resources/i18n/en_US/Campaign.json
@@ -55,7 +55,8 @@
"hard": "hard",
"soft": "soft",
"Unsubscribe": "Unsubscribe",
- "Mass Emails": "Mass Emails"
+ "Mass Emails": "Mass Emails",
+ "Email Templates": "Email Templates"
},
"presetFilters": {
"active": "Active"
diff --git a/application/Espo/Modules/Crm/Resources/metadata/clientDefs/Campaign.json b/application/Espo/Modules/Crm/Resources/metadata/clientDefs/Campaign.json
index ca1f281b77..e3aab2ca45 100644
--- a/application/Espo/Modules/Crm/Resources/metadata/clientDefs/Campaign.json
+++ b/application/Espo/Modules/Crm/Resources/metadata/clientDefs/Campaign.json
@@ -17,6 +17,12 @@
"link": "#MassEmail",
"acl": "read",
"aclScope": "MassEmail"
+ },
+ {
+ "label": "Email Templates",
+ "link": "#EmailTemplate",
+ "acl": "read",
+ "aclScope": "EmailTemplate"
}
]
}
diff --git a/application/Espo/Resources/i18n/en_US/User.json b/application/Espo/Resources/i18n/en_US/User.json
index 9a678d2d88..b40df0a1f8 100644
--- a/application/Espo/Resources/i18n/en_US/User.json
+++ b/application/Espo/Resources/i18n/en_US/User.json
@@ -71,7 +71,7 @@
"emailAddressCantBeEmpty": "Email Address can not be empty",
"userNameEmailAddressNotFound": "Username/Email Address not found",
"forbidden": "Forbidden, please try later",
- "uniqueLinkHasBeenSent": "The unique link has been sent to the specified email address.",
+ "uniqueLinkHasBeenSent": "The unique URL has been sent to the specified email address.",
"passwordChangedByRequest": "Password has been changed."
},
"boolFilters": {
diff --git a/application/Espo/Resources/metadata/entityDefs/PasswordChangeRequest.json b/application/Espo/Resources/metadata/entityDefs/PasswordChangeRequest.json
index 776402372d..a71b3097c6 100644
--- a/application/Espo/Resources/metadata/entityDefs/PasswordChangeRequest.json
+++ b/application/Espo/Resources/metadata/entityDefs/PasswordChangeRequest.json
@@ -10,6 +10,9 @@
"readOnly": true,
"index": true
},
+ "url": {
+ "type": "url"
+ },
"createdAt": {
"type": "datetime",
"readOnly": true
diff --git a/application/Espo/Services/User.php b/application/Espo/Services/User.php
index 2a371779fc..f58b0761aa 100644
--- a/application/Espo/Services/User.php
+++ b/application/Espo/Services/User.php
@@ -127,7 +127,7 @@ class User extends Record
return true;
}
- public function passwordChangeRequest($userName, $emailAddress)
+ public function passwordChangeRequest($userName, $emailAddress, $url = null)
{
$user = $this->getEntityManager()->getRepository('User')->where(array(
'userName' => $userName,
@@ -156,7 +156,8 @@ class User extends Record
$passwordChangeRequest = $this->getEntityManager()->getEntity('PasswordChangeRequest');
$passwordChangeRequest->set(array(
'userId' => $userId,
- 'requestId' => $requestId
+ 'requestId' => $requestId,
+ 'url' => $url
));
$this->sendChangePasswordLink($requestId, $emailAddress);
diff --git a/frontend/client/src/controllers/password-change-request.js b/frontend/client/src/controllers/password-change-request.js
index 5bfaf73ac8..cfbade0f07 100644
--- a/frontend/client/src/controllers/password-change-request.js
+++ b/frontend/client/src/controllers/password-change-request.js
@@ -35,7 +35,7 @@ Espo.define('controllers/password-change-request', 'controller', function (Dep)
throw new Error();
}
- this.entire('User.PasswordChangeRequest', {
+ this.entire('views/user/password-change-request', {
requestId: id
}, function (view) {
view.render();
diff --git a/frontend/client/src/views/login.js b/frontend/client/src/views/login.js
index d1b31884c0..b547bb369a 100644
--- a/frontend/client/src/views/login.js
+++ b/frontend/client/src/views/login.js
@@ -35,7 +35,7 @@ Espo.define('views/login', 'view', function (Dep) {
views: {
footer: {
el: 'body > footer',
- view: 'Site.Footer'
+ view: 'views/site/footer'
},
},
@@ -131,7 +131,8 @@ Espo.define('views/login', 'view', function (Dep) {
showPasswordChangeRequest: function () {
this.notify('Please wait...');
- this.createView('passwordChangeRequest', 'Modals.PasswordChangeRequest', {
+ this.createView('passwordChangeRequest', 'views/modals/password-change-request', {
+ url: window.location.href
}, function (view) {
view.render();
view.notify(false);
diff --git a/frontend/client/src/views/modals/change-password.js b/frontend/client/src/views/modals/change-password.js
index 9d62656b77..5b63ac7af4 100644
--- a/frontend/client/src/views/modals/change-password.js
+++ b/frontend/client/src/views/modals/change-password.js
@@ -95,7 +95,7 @@ Espo.define('views/modals/change-password', 'views/modal', function (Dep) {
},
- actionChangePassword: function () {
+ actionChange: function () {
this.getView('currentPassword').fetchToModel();
this.getView('password').fetchToModel();
this.getView('passwordConfirm').fetchToModel();
diff --git a/frontend/client/src/views/modals/password-change-request.js b/frontend/client/src/views/modals/password-change-request.js
index b9df4525da..96e91262a5 100644
--- a/frontend/client/src/views/modals/password-change-request.js
+++ b/frontend/client/src/views/modals/password-change-request.js
@@ -40,10 +40,7 @@ Espo.define('views/modals/password-change-request', 'views/modal', function (Dep
{
name: 'submit',
label: 'Submit',
- style: 'danger',
- onClick: function (dialog) {
- this.submit();
- }.bind(this)
+ style: 'danger'
},
{
name: 'cancel',
@@ -117,7 +114,8 @@ Espo.define('views/modals/password-change-request', 'views/modal', function (Dep
type: 'POST',
data: JSON.stringify({
userName: userName,
- emailAddress: emailAddress
+ emailAddress: emailAddress,
+ url: this.options.url
}),
error: function (xhr) {
if (xhr.status == 404) {
diff --git a/frontend/client/src/views/user/password-change-request.js b/frontend/client/src/views/user/password-change-request.js
index 11d71a9392..9b6ff9f4c9 100644
--- a/frontend/client/src/views/user/password-change-request.js
+++ b/frontend/client/src/views/user/password-change-request.js
@@ -26,7 +26,7 @@
* these Appropriate Legal Notices must retain the display of the "EspoCRM" word.
************************************************************************/
-Espo.define('views./user/password-change-request', 'view', function (Dep) {
+Espo.define('views/user/password-change-request', 'view', function (Dep) {
return Dep.extend({
@@ -102,11 +102,13 @@ Espo.define('views./user/password-change-request', 'view', function (Dep) {
error: function () {
this.$el.find('.btn-submit').removeClass('disabled');
}.bind(this)
- }).done(function () {
+ }).done(function (data) {
this.$el.find('.password-change').remove();
+ var url = data.url || this.getConfig().get('siteUrl');
+
var msg = this.translate('passwordChangedByRequest', 'messages', 'User');
- msg += ' ' + this.translate('Login', 'labels', 'User') + '.';
+ msg += ' ' + this.translate('Login', 'labels', 'User') + '.';
this.$el.find('.msg-box').removeClass('hidden').html('' + msg + '');
}.bind(this));