DigitalPianism_AjaxLogin - Version 0.3.0

Version Notes

- Secure all controller calls to use HTTPS
- Implement CORS to be able to call the controller from HTTP

Download this release

Release Info

Developer Digital Pianism
Extension DigitalPianism_AjaxLogin
Version 0.3.0
Comparing to
See all releases


Code changes from version 0.2.6 to 0.3.0

app/code/community/DigitalPianism/AjaxLogin/Block/Customer/Form/Register.php ADDED
@@ -0,0 +1,17 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Class DigitalPianism_AjaxLogin_Block_Customer_Form_Register
5
+ */
6
+ class DigitalPianism_AjaxLogin_Block_Customer_Form_Register
7
+ extends Mage_Customer_Block_Form_Register
8
+ {
9
+ /**
10
+ * Small hack to avoid the meta title to be set to "Create New Customer Account" on all pages
11
+ * @return Mage_Core_Block_Abstract
12
+ */
13
+ protected function _prepareLayout()
14
+ {
15
+ return Mage_Directory_Block_Data::_prepareLayout();
16
+ }
17
+ }
app/code/community/DigitalPianism/AjaxLogin/controllers/IndexController.php CHANGED
@@ -277,7 +277,12 @@ class DigitalPianism_AjaxLogin_IndexController extends Mage_Core_Controller_Fron
277
  $result['error'] = $this->__('Cannot save the customer.');
278
  }
279
 
280
- $this->getResponse()->setBody(Mage::helper('core')->jsonEncode($result));
 
 
 
 
 
281
  }
282
 
283
  public function forgotpasswordAction()
@@ -328,7 +333,12 @@ class DigitalPianism_AjaxLogin_IndexController extends Mage_Core_Controller_Fron
328
  $result['error'] = Mage::helper('customer')->__('Please enter your email.');
329
  }
330
 
331
- $this->getResponse()->setBody(Mage::helper('core')->jsonEncode($result));
 
 
 
 
 
332
  }
333
 
334
  public function loginAction()
@@ -372,7 +382,12 @@ class DigitalPianism_AjaxLogin_IndexController extends Mage_Core_Controller_Fron
372
  }
373
  }
374
 
375
- $this->getResponse()->setBody(Mage::helper('core')->jsonEncode($result));
 
 
 
 
 
376
  }
377
 
378
  public function logoutAction()
@@ -387,6 +402,11 @@ class DigitalPianism_AjaxLogin_IndexController extends Mage_Core_Controller_Fron
387
  $result['redirect'] = Mage::getUrl('customer/account/logoutSuccess', array('_secure' => true));
388
  $result['success'] = true;
389
 
390
- $this->getResponse()->setBody(Mage::helper('core')->jsonEncode($result));
 
 
 
 
 
391
  }
392
  }
277
  $result['error'] = $this->__('Cannot save the customer.');
278
  }
279
 
280
+ $this->getResponse()
281
+ ->setHeader('Access-Control-Allow-Origin', rtrim(Mage::getUrl(''),'/'))
282
+ ->setHeader('Access-Control-Allow-Headers', 'Access-Control-Allow-Origin')
283
+ ->setHeader('Access-Control-Expose-Headers', 'x-json')
284
+ ->setHeader('Access-Control-Allow-Credentials', 'true')
285
+ ->setBody(Mage::helper('core')->jsonEncode($result));
286
  }
287
 
288
  public function forgotpasswordAction()
333
  $result['error'] = Mage::helper('customer')->__('Please enter your email.');
334
  }
335
 
336
+ $this->getResponse()
337
+ ->setHeader('Access-Control-Allow-Origin', rtrim(Mage::getUrl(''),'/'))
338
+ ->setHeader('Access-Control-Allow-Headers', 'Access-Control-Allow-Origin')
339
+ ->setHeader('Access-Control-Expose-Headers', 'x-json')
340
+ ->setHeader('Access-Control-Allow-Credentials', 'true')
341
+ ->setBody(Mage::helper('core')->jsonEncode($result));
342
  }
