formhandler typo3 feuser double opt in - typo3

I have a user registration form with the extension formhandler and a user is created in the right sysfolder. But the double opt in link which is created and send via e-mail does not work. The user is still hidden. I think that the link does not include the sysfolder with the feuserdata. When I click the link I get the error message: that the authorization code is not found and maybe the authorization has already been done. But that is not true.
plugin.Tx_Formhandler.settings.predef.register {
name = Formhandler User Registration
templateFile = typo3conf/templates/main/plugins/formhandler/register.html
disableWrapInBaseClass = 1
formID = registration
formValuesPrefix = feregistration
isErrorMarker.default = error
isErrorMarker {
global = error
}
preProcessors {
1.class = PreProcessor_LoadGetPost
2.class = PreProcessor_ValidateAuthCode
2.config {
redirectPage = 1045
hiddenField = hidden
selectFields = email
additionalParams = COA
additionalParams {
10 = TEXT
10.value = &pid=1044
}
}
}
finishers {
1.class = Finisher_DB
1.config {
table = fe_users
fields {
pid.postProcessing = 1044
email.mapping = email
username.mapping = email
password.mapping = password
password.special = saltedpassword
password.special.field = password
first_name.mapping = firstname
last_name.mapping = name
address.mapping = streetno
usergroup.ifIsEmpty = 1
disable.ifIsEmpty = 1
}
}
2.class = Finisher_GenerateAuthCode
2.config {
table = fe_users
fields {
pid.postProcessing = 1044
}
selectFields = email
}
3.class = Finisher_DB
3.config {
table = fe_users
updateInsteadOfInsert = 1
fields {
fe_cruser_id.special = inserted_uid
fe_cruser_id.special.table = fe_users
}
}
4.class = Finisher_Mail
4.config {
checkBinaryCrLf = message
admin {
to_email = admin#mail.de
subject = TEXT
subject.dataWrap = Neue Registrierung: {GP:formhandler|firstname} {GP:formhandler|name}
sender_email = email
replyto_email = email
}
user {
to_email = email
to_name = name
subject = Vielen Dank für deine Registrierung
sender_email = user#mail.de
sender_name = user
replyto_email = user#mail.de
replyto_name = user
}
}
5.class = Finisher_SubmittedOK
5.config {
returns = 1
}
}
}
I tried to include the sysfolder pid as an additional parameter but the url does not get this parameter.

In your preProcessor, hiddenField should be disable. This is the name of the field you want to set to 0 if the auth code is validated. You should also ensure there actually is an hidden field in your form named disable and with value 1.

Related

Detail page uid mandatory in Typo3 9.5 seo sitemap for own extension?

I am trying to set up my sitemap in Typo3 9.5 and it worked well for regular pages and news. For my own plugin, I don't want to specify a detail page because the list and detail pages are the same pages. I've tried setting url.pageId = 0 and mapping the pid of myobject to the id in fieldToParameterMap, but the line is ignored (mapping 'foo' works just fine, id is probably not allowed). How can i set the list page pid as the detail page pid?
plugin.tx_seo {
config {
xmlSitemap {
sitemaps {
pages {
provider = TYPO3\CMS\Seo\XmlSitemap\PagesXmlSitemapDataProvider
config {
additionalWhere = AND no_index = 0
}
}
myextension {
provider = TYPO3\CMS\Seo\XmlSitemap\RecordsXmlSitemapDataProvider
config {
table = tx_myextension_domain_model_myobject
sortField = objectname
lastModifiedField = tstamp
additionalWhere = AND (deleted = 0 AND hidden = 0)
pid = 1
recursive = 5
url {
pageId = /*** uid of detail view page expected ***/
fieldToParameterMap {
pid = id
uid = tx_myextension_display[myobject]
}
additionalGetParameters {
tx_myextension_display.controller = Mycontroller
tx_myextension_display.action = show
}
useCacheHash = 1
}
}
}
}
}
}
}
Kind regards,
Moritz

Why user comment is not in email order confirmation html opencart 2?

