TYPO3 formhandler update-table in finisher_db without uid? - typo3

I'm using TYPO3 6.2.x with fe-login and formhandler. I created a form, where you can register a new fe-user.
I want to have a 'complete user registration' for,m where the user inputs the username the password and a doi-code for verification.
I thought if formhandler has a finisher-db supporting saltedpassword, it has to have a validator (database -> equalsField -> saltedpassword) as well. But I can't find any.
Something like:
validators {
1.class = Validator_Default
1.config {
fieldConf {
password.errorCheck {
1 = required
2 = saltedpassword <-- does not exist
3 = isInDBTable
3 {
table = fe_users
field = password
#or maybe: special = password ?
showHidden = 1
}
}
}
}
}
So I need help here, please.
//Update 2015-08-31
I got rid of the password field in the formhandler to seperate finish-registration and login as #Jost mentioned.
Now I have a more sincere problem:
I now have a formhandler form where the user is asked to input his email-address and the doi-code. I wanted to use the finisher_db for updating the user in the db. But the update of formhandler-finisher requires the uid of the element to update. Of course I don't have the uid at this state. Is there another way to use the native formhandler finishers?
If not, can someone please give me a heads up of how to write your own finisher for this purpose?

Related

TYPO3 direct_mail_subscription Double-Opt-In-Out not activ

I am using extension direct_mail and direct_mail_subscription for newsletter. In the settings it is clear that i should first confirm the address, so the adress should be in the database as hidden.
// Create setup
create = 1
create {
userFunc_afterSave = EXT:direct_mail_subscription/pi/class.dmailsubscribe.php:user_dmailsubscribe->saveRecord
preview = 0
// add captcha, if you use captcha
fields = gender, name, hidden, email, module_sys_dmail_category, module_sys_dmail_html
required = gender, name, email
noSpecialLoginForm = 1
# Initially hide the user until he approves!
overrideValues.hidden = 1
evalValues.email = uniqueLocal, email
}
so the field hidden in the database should be in the begining 1, however, all data are set to 0 without confirming the address.
Typo3 Version 8.7.2. What should the reason be? Do you have an idea?
Make sure that you have included the static TypoScript template in your own TypoScript template:
You can verify that it is included in the TypoScript Object Browser:

Typo3 Powermail form - Send Page UID to receiver

I've created a small application form for my website. Everything works fine.
In the plugin settings there is a field called "Bodytext for Email to Receiver". This is the the mail I get, everytime somebody fills out an application form. It looks like this right now:
New application arrived!
{powermail_all}
Is it possible to get the Page UID from the application form into a variable to put it in there?
The only solutions I've found need TypoScript. Is there any other way?
The solution with typoscript should be (according to manual):
use in template:
{f:cObject(typoscriptObjectPath:'lib.pageuid')}
define the typoscript:
lib.pageuid = TEXT
lib.pageuid.data = page:uid
I'm not sure about an additional variable for {powermail_all} as I'm not familiar with the extension.
If I understand the manual correctly this might be possible with :
plugin.tx_powermail {
settings {
setup {
manipulateVariablesInPowermailAllMarker {
// possible sections (define for each, where you need it):
// confirmationPage, submitPage, receiverMail, senderMail, optinMail
submitPage {
pageUid = TEXT
pageUid.data = page:uid
}
senderMail {
pageUid = TEXT
pageUid.data = page:uid
}
}
}
}
}

Add formhandler field data to subject