343
 
344
  public function loginAction()
382
  }
383
  }
384
 
385
+ $this->getResponse()
386
+ ->setHeader('Access-Control-Allow-Origin', rtrim(Mage::getUrl(''),'/'))
387
+ ->setHeader('Access-Control-Allow-Headers', 'Access-Control-Allow-Origin, Access-Control-Allow-Headers, Access-Control-Allow-Credentials')
388
+ ->setHeader('Access-Control-Expose-Headers', 'x-json')
389
+ ->setHeader('Access-Control-Allow-Credentials', 'true')
390
+ ->setBody(Mage::helper('core')->jsonEncode($result));
391
  }
392
 
393
  public function logoutAction()
402
  $result['redirect'] = Mage::getUrl('customer/account/logoutSuccess', array('_secure' => true));
403
  $result['success'] = true;
404
 
405
+ $this->getResponse()
406
+ ->setHeader('Access-Control-Allow-Origin', rtrim(Mage::getUrl(''),'/'))
407
+ ->setHeader('Access-Control-Allow-Headers', 'Access-Control-Allow-Origin, Access-Control-Allow-Headers, Access-Control-Allow-Credentials')
408
+ ->setHeader('Access-Control-Expose-Headers', 'x-json')
409
+ ->setHeader('Access-Control-Allow-Credentials', 'true')
410
+ ->setBody(Mage::helper('core')->jsonEncode($result));
411
  }
412
  }
app/code/community/DigitalPianism/AjaxLogin/etc/config.xml CHANGED
@@ -2,7 +2,7 @@
2
  <config>
3
  <modules>
4
  <DigitalPianism_AjaxLogin>
5
- <version>0.2.6</version>
6
  </DigitalPianism_AjaxLogin>
7
  </modules>
8
  <global>
@@ -11,6 +11,11 @@
11
  <class>DigitalPianism_AjaxLogin_Helper</class>
12
  </ajaxlogin>
13
  </helpers>
 
 
 
 
 
14
  </global>
15
  <frontend>
16
  <routers>
@@ -22,6 +27,9 @@
22
  </args>
23
  </ajaxlogin>
24
  </routers>
 
 
 
25
  <layout>
26
  <updates>
27
  <DigitalPianism_AjaxLogin>
2
  <config>
3
  <modules>
4
  <DigitalPianism_AjaxLogin>
5
+ <version>0.3.0</version>
6
  </DigitalPianism_AjaxLogin>
7
  </modules>
8
  <global>
11
  <class>DigitalPianism_AjaxLogin_Helper</class>
12
  </ajaxlogin>
13
  </helpers>
14
+ <blocks>
15
+ <ajaxlogin>
16
+ <class>DigitalPianism_AjaxLogin_Block</class>
17
+ </ajaxlogin>
18
+ </blocks>
19
  </global>
20
  <frontend>
21
  <routers>
27
  </args>
28
  </ajaxlogin>
29
  </routers>
30
+ <secure_url>
31
+ <ajaxlogin>/ajaxlogin</ajaxlogin>
32
+ </secure_url>
33
  <layout>
34
  <updates>
35
  <DigitalPianism_AjaxLogin>
app/design/frontend/base/default/layout/digitalpianism/ajaxlogin.xml CHANGED
@@ -16,7 +16,7 @@
16
  <reference name="before_body_end">
17
  <block type="core/template" name="ajaxlogin">
18
  <action method="setTemplate" ifconfig="ajaxlogin/options/enable"><template>digitalpianism/ajaxlogin/index.phtml</template></action>
19
- <block type="customer/form_register" name="customer_form_register_ajax" template="digitalpianism/ajaxlogin/register.phtml">
20
  <block type="page/html_wrapper" name="customer.form.register.fields.before" as="form_fields_before" translate="label">