I noticed that in opencart 2.3.0.2 the order confirmation for admin contains the comments from the user, and the email that the user gets doesn't.
The user gets only the text version with the comment, not the HTML version with the comment.
In 2012 2013 the problem was that the comment wasn't passed at all into the emails.
https://github.com/opencart/opencart/pull/94
https://github.com/opencart-ce/opencart-ce/issues/12
It seems the problem was solved only partially.
The solution is:
Edit:
catalog/model/checkout/order.php
Put this code:
$data['ip'] = $order_info['ip'];
$data['order_status'] = $order_status;
if ($comment && $notify) {
$data['comment'] = nl2br($comment);
} else {
$data['comment'] = '';
}
if ($comment) {
if ($order_info['comment']) {
$data['comment'] = nl2br($comment) . '<br/><br/><strong>Comment:</strong><br/>' . $order_info['comment'];
} else {
$data['comment'] = nl2br($comment);
}
} else {
if ($order_info['comment']) {
$data['comment'] = $order_info['comment'];
} else {
$data['comment'] = '';
}
}
instead of:
$data['ip'] = $order_info['ip'];
$data['order_status'] = $order_status;
if ($comment && $notify) {
$data['comment'] = nl2br($comment);
} else {
$data['comment'] = '';
}
Or you can install this mod https://www.opencart.com/index.php?route=marketplace/extension/info&extension_id=32499&filter_search=add%20comment&filter_category_id=8&filter_license=0

TYPO3 Formhandler Finisher_Mail multiple receivers with to_email + addTolist