My goal is to have the Formhandler log UID inside the Admin emails subject.
Inside of my email template I'm using
###value_tx_formhandler_log_inserted_uid### to insert a unique id.
I need to get this value into my Admin emails subject. E.g.
"Order ID: ###value_tx_formhandler_log_inserted_uid###"
I've read various forum posts, each do something different and I ended up with this snippet:
plugin.Tx_Formhandler.settings.predef.form {
# TEMPLATE MARKERS
name = Form1
templateFile = typo3template/typo3/ext/formhandler/form1/default.html
markers {
name = TEXT
name.value = Form1
}
finishers {
1.config {
class = Tx_Formhandler_Finisher_Mail
subject = TEXT
subject.value = ###GP:tx_formhandler_log_inserted_uid###
}
}
[...]
which just yields "{$formhandler.admin.subject}" as the subject.
I also tried other variations like
###LLL:tx_formhandler_log_inserted_uid### or tx_formhandler_log_inserted_uid
The backend field "subject" is empty.
Pasting the HTML placeholder into the backend field didn't work either.
I can't get this to work.
In what way can you access the id you want to insert?
From the notation GP:tx_formhandler_log_inserted_uid I would assume a GET/POST value.
For using this value in typoscript you need to do it like this (or similar: dataWrap):
subject = TEXT
subject.data = GP:tx_formhandler_log_inserted_uid
subject.noTrimWrap = |Order ID: ||
The notation LLL:tx_formhandler_log_inserted_uid would be a language specific text (you would also insert by .data) but it would be a static text for each language.
After a lot of trial and error, I got it working.
First of all, I forgot to specify that I want to configure the admin mail.
Adding admin { fixed the problem of getting only {$formhandler.admin.subject}.
The UID value itself can be accessed with GP:formhandler|tx_formhandler_log_inserted_uid
I combined that with the noTrimWrap as suggested by #bernd-wilke-πφ
The final snippet looks like this:
finishers {
1 {
class = Tx_Formhandler_Finisher_Mail
config {
admin {
subject = TEXT
subject.data = GP:formhandler|tx_formhandler_log_inserted_uid
subject.noTrimWrap = |Order number: ||
}
}
}
}

Use tt_address fields in direct_mail newsletter

I am using TYPO3 6.2.11, tt_address 2.3.5 and direct_mail 4.0.1 and sent me some test newsletters from a internal TYPO3-Page. Everything works fine.
Now, I want to send some data fields from my tt_address-table like name or title for example.
What's the name of the tt_address-MARKER, I'll use at my page content?
I also add the follwing to [basic.addRecipFields] at the direct_mail-Extension:
name,first_name,last_name,email,description,title
But nothing happens. I can't use tt_address-fields at my direct_mail newsletter. I hope someone can help me, thanks.
The other opportunity is to use fe_user-data for my newsletter (felogin). How can I use felogin-fields like passwordor username at my template?
You need to prefix the fields with USER_ and wrap the marker in ###. So e.g. if you'd like to use the e-mail address, you write ###USER_email###. You can find all possibilities in the Direct Mail documentation.
A note on sending the password: This would be a huge security risk but it's not possible anyway because passwords of fe_users are stored at least hashed (and nowadays also encrypted) in the database. But you can use the ###SYS_AUTHCODE### marker to generate an authentication code you can use in an "edit profile" extension to let the user update his subscription.
If you need fields from other sources or data you're calculating dynamically, you can also create an own extension and implement the Direct Mail mailMarkersHook.
ext_localconf.php:
// Direct Mail personalization hook
$GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['ext/direct_mail']['res/scripts/class.dmailer.php']['mailMarkersHook']['userunilunewsletterrendering'] =
'My\Extension\Hook\DirectMail->mailMarkersHook';
EXT:extension/Classes/Hook/DirectMail.php:
<?php
namespace My\Extension\Hook;
class DirectMail {
public function mailMarkersHook($params, \DirectMailTeam\DirectMail\Dmailer $dmailer) {
$params['markers']['###USER_SALUTATION###'] = $this->getPersonalizedSalutation($params['row']);
return $params;
}
/**
* #param $row
* #return string
*/
protected function getPersonalizedSalutation($row) {
$personalizedSalutation = 'Dear Sir or Madam';
if (!empty($row['last_name']) && !empty($row['gender'])) {
if ($row['gender'] === 'm') {
$personalizedSalutation = 'Dear Mr. ' . $row['last_name'];
} elseif ($row['gender'] === 'f') {
$personalizedSalutation = 'Dear Ms. ' . $row['last_name'];
}
}
return $personalizedSalutation;
}
}

On a HTML Edit form, what is a good approach to have both reset and remember the posted values features?

I have a form which has both server side and client side validation.
It is an edit form, so the original user values are originally pre-populated.
e.g. The original pre-populated values are:
username = yeo
surname = yang
phonenumber = 11-12345
Now, the user edits to the below and submits.
e.g. The edited submitted values are:
username = yeoNew
surname = yangNew
phonenumber = 12-1111
This gets submitted to the serverside and fails the serverside validation because the phonenumber starting with 12 is not allowed.
Anyway, so the form is displayed back to the user as
e.g. The redisplayed form values are:
username = yeoNew
surname = yangNew
phonenumber = 12-1111
This is because my form allows the user to remember their submitted values.
At this stage, I'd like to allow the user to have the ability to reset the form values to the original values using clientside javascript. This is like a reset feature.
e.g. The reset button will restore the form values to:
username = yeo
surname = yang
phonenumber = 11-12345
The reason for this reset feature is that I want the user to have the option to edit the phonenumber again from the original values.
My question is:
What is a good way to keep track of the original values within the HTML so that I can restore it with javascript?
I'm thinking a new attribute called orig='' within the form elements which will store this value.
Is that a good idea?
Any other approaches?
thanks
I would use the HTML5 local storage.
See http://www.w3schools.com/html/html5_webstorage.asp
Using jquery I would do it this way:
<script type="text/javascript">
function load() {
if (localStorage["username"]) {
$('#username').val(localStorage["username"]);
}
if (localStorage["surname"]) {
$('#surname').val(localStorage["surname"]);
}
if (localStorage["phone"]) {
$('#phone').val(localStorage["phone"]);
}
}
function save() {
localStorage["username"] = $('#username ').val();
localStorage["surname"] = $('#surname').val();
localStorage["phone"] = $('#phone').val();
}
</script>