-
-
Notifications
You must be signed in to change notification settings - Fork 3.7k
Finally com_mailto allow the usage of a captcha by using JForm #20265
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 2 commits
Commits
Show all changes
16 commits
Select commit
Hold shift + click to select a range
d7a65b7
finaly com_mailto allow the usage of a captach by using JForm
zero-24 ff5c6ef
remove unused $session variable
zero-24 f69e1a7
Line ending to LF
zero-24 9e04eb5
fix typo thanks @brianteeman
zero-24 9f17807
no need to use set and get thanks @mbabker
zero-24 54c2ecd
expend the popup & fix the auto population thanks @quy
zero-24 8ad322f
captcha handling
zero-24 728dd9a
fix the captcha check
zero-24 1bf0b7a
commit header check thanks for reporting @brianteeman @mbabaker and f…
zero-24 6822e69
style changes affected hight thanks @brianteeman
zero-24 5257561
line ending again
zero-24 9667db1
close <fieldset> thanks @quy
zero-24 0198123
make the iframe a bit bigger thnks @quy
zero-24 a43a17d
commit proposed changes by @quy
zero-24 65b0c3b
implement suggested improvments
zero-24 7e70b61
use <?php echo $field->renderField(); ?> thanks @laoneo
zero-24 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,51 @@ | ||
| <?xml version="1.0" encoding="utf-8" ?> | ||
| <form> | ||
| <fieldset name="default"> | ||
| <field | ||
| name="emailto" | ||
| type="email" | ||
| label="COM_MAILTO_EMAIL_TO" | ||
| filter="string" | ||
| required="true" | ||
| size="30" | ||
| validate="email" | ||
| autocomplete="email" | ||
| /> | ||
|
|
||
| <field | ||
| name="sender" | ||
| type="text" | ||
| label="COM_MAILTO_SENDER" | ||
| filter="string" | ||
| required="true" | ||
| size="30" | ||
| /> | ||
|
|
||
| <field | ||
| name="emailfrom" | ||
| type="email" | ||
| label="COM_MAILTO_YOUR_EMAIL" | ||
| filter="string" | ||
| required="true" | ||
| size="30" | ||
| validate="email" | ||
| autocomplete="email" | ||
| /> | ||
|
|
||
| <field | ||
| name="subject" | ||
| type="text" | ||
| label="COM_MAILTO_SUBJECT" | ||
| filter="string" | ||
| required="true" | ||
| size="30" | ||
| /> | ||
|
|
||
| <field | ||
| name="captcha" | ||
| type="captcha" | ||
| label="COM_MAILTO_CAPTCHA" | ||
| validate="captcha" | ||
| /> | ||
| </fieldset> | ||
| </form> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,107 @@ | ||
| <?php | ||
| /** | ||
| * @package Joomla.Site | ||
| * @subpackage com_users | ||
| * | ||
| * @copyright Copyright (C) 2005 - 2018 Open Source Matters, Inc. All rights reserved. | ||
| * @license GNU General Public License version 2 or later; see LICENSE.txt | ||
| */ | ||
|
|
||
| defined('_JEXEC') or die; | ||
|
|
||
| /** | ||
| * Mailto model class. | ||
| * | ||
| * @since __DEPLOY_VERSION__ | ||
| */ | ||
| class MailtoModelMailto extends JModelForm | ||
| { | ||
| /** | ||
| * Method to get the mailto form. | ||
| * | ||
| * The base form is loaded from XML and then an event is fired | ||
| * for users plugins to extend the form with extra fields. | ||
| * | ||
| * @param array $data An optional array of data for the form to interogate. | ||
| * @param boolean $loadData True if the form is to load its own data (default case), false if not. | ||
| * | ||
| * @return JForm A JForm object on success, false on failure | ||
| * | ||
| * @since __DEPLOY_VERSION__ | ||
| */ | ||
| public function getForm($data = array(), $loadData = true) | ||
| { | ||
| // Get the form. | ||
| $form = $this->loadForm('com_mailto.mailto', 'mailto', array('load_data' => $loadData)); | ||
|
|
||
| if (empty($form)) | ||
| { | ||
| return false; | ||
| } | ||
|
|
||
| return $form; | ||
| } | ||
|
|
||
| /** | ||
| * Method to get the data that should be injected in the form. | ||
| * | ||
| * @return array The default data is an empty array. | ||
| * | ||
| * @since __DEPLOY_VERSION__ | ||
| */ | ||
| protected function loadFormData() | ||
| { | ||
| $user = JFactory::getUser(); | ||
| $app = JFactory::getApplication(); | ||
| $data = array(); | ||
|
|
||
| $data = $app->getUserState('mailto.mailto.form.data', array()); | ||
|
|
||
| $data['link'] = urldecode($app->input->get('link', '', 'BASE64')); | ||
|
|
||
| if ($data['link'] == '') | ||
| { | ||
| JError::raiseError(403, JText::_('COM_MAILTO_LINK_IS_MISSING')); | ||
|
|
||
| return false; | ||
| } | ||
|
|
||
| // Load with previous data, if it exists | ||
| $data['sender'] = $app->input->post->getString('sender', ''); | ||
| $data['subject'] = $app->input->post->getString('subject', ''); | ||
| $data['from'] = JStringPunycode::emailToPunycode($app->input->post->getString('from', '')); | ||
| $data['mailto'] = JStringPunycode::emailToPunycode($app->input->post->getString('mailto', '')); | ||
|
|
||
| if (!$user->guest) | ||
| { | ||
| $data['sender'] = $user->name; | ||
| $data['from'] = $user->email; | ||
| } | ||
|
|
||
| $app->setUserState('mailto.mailto.form.data', $data); | ||
|
|
||
| $this->preprocessData('com_mailto.mailto', $data); | ||
|
|
||
| return $data; | ||
| } | ||
|
|
||
| /** | ||
| * Get the request data | ||
| * | ||
| * @return array The requested data | ||
| * | ||
| * @since __DEPLOY_VERSION__ | ||
| */ | ||
| public function getData() | ||
| { | ||
| $input = JFactory::getApplication()->input; | ||
|
|
||
| $data['emailto'] = $input->get('emailto', '', 'string'); | ||
| $data['sender'] = $input->get('sender', '', 'string'); | ||
| $data['emailfrom'] = $input->get('emailfrom', '', 'string'); | ||
| $data['subject'] = $input->get('subject', '', 'string'); | ||
| $data['captcha'] = $input->get('captcha', '', 'string'); | ||
|
|
||
| return $data; | ||
| } | ||
| } | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
interrogate
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed thanks.