Skip to content

Commit e3d61fb

Browse files
maxmimaxmi
authored andcommitted
Empty Token Validate
Try to create log file if it does not exist
1 parent 61df064 commit e3d61fb

File tree

4 files changed

+25
-1
lines changed

4 files changed

+25
-1
lines changed

src/app/code/community/Zendesk/Zendesk/controllers/Adminhtml/ZendeskController.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -364,9 +364,10 @@ public function autocompleteAction()
364364
public function logAction()
365365
{
366366
$path = Mage::helper('zendesk/log')->getLogPath();
367-
367+
368368
if(!file_exists($path)) {
369369
Mage::getSingleton('adminhtml/session')->addError(Mage::helper('zendesk')->__('The Zendesk log file has not been created. Check to see if logging has been enabled.'));
370+
file_put_contents(" ",$path);
370371
}
371372

372373
if(Mage::helper('zendesk/log')->isLogTooLarge()) {

src/app/code/community/Zendesk/Zendesk/etc/system.xml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,7 @@
135135
<label>Remote Authentication Token</label>
136136
<frontend_type>text</frontend_type>
137137
<sort_order>2</sort_order>
138+
<validate>validate-zendesk-sso-token</validate>
138139
<show_in_default>1</show_in_default>
139140
<show_in_website>1</show_in_website>
140141
<show_in_store>1</show_in_store>
@@ -164,6 +165,7 @@
164165
<label>Remote Authentication Token</label>
165166
<frontend_type>text</frontend_type>
166167
<sort_order>2</sort_order>
168+
<validate>validate-zendesk-sso-frontend-token</validate>
167169
<show_in_default>1</show_in_default>
168170
<show_in_website>1</show_in_website>
169171
<show_in_store>1</show_in_store>

src/app/design/adminhtml/default/default/layout/zendesk.xml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,9 @@
2222
<action method="addCss">
2323
<stylesheet>zendesk/zendesk.css</stylesheet>
2424
</action>
25+
<action method="addJs">
26+
<script>zendesk/validation.js</script>
27+
</action>
2528
</reference>
2629
</adminhtml_system_config_edit>
2730

src/js/zendesk/validation.js

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
Validation.addAllThese([
2+
['validate-zendesk-sso-token', 'Token cannot be empty', function (v) {
3+
if ($('zendesk_sso_enabled').getValue() === '1') {
4+
return !Validation.get('IsEmpty').test(v);
5+
} else {
6+
return true;
7+
}
8+
9+
}],
10+
['validate-zendesk-sso-frontend-token', 'Token cannot be empty', function (v) {
11+
if ($('zendesk_sso_frontend_enabled').getValue() === '1') {
12+
return !Validation.get('IsEmpty').test(v);
13+
} else {
14+
return true;
15+
}
16+
17+
}]
18+
]);

0 commit comments

Comments
 (0)