Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
A
authorizenetwebform
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Custom Issue Tracker
Custom Issue Tracker
Labels
Merge Requests
0
Merge Requests
0
Requirements
Requirements
List
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Analytics
Analytics
Code Review
Insights
Issue
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
project
authorizenetwebform
Commits
0c45be46
Commit
0c45be46
authored
Nov 25, 2018
by
jenlampton
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Prevent CC data from ever touching the server.
parent
13176d7e
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
14 additions
and
19 deletions
+14
-19
authorizenetwebform.module
authorizenetwebform.module
+3
-19
js/authorizenetwebform.js
js/authorizenetwebform.js
+11
-0
No files found.
authorizenetwebform.module
View file @
0c45be46
...
...
@@ -148,6 +148,7 @@ function authorizenetwebform_form_webform_client_form_alter(&$form, &$form_state
'apiLoginID'
=>
variable_get
(
'authorizenetwebform_login'
,
NULL
),
'clientKey'
=>
variable_get
(
'authorizenetwebform_client_key'
,
NULL
),
'mapping'
=>
array
(),
'sensitive'
=>
array
(),
);
// Add Accept.js data attributes to each mapped field.
...
...
@@ -173,26 +174,9 @@ function authorizenetwebform_form_webform_client_form_alter(&$form, &$form_state
'type'
=>
'setting'
);
// Validate handler.
$form
[
'#validate'
][]
=
'authorizenetwebform_validate'
;
// Note: removing name attribute will prevent values from posting to the server.
// Submit handler. Adding it here the *second* submit handler.
$first
=
array_shift
(
$form
[
'#submit'
]);
array_unshift
(
$form
[
'#submit'
],
$first
,
'authorizenetwebform_submit'
);
}
/**
* Webform validation handler.
*
* @see authorizenetwebform_form_webform_client_form_alter().
*/
function
authorizenetwebform_validate
(
$form
,
&
$form_state
)
{
_authorizenetwebform_sanitize
(
$form_state
[
'values'
][
'submitted'
]);
dpm
(
'form values submitted'
);
dpm
(
$form_state
[
'values'
][
'submitted'
]);
array_unshift
(
$form
[
'#submit'
],
$first
,
'authorizenetwebform_webform_client_form_submit'
);
}
/**
...
...
@@ -200,7 +184,7 @@ function authorizenetwebform_validate($form, &$form_state) {
*
* @see authorizenetwebform_form_webform_client_form_alter().
*/
function
authorizenetwebform_submit
(
$form
,
&
$form_state
)
{
function
authorizenetwebform_
webform_client_form_
submit
(
$form
,
&
$form_state
)
{
// Do nothing if there are errors.
if
(
form_get_errors
())
{
return
$form_state
;
...
...
js/authorizenetwebform.js
View file @
0c45be46
...
...
@@ -114,6 +114,17 @@
// Insert the data value into the hidden Transaction ID field.
$
(
context
).
find
(
"
[data-authnet-field--transaction_id]
"
).
val
(
responseData
.
dataValue
);
// Remove the name attributes to prevent values from touching the server.
var
sensitive
=
[
'
cardNumber
'
,
'
cardCode
'
,
'
month
'
,
'
year
'
];
for
(
var
key
in
Drupal
.
settings
.
authorizeNetWebform
.
mapping
)
{
if
(
jQuery
.
inArray
(
key
,
sensitive
)
!==
-
1
)
{
var
attribute
=
Drupal
.
settings
.
authorizeNetWebform
.
mapping
[
key
];
if
(
$webform
.
find
(
"
[
"
+
attribute
+
"
]
"
))
{
$webform
.
find
(
"
[
"
+
attribute
+
"
]
"
).
removeAttr
(
'
name
'
);
}
}
}
// Submit the webform when done.
$
(
context
).
find
(
"
[data-authnet-form]
"
).
submit
();
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment