Skip to content

Commit 9171fa4

Browse files
author
akshay kumar
committed
Merge branch '1.0' of https://github.com/uvdesk/support-center-bundle into HEAD
2 parents 9abd8bf + ebed41b commit 9171fa4

11 files changed

Lines changed: 59 additions & 200 deletions

File tree

CHANGELOG-1.0.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@ This changelog references any relevant changes introduced in 1.0 minor versions.
66
* 1.0.1 (2019-10-15)
77
* **Issue #79:** User profile gets hidden
88
* **Issue #75:** Profile issue inside ticket page
9+
* **Misc. Updates:**
10+
* Updated README.md with link to the official gitter chat for uvdesk/support-center-bundle
911

1012
* 1.0.0 (Released on 2019-10-09)
1113
* **Issue #76:** tinymce text editor added for article section. (raised by papnoisanjeev)

Controller/Customer.php

Lines changed: 21 additions & 115 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,16 @@
22

33
namespace Webkul\UVDesk\SupportCenterBundle\Controller;
44

5-
use Webkul\UVDesk\CoreFrameworkBundle\Entity\User;
65
use Symfony\Component\HttpFoundation\Request;
76
use Symfony\Component\Security\Core\Security;
8-
use Webkul\UVDesk\CoreFrameworkBundle\Form\UserProfile;
9-
use Webkul\UVDesk\CoreFrameworkBundle\Utils\TokenGenerator;
7+
use Webkul\UVDesk\CoreFrameworkBundle\Entity\User;
108
use Symfony\Component\EventDispatcher\GenericEvent;
9+
use Webkul\UVDesk\CoreFrameworkBundle\Form\UserProfile;
1110
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
12-
use Webkul\UVDesk\CoreFrameworkBundle\Workflow\Events as CoreWorkflowEvents;
11+
use Webkul\UVDesk\CoreFrameworkBundle\Utils\TokenGenerator;
12+
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
13+
use Webkul\UVDesk\SupportCenterBundle\Entity\KnowledgebaseWebsite;
14+
use Webkul\UVDesk\CoreFrameworkBundle\Entity\Website as CoreWebsite;
1315