21
  <label>Form Fields Before</label>
22
  </block>
16
  <reference name="before_body_end">
17
  <block type="core/template" name="ajaxlogin">
18
  <action method="setTemplate" ifconfig="ajaxlogin/options/enable"><template>digitalpianism/ajaxlogin/index.phtml</template></action>
19
+ <block type="ajaxlogin/customer_form_register" name="customer_form_register_ajax" template="digitalpianism/ajaxlogin/register.phtml">
20
  <block type="page/html_wrapper" name="customer.form.register.fields.before" as="form_fields_before" translate="label">
21
  <label>Form Fields Before</label>
22
  </block>
app/design/frontend/base/default/template/digitalpianism/ajaxlogin/index.phtml CHANGED
@@ -3,7 +3,7 @@
3
  <div class="page-title">
4
  <span><?php echo $this->__('Login into your Account') ?></span>
5
  </div>
6
- <form action="<?php echo $this->getUrl('ajaxlogin/index/login', array('_secure'=>(!empty($_SERVER['HTTPS']) && $_SERVER['HTTPS']==='on'))) ?>" method="post" id="ajaxlogin-login-form">
7
  <div class="content">
8
  <ul class="form-list">
9
  <li>
@@ -45,7 +45,7 @@
45
  <div class="page-title">
46
  <span><?php echo $this->__('Forgot Your Password?') ?></span>
47
  </div>
48
- <form action="<?php echo $this->getUrl('ajaxlogin/index/forgotpassword', array('_secure'=>(!empty($_SERVER['HTTPS']) && $_SERVER['HTTPS']==='on'))) ?>" method="post" id="ajaxlogin-forgot-password-form">
49
  <div class="content">
50
  <?php
51
  $customerHelper = Mage::helper('customer');
@@ -87,7 +87,7 @@
87
  <div class="page-title">
88
  <span><?php echo $this->__('Create an Account') ?></span>
89
  </div>
90
- <form action="<?php echo $this->getUrl('ajaxlogin/index/create', array('_secure'=>(!empty($_SERVER['HTTPS']) && $_SERVER['HTTPS']==='on'))) ?>" method="post" id="ajaxlogin-create-form">
91
  <?php echo $this->getChildHtml(); ?>
92
  </form>
93
  <script type="text/javascript">
@@ -103,7 +103,7 @@
103
  <div class="page-title">
104
  <span><?php echo $this->__('Logout from your Account') ?></span>
105
  </div>
106
- <form action="<?php echo $this->getUrl('ajaxlogin/index/logout', array('_secure'=>(!empty($_SERVER['HTTPS']) && $_SERVER['HTTPS']==='on'))) ?>" method="post" id="ajaxlogin-logout-form">
107
  <div class="content">
108
  <p><?php echo $this->__('Are you sure you want to log out ?') ?></p>
109
  </div>
3
  <div class="page-title">
4
  <span><?php echo $this->__('Login into your Account') ?></span>
5
  </div>
6
+ <form action="<?php echo $this->getUrl('ajaxlogin/index/login', array('_secure'=>true)) ?>" method="post" id="ajaxlogin-login-form">
7
  <div class="content">
8
  <ul class="form-list">
9
  <li>
45
  <div class="page-title">
46
  <span><?php echo $this->__('Forgot Your Password?') ?></span>
47
  </div>
48
+ <form action="<?php echo $this->getUrl('ajaxlogin/index/forgotpassword', array('_secure'=>true)) ?>" method="post" id="ajaxlogin-forgot-password-form">
49
  <div class="content">
50
  <?php
51
  $customerHelper = Mage::helper('customer');
87
  <div class="page-title">
88
  <span><?php echo $this->__('Create an Account') ?></span>
89
  </div>
90
+ <form action="<?php echo $this->getUrl('ajaxlogin/index/create', array('_secure'=>true)) ?>" method="post" id="ajaxlogin-create-form">
91
  <?php echo $this->getChildHtml(); ?>