I have a formhandler-form and I'm trying to find a good way to send an admin mail to multiple recipients with one mail finisher. The Problem is the recipients are variable. The recipients of the mail depends on the selection of 10 checkboxes in the form. Each selection should have the effect that a new recipient is added. At the moment it's solved with 10 mail finisher like
if {
1 {
conditions {
OR1.AND1 = checkbox_1 = 1
}
isTrue {
finishers.1.config.admin.to_email = p1#mail.com
}
else {
finishers.1.config.admin.disable = 1
}
}
2 {
conditions {
OR1.AND1 = checkbox_2 = 1
}
isTrue {
finishers.2.config.admin.to_email = p2#mail.com
}
else {
finishers.2.config.admin.disable = 1
}
}
...
Is there a better way? I tried to solve this with one finisher and the usage of addToList
if {
1 {
conditions {
OR1.AND1 = checkbox_1 = 1
}
isTrue {
finishers.1.config.admin.to_email := addToList(p1#mail.com)
}
}
2 {
conditions {
OR1.AND1 = checkbox_2 = 1
}
isTrue {
finishers.1.config.admin.to_email := addToList(p2#mail.com)
}
}
...
But it doesn't work. With 4 selected boxes it is still one recipient. Why?
don't forget: typoscript is a configuration language, no programming language.
so you need another logic to build up the multiple receivers.
something like:
:
finishers.1.config.admin.to_email = COA
finishers.1.config.admin.to_email {
10 = TEXT
10.value = p1#mail.com,
10.if.isTrue.data = checkBox_1
20 = TEXT
20.value = p2#mail.com,
20.if.isTrue.data = checkBox_2
30 = TEXT
30.value = p3#mail.com,
30.if.isTrue.data = checkBox_3
stdWrap.substring = 0,-1
}

Apex - Test class adding Chatter Free users

I'm a newbie trying to build a test class for a registration handler that allows new chatter free users to be created for an org. To create the chatter free user, the working trigger checks a new user's email domain against a predefined list of acceptable email domains that are stored in a custom object named DomainList.
Looking for suggestions on how to better structure a test class for code coverage. Any ideas appreciated, thanks!
global class RegHandlerDomain implements Auth.RegistrationHandler {
global User createUser(Id portalId, Auth.UserData data) {
String domain = data.email.split('#')[1];
List<DomainList__c> listedDomains = [SELECT id,
name
FROM DomainList__c
WHERE Email_Domain__c = : domain];
if (listedDomains.size() == 1) {
User u = new User();
Profile p = [SELECT Id
FROM profile WHERE name = 'Chatter Free User'];
// Use incoming email for username
u.username = data.email;
u.email = data.email;
u.lastName = data.lastName;
u.firstName = data.firstName;
u.alias = (data.username != null) ? data.username : data.identifier;
if (u.alias.length() > 8) {
u.alias = u.alias.substring(0, 8);
}
u.languagelocalekey = UserInfo.getLocale();
u.localesidkey = UserInfo.getLocale();
u.emailEncodingKey = 'UTF-8';
u.timeZoneSidKey = 'America/Los_Angeles';
u.profileId = p.Id;
System.debug('Returning new user record for ' + data.username);
return u;
} else return null;
}
global void updateUser(Id userId, Id portalId, Auth.UserData data) {
User u = new User(id = userId);
u.email = data.email;
u.lastName = data.lastName;
u.firstName = data.firstName;
System.debug('Updating user record for ' + data.username);
update(u);
}
}
Test class is looking for a '}' before the insert
#isTest(SeeAllData = true)
public class RegHandlerTest {
public void myTestMethod1() {
//CREATE CHATTER FREE TEST USER
Profile p = [select id
from profile where name = 'Chatter Free User'];
User u1 = new User(alias = 'chfree01',
email = 'chatterfreeuser101#testorg.com',
emailencodingkey = 'UTF-8',
lastname = 'Testing',
companyname = 'testorg',
languagelocalekey = 'en_US',
localesidkey = 'en_US',
profileId = p.Id,
timezonesidkey = 'America/Los_Angeles',
username = 'chatterfreeuser101#testorg.com');
insert u1;
}
//CHECK NEW USER EMAIL DOMAIN TO SEE IF IN CUSTOM OBJECT DOMAINLIST
List<DomainList__c> listedDomains = [select id, email_domain__c
from DomainList__c
where name = 'testorg' LIMIT 1];
if (listedDomains.size() == 1) System.debug('WORKS');
}
Fir of all you need create a proper unit test, because your is not correct.
#isTest(SeeAllData = true)
public class RegHandlerTest {
#isTest private static void verifyInsertChatterFreeUser() {
//CREATE CHATTER FREE TEST USER
Profile p = [SELECT id
FROM profile
WHERE name = 'Chatter Free User'];
User u1 = new User(alias = 'chfree01',
email = 'chatterfreeuser101#testorg.com',
emailencodingkey = 'UTF-8',
lastname = 'Testing',
companyname = 'testorg',
languagelocalekey = 'en_US',
localesidkey = 'en_US',
profileId = p.Id,
timezonesidkey = 'America/Los_Angeles',
username = 'chatterfreeuser101#testorg.com');
insert u1;
// perform some assertions regarding expected state of user after insert
//CHECK NEW USER EMAIL DOMAIN TO SEE IF IN CUSTOM OBJECT DOMAINLIST
List<DomainList__c> listedDomains = [SELECT id, email_domain__c
FROM DomainList__c
WHERE name = 'testorg' LIMIT 1];
// as you've annotated class with SeeAllData=true, this assertion always will be true
System.assertEquals(1, listedDomains.size());
}
#isTest private static void verifyUpdateChatterFreeUser() {
//CREATE CHATTER FREE TEST USER
Profile p = [SELECT id
FROM profile
WHERE name = 'Chatter Free User'];
User u1 = new User(alias = 'chfree01',
email = 'chatterfreeuser101#testorg.com',
emailencodingkey = 'UTF-8',
lastname = 'Testing',
companyname = 'testorg',
languagelocalekey = 'en_US',
localesidkey = 'en_US',
profileId = p.Id,
timezonesidkey = 'America/Los_Angeles',
username = 'chatterfreeuser101#testorg.com');
insert u1;
// perform some assertion regarding expected state of user after insert
// change something on user
u1.email = 'test.chatter.free#gmail.com';
update u1;
// perform some assertions regarding expected state of user after update
// System.assertEquals('expected value', u1.field);
}
}

objectAtIndex in NSDictionary

I am trying to create UITableView from my NSDictionary, but how can I use objectForKey? Convert to NSArray?
I need help.
My dictionary looks like:
**
{
"allow_comments" = 1;
category = 1024194;
"created_at" = "2011-11-17T01:44";
forum = 1005401;
"forum_obj" = {
"created_at" = "2011-09-03 03:04:43.514514";
description = "";
id = 1005401;
name = smartfiction;
shortname = smartfiction;
};
hidden = 0;
id = 474530565;
identifier = (
"2507 http://smartfiction.ru/?p=2507"
);
"num_comments" = 2;
slug = "thread_9714";
title = "\U041e\U0440\U0438\U0444\U043b\U0430\U043c\U043c\U0430. \U042d\U0436\U0435\U043d \U0418\U043e\U043d\U0435\U0441\U043a\U043e";
url = "http://smartfiction.ru/prose/oriflamma/";
}
2011-11-19 10:21:25.992 ARSSReader[3067:15503] id 474530565
2011-11-19 10:21:26.864 ARSSReader[3067:15503] Ответ #2: (
{
author = {
avatar = {
cache = "http://www.gravatar.com/avatar.php?gravatar_id=af6c6f08e213427ad611b00589db00f9&size=32&default=http://mediacdn.disqus.com/1321567697/images/noavatar32.png";
permalink = "http://www.gravatar.com/avatar.php?gravatar_id=af6c6f08e213427ad611b00589db00f9&size=32&default=http://mediacdn.disqus.com/1321567697/images/noavatar32.png";
};
emailHash = af6c6f08e213427ad611b00589db00f9;
isAnonymous = 1;
name = "S Shv";
profileUrl = "http://disqus.com/guest/af6c6f08e213427ad611b00589db00f9/";
url = "";
};
createdAt = "2011-11-17T22:39:36";
dislikes = 0;
forum = smartfiction;
id = 367003621;
isApproved = 1;
isDeleted = 0;
isEdited = 0;
isFlagged = 0;
isHighlighted = 0;
isJuliaFlagged = 1;
isSpam = 0;
likes = 0;
media = (
);
message = "\U043f\U043e\U0440\U0430\U0437\U0438\U043b\U043e )";
parent = "<null>";
points = 0;
"raw_message" = "\U043f\U043e\U0440\U0430\U0437\U0438\U043b\U043e )";
thread = 474530565;
},
{
author = {
avatar = {
cache = "http://www.gravatar.com/avatar.php?gravatar_id=c1c53088e04a60aab74cd1f149117e69&size=32&default=http://mediacdn.disqus.com/1321567697/images/noavatar32.png";
permalink = "http://www.gravatar.com/avatar.php?gravatar_id=c1c53088e04a60aab74cd1f149117e69&size=32&default=http://mediacdn.disqus.com/1321567697/images/noavatar32.png";
};
emailHash = c1c53088e04a60aab74cd1f149117e69;
isAnonymous = 1;
name = "3,14";
profileUrl = "http://disqus.com/guest/c1c53088e04a60aab74cd1f149117e69/";
url = "";
};
createdAt = "2011-11-17T02:52:46";
dislikes = 0;
forum = smartfiction;
id = 365544459;
isApproved = 1;
isDeleted = 0;
isEdited = 0;
isFlagged = 0;
isHighlighted = 0;
isJuliaFlagged = 1;
isSpam = 0;
likes = 1;
media = (
);
message = "\U0427\U0438\U0442\U0430\U0442\U044c \U043d\U0430 \U043d\U043e\U0447\U044c \U043f\U0440\U043e\U043a\U0440\U0430\U0441\U0442\U0438\U043d\U0430\U0442\U043e\U0440\U0430\U043c. \U0412\U043f\U0440\U043e\U0447\U0435\U043c, \U043b\U0443\U0447\U0448\U0435 \U0443\U0442\U0440\U043e\U043c.";
parent = "<null>";
points = 1;
"raw_message" = "\U0427\U0438\U0442\U0430\U0442\U044c \U043d\U0430 \U043d\U043e\U0447\U044c \U043f\U0440\U043e\U043a\U0440\U0430\U0441\U0442\U0438\U043d\U0430\U0442\U043e\U0440\U0430\U043c. \U0412\U043f\U0440\U043e\U0447\U0435\U043c, \U043b\U0443\U0447\U0448\U0435 \U0443\U0442\U0440\U043e\U043c.";
thread = 474530565;
}
)
**
It is comments from disqus.com. I want to create dictionaries for all comments and use them to create UITableView cells.
Instead of storing the comments from disqus.com in a dictionary, store each comment in an entry inside an array (it looks like each comment has a block of text you can encapsulate into an object which you can store into an array).
Dictionaries are good for associating values with keys.
Arrays are great for storing lists of objects, much like a list of comments from a disqus site.