1416
Class Customer extends Controller
1517
{
@@ -22,22 +24,25 @@ protected function redirectUserToLogin()
2224

2325
protected function isWebsiteActive()
2426
{
25-
$error = false;
27+
$entityManager = $this->getDoctrine()->getManager();
28+
$website = $entityManager->getRepository(CoreWebsite::class)->findOneByCode('knowledgebase');
29+
30+
if (!empty($website)) {
31+
$knowledgebaseWebsite = $entityManager->getRepository(KnowledgebaseWebsite::class)->findOneBy(['website' => $website->getId(), 'status' => 1]);
32+
33+
if (!empty($knowledgebaseWebsite) && true == $knowledgebaseWebsite->getIsActive()) {
34+
return true;
35+
}
36+
}
2637

27-
if($error)
28-
$this->noResultFound();
38+
$this->noResultFound();
2939
}
3040

3141
protected function noResultFound()
3242
{
3343
throw new NotFoundHttpException('Permission Denied !');
3444
}
3545

36-
protected function encodePassword(User $user, $plainPassword)
37-
{
38-
return $encodedPassword = $this->container->get('security.password_encoder')->encodePassword($user, $plainPassword);
39-
}
40-
4146
protected function isLoginDisabled()
4247
{
4348
$entityManager = $this->getDoctrine()->getManager();
@@ -59,8 +64,11 @@ protected function isLoginDisabled()
5964

6065
public function login(Request $request)
6166
{
62-
if($this->redirectUserToLogin())
67+
$this->isWebsiteActive();
68+
69+
if ($this->redirectUserToLogin()) {
6370
return $this->redirect($this->generateUrl('helpdesk_customer_ticket_collection')); // Replace with Dashboard route
71+
}
6472

6573
/** check disabled customer login **/
6674
if($this->isLoginDisabled()) {
@@ -89,108 +97,6 @@ public function login(Request $request)
8997
]);
9098
}
9199

92-
public function forgotPassword(Request $request)
93-
{
94-
if ($this->isLoginDisabled()) {
95-
$this->addFlash('warning', $this->get('translator')->trans('Warning ! Customer Login disabled by admin.'));
96-
return $this->redirect($this->generateUrl('webkul_support_center_front_solutions'));
97-
}
98-
99-
if ($request->getMethod() == 'POST') {
100-
$entityManager = $this->getDoctrine()->getManager();
101-
$user = new User();
102-
$data = $request->request->all();
103-
$repository = $this->getDoctrine()->getRepository('UVDeskCoreFrameworkBundle:User');
104-
$user = $entityManager->getRepository('UVDeskCoreFrameworkBundle:User')->findOneBy(array('email' => $data['email']));
105-
106-
if ($user) {
107-
$key = time();
108-
109-
// Trigger agent forgot event
110-
$event = new GenericEvent(CoreWorkflowEvents\Customer\ForgotPassword::getId(), [
111-
'entity' => $user,
112-
]);
113-
114-
$this->get('event_dispatcher')->dispatch('uvdesk.automation.workflow.execute', $event);
115-
116-
$request->getSession()->getFlashBag()->set(
117-
'success',
118-
$this->get('translator')->trans('Please check your mail for password update.')
119-
);
120-
121-
return $this->redirect($this->generateUrl('helpdesk_customer_login'));
122-
//@TODO: NEEDS TO SEND EMAIL FOR CHANGE PASSWORD URL.
123-
} else {
124-
$request->getSession()->getFlashBag()->set(
125-
'warning',
126-
$this->get('translator')->trans('This Email is not registered with us.')
127-
);
128-
}
129-
}
130-
131-
return $this->render('@UVDeskSupportCenter/Knowledgebase/forgotPassword.html.twig', [
132-
'searchDisable' => true,
133-
'breadcrumbs' => [
134-
[
135-
'label' => $this->get('translator')->trans('Support Center'),
136-
'url' => $this->generateUrl('helpdesk_knowledgebase')
137-
],
138-
['label' => $this->get('translator')->trans('Forgot Password'), 'url' => '#']
139-
]
140-
]);
141-
}
142-
143-
144-
public function updateCredentials($email, $verificationCode)
145-
{
146-
if ($this->isLoginDisabled() || (empty($email) || empty($verificationCode))) {
147-
return $this->redirect($this->generateUrl('helpdesk_knowledgebase'));
148-
}
149-
150-
$entityManager = $this->getDoctrine()->getManager();
151-
$request = $this->get('request_stack')->getCurrentRequest();
152-
153-
// Validate request
154-
$user = $entityManager->getRepository('UVDeskCoreFrameworkBundle:User')->findOneByEmail($email);
155-
156-
if (empty($user) || null == $user->getCustomerInstance() || $user->getVerificationCode() != $verificationCode) {
157-
return $this->redirect($this->generateUrl('helpdesk_knowledgebase'));
158-
}
159-
160-
if ($request->getMethod() == 'POST') {
161-
$updatedCredentials = $request->request->all();
162-
163-
if ($updatedCredentials['password'] === $updatedCredentials['confirmPassword']) {
164-
$user->setPassword($this->encodePassword($user, $updatedCredentials['password']));
165-
$user->setVerificationCode(TokenGenerator::generateToken());
166-
167-
$entityManager->persist($user);
168-
$entityManager->flush();
169-
170-
$request->getSession()->getFlashBag()->set('success', 'Your password has been updated successfully.');
171-
return $this->redirect($this->generateUrl('helpdesk_customer_login'));
172-
} else {
173-
$request->getSession()->getFlashBag()->set(
174-
'warning',
175-
$this->get('translator')->trans('Password don\'t match.')
176-
);
177-
}
178-
}
179-
180-
return $this->render('@UVDeskSupportCenter/Knowledgebase/resetPassword.html.twig', [
181-
'searchDisable' => true,
182-
'breadcrumbs' => [
183-
[
184-
'label' => $this->get('translator')->trans('Support Center'),
185-
'url' => 'helpdesk_knowledgebase'
186-
], [
187-
'label' => $this->get('translator')->trans('Account Validation'),
188-
'url' => '#'
189-
]
190-
]
191-
]);
192-
}
193-
194100
public function Account(Request $request)
195101
{
196102
$this->isWebsiteActive();

Controller/Ticket.php

Lines changed: 17 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -6,32 +6,33 @@
66
use Symfony\Component\HttpFoundation\Response;
77
use Symfony\Component\EventDispatcher\GenericEvent;
88
use Webkul\UVDesk\CoreFrameworkBundle\Entity\Thread;
9+
use Webkul\UVDesk\CoreFrameworkBundle\Entity\Website;
910
use Symfony\Component\Validator\Constraints\DateTime;
1011
use Symfony\Component\Security\Core\User\UserInterface;
1112
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
1213
use Webkul\UVDesk\CoreFrameworkBundle\Entity\TicketRating;
1314
use Webkul\UVDesk\SupportCenterBundle\Form\Ticket as TicketForm;
1415
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
16+
use Webkul\UVDesk\SupportCenterBundle\Entity\KnowledgebaseWebsite;
1517
use Webkul\UVDesk\CoreFrameworkBundle\Entity\Ticket as TicketEntity;
1618
use Webkul\UVDesk\CoreFrameworkBundle\Workflow\Events as CoreWorkflowEvents;
1719

1820
class Ticket extends Controller
1921
{
2022
protected function isWebsiteActive()
2123
{
22-
$error = false;
23-
$currentKnowledgebase = $this->getWebsiteDetails();
24-
25-
if (!$currentKnowledgebase) {
26-
$this->noResultFound();
24+
$entityManager = $this->getDoctrine()->getManager();
25+
$website = $entityManager->getRepository(Website::class)->findOneByCode('knowledgebase');
26+
27+
if (!empty($website)) {
28+
$knowledgebaseWebsite = $entityManager->getRepository(KnowledgebaseWebsite::class)->findOneBy(['website' => $website->getId(), 'status' => 1]);
29+
30+
if (!empty($knowledgebaseWebsite) && true == $knowledgebaseWebsite->getIsActive()) {
31+
return true;
32+
}
2733
}
28-
}
2934

30-
protected function getWebsiteDetails()
31-
{
32-
$knowledgebaseWebsite = $this->getDoctrine()->getManager()->getRepository('UVDeskCoreFrameworkBundle:Website')->findOneByCode('knowledgebase');
33-
34-
return $knowledgebaseWebsite;
35+
$this->noResultFound();
3536
}
3637

3738
/**
@@ -48,12 +49,14 @@ public function ticketadd(Request $request)
4849
$this->isWebsiteActive();
4950

5051
$formErrors = $errors = array();
51-
$websiteConfiguration = $this->get('uvdesk.service')->getActiveConfiguration($this->getWebsiteDetails()->getId());
52+
$em = $this->getDoctrine()->getManager();
53+
$website = $em->getRepository(Website::class)->findOneByCode('knowledgebase');
54+
$websiteConfiguration = $this->get('uvdesk.service')->getActiveConfiguration($website->getId());
5255

53-
if(!$websiteConfiguration || !$websiteConfiguration->getTicketCreateOption() || ($websiteConfiguration->getLoginRequiredToCreate() && !$this->getUser()))
56+
if (!$websiteConfiguration || !$websiteConfiguration->getTicketCreateOption() || ($websiteConfiguration->getLoginRequiredToCreate() && !$this->getUser())) {
5457
return $this->redirect($this->generateUrl('helpdesk_knowledgebase'));
58+
}
5559

56-
$em = $this->getDoctrine()->getManager();
5760
$post = $request->request->all();
5861

5962
if($request->getMethod() == "POST") {

Controller/Website.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ private function isKnowledgebaseActive()
3030
$website = $entityManager->getRepository(CoreWebsite::class)->findOneByCode('knowledgebase');
3131

3232
if (!empty($website)) {
33-
$knowledgebaseWebsite = $entityManager->getRepository(KnowledgebaseWebsite::class)->findOneByWebsite($website->getId());
33+
$knowledgebaseWebsite = $entityManager->getRepository(KnowledgebaseWebsite::class)->findOneBy(['website' => $website->getId(), 'status' => true]);
3434

3535
if (!empty($knowledgebaseWebsite) && true == $knowledgebaseWebsite->getIsActive()) {
3636
return true;

Fixtures/EmailTemplates.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ class EmailTemplates extends DoctrineFixture
1111
{
1212
private static $seeds = [
1313
SupportCenterEmailTemplates\Customer\AccountCreated::class,
14-
SupportCenterEmailTemplates\Customer\ForgotPassword::class,
1514
];
1615

1716
public function load(ObjectManager $entityManager)

README.md

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,12 @@
22
<img src="https://s3-ap-southeast-1.amazonaws.com/cdn.uvdesk.com/uvdesk/bundles/webkuldefault/images/uvdesk-wide.svg">
33
</a></p>
44

5-
UVDeskSupportCenterBundle
6-
--------------
5+
<p align="center">
6+
<a href="https://packagist.org/packages/uvdesk/support-center-bundle"><img src="https://poser.pugx.org/uvdesk/support-center-bundle/v/stable.svg" alt="Latest Stable Version"></a>
7+
<a href="https://packagist.org/packages/uvdesk/support-center-bundle"><img src="https://poser.pugx.org/uvdesk/support-center-bundle/d/total.svg" alt="Total Downloads"></a>
8+
<a href="https://packagist.org/packages/uvdesk/support-center-bundle"><img src="https://poser.pugx.org/uvdesk/support-center-bundle/license.svg" alt="License"></a>
9+
<a href="https://gitter.im/uvdesk/support-center-bundle"><img src="https://badges.gitter.im/uvdesk/support-center-bundle.svg" alt="connect on gitter"></a>
10+
</p>
711

812
The **UVDeskSupportCenterBundle** introduces the Support Center portal to the [UVDesk Community][1] helpdesk, a nifty solution to provide your customers with an easy interface to manage their tickets and easily engage with your support staff. The Support Center also includes a Knowledgebase that can be easily managed by your support staff.
913

Resources/config/routes/private-customers.yaml

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -11,15 +11,6 @@ helpdesk_customer_account:
1111
path: /account
1212
controller: Webkul\UVDesk\SupportCenterBundle\Controller\Customer::Account
1313

14-
helpdesk_customer_forgot_password:
15-
path: /forgot-password
16-
controller: Webkul\UVDesk\SupportCenterBundle\Controller\Customer::forgotPassword
17-
18-
helpdesk_customer_update_account_credentials:
19-
path: /update-credentials/{email}/{verificationCode}
20-
controller: Webkul\UVDesk\SupportCenterBundle\Controller\Customer::updateCredentials
21-
defaults: { email: 0, verificationCode: 0 }
22-
2314
# Customer ticket routing resources
2415
helpdesk_customer_ticket_collection:
2516
path: /tickets

Resources/views/Knowledgebase/login.html.twig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
<div class="uv-element-block">
2828
<label class="uv-field-label">{{ 'Password'|trans }}</label>
2929
<div class="uv-field-block uv-relative">
30-
<a class="uv-forgot-pwd" href="{{ path('helpdesk_customer_forgot_password') }}" tabIndex="-1">{{ 'Forgot Password?'|trans }}</a>
30+
<a class="uv-forgot-pwd" href="{{ path('helpdesk_forgot_account_password') }}" tabIndex="-1">{{ 'Forgot Password?'|trans }}</a>
3131
<input class="uv-field" type="password" name="_password">
3232
</div>
3333
</div>

Resources/views/Knowledgebase/ticketList.html.twig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,7 @@
152152
<% } else { %>
153153
<img class="uv-table-agent" src="{{ asset(default_agent_image_path) }}" alt=""/>
154154
<% } %>
155-
<%- agent.name %>
155+
<%- agent.firstName + ' ' + (agent.lastName == null ? '' : agent.lastName) %>
156156
<% } else { %>
157157
{{ 'Unassigned'|trans }}
158158
<% } %>

Resources/views/Templates/header.html.twig

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@
1616
color: #2750C4;
1717
text-decoration: none;
1818
}
19-
.uv-profile-block .uv-dropdown-list {
20-
top: 72px;
19+
.uv-profile-block .uv-bottom-right{
20+
top: auto !important;
2121
}
2222
.uv-rtl header .uv-header-rt > span {
2323
display: block;
@@ -49,6 +49,14 @@
4949
color: {{ websiteConfiguration.linkHoverColor }} !important;
5050
}
5151
{% endif %}
52+
{% if websiteConfiguration is defined and websiteConfiguration.articleTextColor is defined %}
53+
.uv-paper-article .uv-paper-section > section > p {
54+
color: {{ websiteConfiguration.articleTextColor }} !important;
55+
}
56+
.uv-paper-article .uv-paper-section > section > ul {
57+
color: {{ websiteConfiguration.articleTextColor }} !important;
58+
}
59+
{% endif %}
5260
.goog-te-gadget-simple .goog-te-menu-value, .goog-te-gadget-simple .goog-te-menu-value:hover {
5361
color: #333!important;
5462
}

0 commit comments

Comments
 (0)