92
  </form>
93
  <script type="text/javascript">
103
  <div class="page-title">
104
  <span><?php echo $this->__('Logout from your Account') ?></span>
105
  </div>
106
+ <form action="<?php echo $this->getUrl('ajaxlogin/index/logout', array('_secure'=>true)) ?>" method="post" id="ajaxlogin-logout-form">
107
  <div class="content">
108
  <p><?php echo $this->__('Are you sure you want to log out ?') ?></p>
109
  </div>
package.xml CHANGED
@@ -1,7 +1,7 @@
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>DigitalPianism_AjaxLogin</name>
4
- <version>0.2.6</version>
5
  <stability>stable</stability>
6
  <license uri="http://opensource.org/licenses/osl-3.0.php">OSL v3.0</license>
7
  <channel>community</channel>
@@ -20,11 +20,12 @@
20
  &lt;p&gt;The module is enabled by default but you can disable it here if you need to.&lt;/p&gt;&#xD;
21
  &#xD;
22
  </description>
23
- <notes>- Fix a bug where customer registration would not work on Magento &lt;= 1.9.0.1</notes>
 
24
  <authors><author><name>Digital Pianism</name><user>digitalpianism</user><email>contact@digital-pianism.com</email></author></authors>
25
- <date>2016-03-08</date>
26
- <time>14:42:41</time>
27
- <contents><target name="magecommunity"><dir name="DigitalPianism"><dir name="AjaxLogin"><dir name="Helper"><file name="Data.php" hash="1a04218d84eb0ad89d072f421cc2f993"/></dir><dir name="controllers"><file name="IndexController.php" hash="97e295a5ae7d5af4db22085dc4dda5a1"/></dir><dir name="etc"><file name="adminhtml.xml" hash="2569f90cd6868d15e41f4788c61e7638"/><file name="config.xml" hash="82d635432f9a436990114d915661feeb"/><file name="system.xml" hash="71c81e7c67e405512bb5ed0729bfa2de"/></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="DigitalPianism_AjaxLogin.xml" hash="ff28627543caa7543c763f21ef4a5683"/></dir></target><target name="magedesign"><dir name="frontend"><dir name="base"><dir name="default"><dir name="template"><dir name="digitalpianism"><dir name="ajaxlogin"><file name="index.phtml" hash="f081c58c74c574160592d8b696cfff08"/><file name="register.phtml" hash="94552ee6972d6603d67f00d853099249"/></dir></dir></dir><dir name="layout"><dir name="digitalpianism"><file name="ajaxlogin.xml" hash="f00c699d92c9ae98ffb6da11e3059f67"/></dir></dir></dir></dir></dir></target><target name="mageskin"><dir name="frontend"><dir name="base"><dir name="default"><dir name="css"><dir name="digitalpianism"><dir name="ajaxlogin"><file name="styles.css" hash="8a7f560e5041e52904858828acf378e9"/></dir></dir></dir><dir name="images"><dir name="digitalpianism"><dir name="ajaxlogin"><file name="ajax-loader.gif" hash="b256d80f54c1415d7a6a6fdec39769f4"/><file name="box-content-bg.gif" hash="f5344140a3a9ad4267687b8ec40c5751"/><file name="box-header-bg.gif" hash="e1e109e8f6bfc2f2ccef04769553c60c"/><file name="cancel_round.png" hash="afcb08c1bdcdb7f9922ea289906fdfbf"/><file name="close.png" hash="0aa9c71e1e00deb929514c3b004e30c2"/><file name="shd-medium.png" hash="ed62cea276345a5003a4a6c6f47c1071"/><file name="spinner.gif" hash="73e57937304d89f251e7e540a24b095a"/></dir></dir></dir><dir name="js"><dir name="digitalpianism"><dir name="ajaxlogin"><file name="script.js" hash="f8c7f4beb9d2890e03b12a27e0a9cb00"/></dir></dir></dir></dir></dir></dir></target><target name="magelocale"><dir name="fr_FR"><file name="DigitalPianism_AjaxLogin.csv" hash="6eb7c029c2d98c59b574889e8380ccc2"/></dir><dir name="en_US"><file name="DigitalPianism_AjaxLogin.csv" hash="fd8a1490469491f382a9e0463e3de38b"/></dir></target></contents>
28
  <compatible/>
