Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

We've moved the forum!

Please use forum.silverstripe.org for any new questions (announcement).
The forum archive will stick around, but will be read only.

You can also use our Slack channel or StackOverflow to ask for help.
Check out our community overview for more options to contribute.

All other Modules /

Discuss all other Modules here.

Moderators: martimiz, Sean, Ed, biapar, Willr, Ingo, swaiba

Memberprofiles - Check email field only accept valid email


Go to End


12 Posts   5493 Views

Avatar
ocean

Community Member, 37 Posts

27 February 2014 at 11:28am

This still seems to be an issue today with latest code, an otherwise really nicely done module is more or less useless for real life use because any old nonsense can be typed into the email field and it posts.

Anyone managed to get an answer or solution on this one?

Would love to know!

Thanks
Sean

Avatar
ajshort

Community Member, 244 Posts

27 February 2014 at 3:34pm

I just tested this, and it works fine as expected. You just need to replace the email field with an EmailField rather than a TextField using updateMemberFormFields.

Avatar
ocean

Community Member, 37 Posts

1 March 2014 at 2:25am

Thanks Andrew!

I've updated with the following code and can confirm the JS require valid email is now working.

MemberExtension.php

class MemberExtension extends DataExtension {

public function updateMemberFormFields(FieldList $fields) {
$fields->push(new EmailField('Email', 'Email'));
}

}

_config.php

Object::add_extension('Member', 'MemberExtension');

Avatar
darkan

Community Member, 4 Posts

13 February 2015 at 6:02am

Hello all.
I write here for a problem with MyMemberExtension.

So, i have a file in mysite/code/MyMemberExtension.php

<?php
// mysite/code/MyMemberExtension.php
class MyMemberProfileExtend extends DataExtension {

	private static $db = array(
		'Identifiant' => 'Varchar(30)'
	);

	public function updateMemberFormFields(FieldList $fields) {
		$fields->push(new TextField('Identifiant', 'Identifiant'));
	}
}

All it's Ok. Field is in the class Member.

But when i check validation email, the email is send without any ?key=(empty). In the database TempIDHash , it's empty too.
If i register without MyExtension, all it's good. I have un email with de ?key=19542356716...

Any idear ?
Thanks.

Go to Top