29
- <dependencies><required><php><min>4.1.0</min><max>6.0.0</max></php></required></dependencies>
30
  </package>
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>DigitalPianism_AjaxLogin</name>
4
+ <version>0.3.0</version>
5
  <stability>stable</stability>
6
  <license uri="http://opensource.org/licenses/osl-3.0.php">OSL v3.0</license>
7
  <channel>community</channel>
20
  &lt;p&gt;The module is enabled by default but you can disable it here if you need to.&lt;/p&gt;&#xD;
21
  &#xD;
22
  </description>
23
+ <notes>- Secure all controller calls to use HTTPS&#xD;
24
+ - Implement CORS to be able to call the controller from HTTP</notes>
25
  <authors><author><name>Digital Pianism</name><user>digitalpianism</user><email>contact@digital-pianism.com</email></author></authors>
26
+ <date>2016-11-14</date>
27
+ <time>10:46:16</time>
28
+ <contents><target name="magecommunity"><dir name="DigitalPianism"><dir name="AjaxLogin"><dir name="Block"><dir name="Customer"><dir name="Form"><file name="Register.php" hash="16229d2dc380e4d1af9a93521c9f71fc"/></dir></dir></dir><dir name="Helper"><file name="Data.php" hash="1a04218d84eb0ad89d072f421cc2f993"/></dir><dir name="controllers"><file name="IndexController.php" hash="ae474861c27c0ef171cda8823e22412e"/></dir><dir name="etc"><file name="adminhtml.xml" hash="2569f90cd6868d15e41f4788c61e7638"/><file name="config.xml" hash="681576b85ae46dad1f1fca7e436ebc58"/><file name="system.xml" hash="71c81e7c67e405512bb5ed0729bfa2de"/></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="DigitalPianism_AjaxLogin.xml" hash="ff28627543caa7543c763f21ef4a5683"/></dir></target><target name="magedesign"><dir name="frontend"><dir name="base"><dir name="default"><dir name="template"><dir name="digitalpianism"><dir name="ajaxlogin"><file name="index.phtml" hash="3219e32180b366d04db3aec58ac31b86"/><file name="register.phtml" hash="94552ee6972d6603d67f00d853099249"/></dir></dir></dir><dir name="layout"><dir name="digitalpianism"><file name="ajaxlogin.xml" hash="b1a7604a1624286aa486e20cb96436c7"/></dir></dir></dir></dir></dir></target><target name="mageskin"><dir name="frontend"><dir name="base"><dir name="default"><dir name="css"><dir name="digitalpianism"><dir name="ajaxlogin"><file name="styles.css" hash="8a7f560e5041e52904858828acf378e9"/></dir></dir></dir><dir name="images"><dir name="digitalpianism"><dir name="ajaxlogin"><file name="ajax-loader.gif" hash="b256d80f54c1415d7a6a6fdec39769f4"/><file name="box-content-bg.gif" hash="f5344140a3a9ad4267687b8ec40c5751"/><file name="box-header-bg.gif" hash="e1e109e8f6bfc2f2ccef04769553c60c"/><file name="cancel_round.png" hash="afcb08c1bdcdb7f9922ea289906fdfbf"/><file name="close.png" hash="0aa9c71e1e00deb929514c3b004e30c2"/><file name="shd-medium.png" hash="ed62cea276345a5003a4a6c6f47c1071"/><file name="spinner.gif" hash="73e57937304d89f251e7e540a24b095a"/></dir></dir></dir><dir name="js"><dir name="digitalpianism"><dir name="ajaxlogin"><file name="script.js" hash="7ff27e041220497c62cd41d47bbdf689"/></dir></dir></dir></dir></dir></dir></target><target name="magelocale"><dir name="fr_FR"><file name="DigitalPianism_AjaxLogin.csv" hash="6eb7c029c2d98c59b574889e8380ccc2"/></dir><dir name="en_US"><file name="DigitalPianism_AjaxLogin.csv" hash="fd8a1490469491f382a9e0463e3de38b"/></dir></target></contents>
29
  <compatible/>
30
+ <dependencies><required><php><min>4.1.0</min><max>7.0.14</max></php></required></dependencies>
31
  </package>
skin/frontend/base/default/js/digitalpianism/ajaxlogin/script.js CHANGED
@@ -1,6 +1,13 @@
1
  /**
2
- * Created by Raph on 10/11/2014.
3
  */
 
 
 
 
 
 
 
4
  AjaxLogin = Class.create();
5
  AjaxLogin.prototype = {
6
  initialize: function(config) {
@@ -332,7 +339,22 @@ AjaxLogin.prototype = {
332
  .setOpacity(0.5);
333
 
334
  new Ajax.Request($('ajaxlogin-login-form').action, {
 
 
 
 
335
  parameters: $('ajaxlogin-login-form').serialize(),
 
 
 
 
 
 
 
 
 
 
 
336
  onSuccess: function(transport) {
337
  var section = $('ajaxlogin-login-form');
338
  if (!section) {
@@ -398,7 +420,22 @@ AjaxLogin.prototype = {
398
  .setOpacity(0.5);
399
 
400
  new Ajax.Request($('ajaxlogin-create-form').action, {
 
 
 
 
401
  parameters: $('ajaxlogin-create-form').serialize(),
 
 
 
 
 
 
 
 
 
 
 
402
  onSuccess: function(transport) {
403
  var section = $('ajaxlogin-create-form');
404
  if (!section) {
@@ -464,7 +501,22 @@ AjaxLogin.prototype = {
464
  .setOpacity(0.5);
465
 
466
  new Ajax.Request($('ajaxlogin-forgot-password-form').action, {
 
 
 
 
467
  parameters: $('ajaxlogin-forgot-password-form').serialize(),
 
 
 
 
 
 
 
 
 
 
 
468
  onSuccess: function(transport) {
469
  var section = $('ajaxlogin-forgot-password-form');
470
  if (!section) {
@@ -559,7 +611,22 @@ AjaxLogin.prototype = {
559
  .setOpacity(0.5);
560
 
561
  new Ajax.Request($('ajaxlogin-logout-form').action, {
 
 
 
 
562
  parameters: $('ajaxlogin-logout-form').serialize(),
 
 
 
 
 
 
 
 
 
 
 
563
  onSuccess: function(transport) {
564
  var section = $('ajaxlogin-logout-form');
565
  if (!section) {
1
  /**
2
+ * Add support for xhrFields to fix CORS
3
  */
4
+ Ajax.Request.prototype.setRequestHeaders = Ajax.Request.prototype.setRequestHeaders.wrap(function(setHeaders) {
5
+ setHeaders();
6
+ if (this.options.xhrFields) {
7
+ Object.extend(this.transport, this.options.xhrFields);
8
+ }
9
+ });
10
+
11
  AjaxLogin = Class.create();
12
  AjaxLogin.prototype = {
13
  initialize: function(config) {
339
  .setOpacity(0.5);
340
 
341
  new Ajax.Request($('ajaxlogin-login-form').action, {
342
+ xhrFields: {
343
+ withCredentials: true
344
+ },
345
+ method: "post",
346
  parameters: $('ajaxlogin-login-form').serialize(),
347
+ onCreate: function(response) {
348
+ var t = response.transport;
349
+ t.setRequestHeader = t.setRequestHeader.wrap(function(original, k, v) {
350
+ if (/^(accept|accept-language|content-language|cookie|access-control-allow-origin|access-control-allow-headers|access-control-allow-credentials)$/i.test(k))
351
+ return original(k, v);
352
+ if (/^content-type$/i.test(k) &&
353
+ /^(application\/x-www-form-urlencoded|multipart\/form-data|text\/plain)(;.+)?$/i.test(v))
354
+ return original(k, v);
355
+ return;
356
+ });
357
+ },
358
  onSuccess: function(transport) {
359
  var section = $('ajaxlogin-login-form');
360
  if (!section) {
420
  .setOpacity(0.5);
421
 
422
  new Ajax.Request($('ajaxlogin-create-form').action, {
423
+ xhrFields: {
424
+ withCredentials: true
425
+ },
426
+ method: "post",
427
  parameters: $('ajaxlogin-create-form').serialize(),
428
+ onCreate: function(response) {
429
+ var t = response.transport;
430
+ t.setRequestHeader = t.setRequestHeader.wrap(function(original, k, v) {
431
+ if (/^(accept|accept-language|content-language|cookie|access-control-allow-origin|access-control-allow-headers|access-control-allow-credentials)$/i.test(k))
432
+ return original(k, v);
433
+ if (/^content-type$/i.test(k) &&
434
+ /^(application\/x-www-form-urlencoded|multipart\/form-data|text\/plain)(;.+)?$/i.test(v))
435
+ return original(k, v);
436
+ return;
437
+ });
438
+ },
439
  onSuccess: function(transport) {
440
  var section = $('ajaxlogin-create-form');
441
  if (!section) {
501
  .setOpacity(0.5);
502
 
503
  new Ajax.Request($('ajaxlogin-forgot-password-form').action, {
504
+ xhrFields: {
505
+ withCredentials: true
506
+ },
507
+ method: "post",
508
  parameters: $('ajaxlogin-forgot-password-form').serialize(),
509
+ onCreate: function(response) {
510
+ var t = response.transport;
511
+ t.setRequestHeader = t.setRequestHeader.wrap(function(original, k, v) {
512
+ if (/^(accept|accept-language|content-language|cookie|access-control-allow-origin|access-control-allow-headers|access-control-allow-credentials)$/i.test(k))
513
+ return original(k, v);
514
+ if (/^content-type$/i.test(k) &&
515
+ /^(application\/x-www-form-urlencoded|multipart\/form-data|text\/plain)(;.+)?$/i.test(v))
516
+ return original(k, v);
517
+ return;
518
+ });
519
+ },
520
  onSuccess: function(transport) {
521
  var section = $('ajaxlogin-forgot-password-form');
522
  if (!section) {
611
  .setOpacity(0.5);
612
 
613
  new Ajax.Request($('ajaxlogin-logout-form').action, {
614
+ xhrFields: {
615
+ withCredentials: true
616
+ },
617
+ method: "post",
618
  parameters: $('ajaxlogin-logout-form').serialize(),
619
+ onCreate: function(response) {
620
+ var t = response.transport;
621
+ t.setRequestHeader = t.setRequestHeader.wrap(function(original, k, v) {
622
+ if (/^(accept|accept-language|content-language|cookie|access-control-allow-origin|access-control-allow-headers|access-control-allow-credentials)$/i.test(k))
623
+ return original(k, v);
624
+ if (/^content-type$/i.test(k) &&
625
+ /^(application\/x-www-form-urlencoded|multipart\/form-data|text\/plain)(;.+)?$/i.test(v))
626
+ return original(k, v);
627
+ return;
628
+ });
629
+ },
630
  onSuccess: function(transport) {
631
  var section = $('ajaxlogin-logout-form');
632
  if (!section) {