Re: Weird Validation Question

2010-03-24 Thread WebbedIT
> I agree 2 emails is confusing.

Then you should rethink your choice, it's not just confusing but
limiting as anyone with only one email will not be able to use your
site.

> My problem is the users Profile email has to
> be visible in my setup as its how to contact the person so no option to hide
> it.

Emails do not need to be publicly viewable for admins to see them.
Admins have access to view anything and that is protected by the fact
that only admin users can see admin content.

> But since its published I don’t want that email to be the same login
> email since people can easily copy the Profile email, click forgot password
> and send off and email to the actual user.

I would vote for never publishing the user's email as those who are
concerned about receiving spam will not agree to use a site where
there email is available for all to see.

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en

To unsubscribe from this group, send email to 
cake-php+unsubscribegooglegroups.com or reply to this email with the words 
"REMOVE ME" as the subject.


Re: Weird Validation Question

2010-03-23 Thread cricket
On Mar 23, 12:26 pm, "Dave"  wrote:
> I agree 2 emails is confusing. My problem is the users Profile email has to
> be visible in my setup as its how to contact the person so no option to hide
> it.

In the admin views, don't even bother checking the display_email
field. It'll only be admins who see it.

> But since its published I don’t want that email to be the same login
> email since people can easily copy the Profile email, click forgot password
> and send off and email to the actual user. Sure nothing will happen since it
> wont go to anyone but the user but that might be annoying or scary for the
> user who sees people trying to access their account. Make sense?

I usually put something along the lines of, "If you did not request a
new password please contact us." at the bottom of my "new_password"
view.

> So User
> email is login / forget  password / or for any site to acct holder contact.
> Profile email is public, no option to hide but different than User.

I smell user confusion. And with a setup like that, you're forcing the
user to reveal at least one email address.

Besides, I have enough trouble ensuring that all users have even a
single email address. That may not be an issue with this app but I've
developed several sites with a userbase that includes some people that
aren't particularly up to speed on the online thing.

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en

To unsubscribe from this group, send email to 
cake-php+unsubscribegooglegroups.com or reply to this email with the words 
"REMOVE ME" as the subject.


RE: Weird Validation Question

2010-03-23 Thread Dave
I agree 2 emails is confusing. My problem is the users Profile email has to
be visible in my setup as its how to contact the person so no option to hide
it. But since its published I don’t want that email to be the same login
email since people can easily copy the Profile email, click forgot password
and send off and email to the actual user. Sure nothing will happen since it
wont go to anyone but the user but that might be annoying or scary for the
user who sees people trying to access their account. Make sense? So User
email is login / forget  password / or for any site to acct holder contact.
Profile email is public, no option to hide but different than User.

I was also thinking just drop an extra field in User table and set primary
or secondary emails and just pull 1 for the profile and one for user only. I
thnk that’s  better idea, yes no? Easier to compare if same that way and
since User <-> Profile are related its no big issue to pull the data at any
point

Dave

-Original Message-
From: cake-php@googlegroups.com [mailto:cake-...@googlegroups.com] On Behalf
Of cricket
Sent: March-23-10 12:39 AM
To: CakePHP
Subject: Re: Weird Validation Question

Use a single email address in users table and add a display_email field in
Profile to allow the users to specify whether it will be displayed publicly.
Having 2 email fields will only confuse people.

On Mar 22, 2:21 pm, "Dave"  wrote:
> User hasOne Profile belongsTo User
> But I think im just going to put 2 email fields in the user table and 
> just do it that way rather than 1  in user and 1 in profile.
>
> Thanks for your suggestions guys.
>
> dave
>
> -Original Message-
> From: cake-php@googlegroups.com [mailto:cake-...@googlegroups.com] On 
> Behalf
>
> Of John Andersen
> Sent: March-22-10 4:33 AM
> To: CakePHP
> Subject: Re: Weird Validation Question
>
> Are your User and Profile models not associated/related to each other
> - User hasOne/belongsTo Profile?
> If you have that relationship, then just query for the Profile with 
> user_id equal the Auth->user('id') :) Enjoy,
>    John
>
> On Mar 22, 2:39 am, "Dave"  wrote:
> > This might be odd but i have user email and profile email.
> > User email is not published on the site (used for account, login, 
> > forgot stuff like that) profile email is published on the site so 
> > for security i figured that its best to use a separate email.
>
> > So when a user wants to edit either of the emails i need to make 
> > sure they are not the same so both cant be myn...@somewhere.com.
>
> > How would i validate 1 field based on 2 different models using
> > Auth->id since the email is directly related to the logged in user?
>
> > I figured query the opposite table to see if this users email is the 
> > same as this profile email (or vice versa depending onwhichis being
> > changed) but how do i use the auth id in this?
>
> > validation rule:
> > array(
> >     'rule' => array('notSameAsUser', 'email'),
> >     'message' => 'Your public email address can not be the same as 
> > your account email.',
> >     'last' => true)
>
> > function:
>
> > function notSameAsUser( $data ) {
>
> >   $valid = false;
>
> >   $params = array(
> >    'conditions' => array('Profile.id' => $id),//how do i get the id 
> > from Auth in the model?
> >    'fields' => array('User.email')
> >    'contain' => array(
> >     'User' => array(
> >      'fields' => array(
> >       'User.email';
>
> >   $data $this->find('first', $params);
>
> >         if (  $data['User']['email'] !=  $data['Profile']['email'] ) 
> > {
> >                 $valid = true;
>
> >         }
>
> >         return $valid;
>
> > }
>
> > Dave
>
> Check out the new CakePHP Questions sitehttp://cakeqs.organd help 
> others with their CakePHP related questions.
>
> You received this message because you are subscribed to the Google 
> Groups "CakePHP" group.
> To post to this group, send email to cake-php@googlegroups.com To 
> unsubscribe from this group, send email to
> cake-php+unsubscr...@googlegroups.com For more options, visit this 
> cake-php+group athttp://groups.google.com/group/cake-php?hl=en
>
> To unsubscribe from this group, send email to
> cake-php+unsubscribegooglegroups.com or reply to this email with the 
> cake-php+words
> "REMOVE ME" as the subject.
>
>

Check out the new CakePHP Qu

Re: Weird Validation Question

2010-03-23 Thread WebbedIT
I agree with cricket as it's more likely a person will have one email
address and will chose to make it public or not.  In the site I am
currently designing I am allowing messages to be sent through the site
so no-one gets to see other members emails.  But each member can chose
to display their email address.

But then again I also allow each member to add multiple online
addresses, postal addresses, telephony numbers and each have their own
model.

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en

To unsubscribe from this group, send email to 
cake-php+unsubscribegooglegroups.com or reply to this email with the words 
"REMOVE ME" as the subject.


Re: Weird Validation Question

2010-03-22 Thread cricket
Use a single email address in users table and add a display_email
field in Profile to allow the users to specify whether it will be
displayed publicly. Having 2 email fields will only confuse people.

On Mar 22, 2:21 pm, "Dave"  wrote:
> User hasOne Profile belongsTo User
> But I think im just going to put 2 email fields in the user table and just
> do it that way rather than 1  in user and 1 in profile.
>
> Thanks for your suggestions guys.
>
> dave
>
> -Original Message-
> From: cake-php@googlegroups.com [mailto:cake-...@googlegroups.com] On Behalf
>
> Of John Andersen
> Sent: March-22-10 4:33 AM
> To: CakePHP
> Subject: Re: Weird Validation Question
>
> Are your User and Profile models not associated/related to each other
> - User hasOne/belongsTo Profile?
> If you have that relationship, then just query for the Profile with user_id
> equal the Auth->user('id') :) Enjoy,
>    John
>
> On Mar 22, 2:39 am, "Dave"  wrote:
> > This might be odd but i have user email and profile email.
> > User email is not published on the site (used for account, login,
> > forgot stuff like that) profile email is published on the site so for
> > security i figured that its best to use a separate email.
>
> > So when a user wants to edit either of the emails i need to make sure
> > they are not the same so both cant be myn...@somewhere.com.
>
> > How would i validate 1 field based on 2 different models using
> > Auth->id since the email is directly related to the logged in user?
>
> > I figured query the opposite table to see if this users email is the
> > same as this profile email (or vice versa depending onwhichis being
> > changed) but how do i use the auth id in this?
>
> > validation rule:
> > array(
> >     'rule' => array('notSameAsUser', 'email'),
> >     'message' => 'Your public email address can not be the same as
> > your account email.',
> >     'last' => true)
>
> > function:
>
> > function notSameAsUser( $data ) {
>
> >   $valid = false;
>
> >   $params = array(
> >    'conditions' => array('Profile.id' => $id),//how do i get the id
> > from Auth in the model?
> >    'fields' => array('User.email')
> >    'contain' => array(
> >     'User' => array(
> >      'fields' => array(
> >       'User.email';
>
> >   $data $this->find('first', $params);
>
> >         if (  $data['User']['email'] !=  $data['Profile']['email'] ) {
> >                 $valid = true;
>
> >         }
>
> >         return $valid;
>
> > }
>
> > Dave
>
> Check out the new CakePHP Questions sitehttp://cakeqs.organd help others
> with their CakePHP related questions.
>
> You received this message because you are subscribed to the Google Groups
> "CakePHP" group.
> To post to this group, send email to cake-php@googlegroups.com To
> unsubscribe from this group, send email to
> cake-php+unsubscr...@googlegroups.com For more options, visit this group
> cake-php+athttp://groups.google.com/group/cake-php?hl=en
>
> To unsubscribe from this group, send email to
> cake-php+unsubscribegooglegroups.com or reply to this email with the words
> "REMOVE ME" as the subject.
>
>

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en

To unsubscribe from this group, send email to 
cake-php+unsubscribegooglegroups.com or reply to this email with the words 
"REMOVE ME" as the subject.


RE: Weird Validation Question

2010-03-22 Thread Dave
User hasOne Profile belongsTo User 
But I think im just going to put 2 email fields in the user table and just
do it that way rather than 1  in user and 1 in profile.

Thanks for your suggestions guys.

dave



-Original Message-
From: cake-php@googlegroups.com [mailto:cake-...@googlegroups.com] On Behalf
Of John Andersen
Sent: March-22-10 4:33 AM
To: CakePHP
Subject: Re: Weird Validation Question

Are your User and Profile models not associated/related to each other
- User hasOne/belongsTo Profile?
If you have that relationship, then just query for the Profile with user_id
equal the Auth->user('id') :) Enjoy,
   John

On Mar 22, 2:39 am, "Dave"  wrote:
> This might be odd but i have user email and profile email.
> User email is not published on the site (used for account, login, 
> forgot stuff like that) profile email is published on the site so for 
> security i figured that its best to use a separate email.
>
> So when a user wants to edit either of the emails i need to make sure 
> they are not the same so both cant be myn...@somewhere.com.
>
> How would i validate 1 field based on 2 different models using 
> Auth->id since the email is directly related to the logged in user?
>
> I figured query the opposite table to see if this users email is the 
> same as this profile email (or vice versa depending onwhichis being 
> changed) but how do i use the auth id in this?
>
> validation rule:
> array(
>     'rule' => array('notSameAsUser', 'email'),
>     'message' => 'Your public email address can not be the same as 
> your account email.',
>     'last' => true)
>
> function:
>
> function notSameAsUser( $data ) {
>
>   $valid = false;
>
>   $params = array(
>    'conditions' => array('Profile.id' => $id),//how do i get the id 
> from Auth in the model?
>    'fields' => array('User.email')
>    'contain' => array(
>     'User' => array(
>      'fields' => array(
>       'User.email';
>
>   $data $this->find('first', $params);
>
>         if (  $data['User']['email'] !=  $data['Profile']['email'] ) {
>                 $valid = true;
>
>         }
>
>         return $valid;
>
> }
>
> Dave

Check out the new CakePHP Questions site http://cakeqs.org and help others
with their CakePHP related questions.

You received this message because you are subscribed to the Google Groups
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com To
unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group 
cake-php+at http://groups.google.com/group/cake-php?hl=en

To unsubscribe from this group, send email to
cake-php+unsubscribegooglegroups.com or reply to this email with the words
"REMOVE ME" as the subject.

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en

To unsubscribe from this group, send email to 
cake-php+unsubscribegooglegroups.com or reply to this email with the words 
"REMOVE ME" as the subject.


Re: Weird Validation Question

2010-03-22 Thread WebbedIT
Are you not allowing the person to update their user and profile
details at the same time?  If you were both values would be in the
data array to be compared.

If you're not then you must be including the user's id in the data
array either by a hidden field in the form or by setting it before
save/validate in the controller otherwise it will not update an
existing record.  In this case you have the user's id in the data
array to run a find for the other email.

If you want to retrieve Auth information in your models then I suggest
you have a read of this blog post:
http://www.pseudocoder.com/archives/2008/10/06/accessing-user-sessions-from-models-or-anywhere-in-cakephp-revealed/

HTH

Paul

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en

To unsubscribe from this group, send email to 
cake-php+unsubscribegooglegroups.com or reply to this email with the words 
"REMOVE ME" as the subject.


Re: Weird Validation Question

2010-03-22 Thread John Andersen
Are your User and Profile models not associated/related to each other
- User hasOne/belongsTo Profile?
If you have that relationship, then just query for the Profile with
user_id equal the Auth->user('id') :)
Enjoy,
   John

On Mar 22, 2:39 am, "Dave"  wrote:
> This might be odd but i have user email and profile email.
> User email is not published on the site (used for account, login, forgot
> stuff like that) profile email is published on the site so for security i
> figured that its best to use a separate email.
>
> So when a user wants to edit either of the emails i need to make sure they
> are not the same so both cant be myn...@somewhere.com.
>
> How would i validate 1 field based on 2 different models using Auth->id
> since the email is directly related to the logged in user?
>
> I figured query the opposite table to see if this users email is the same as
> this profile email (or vice versa depending onwhichis being changed) but how
> do i use the auth id in this?
>
> validation rule:
> array(
>     'rule' => array('notSameAsUser', 'email'),
>     'message' => 'Your public email address can not be the same as your
> account email.',
>     'last' => true)
>
> function:
>
> function notSameAsUser( $data ) {
>
>   $valid = false;
>
>   $params = array(
>    'conditions' => array('Profile.id' => $id),//how do i get the id from
> Auth in the model?
>    'fields' => array('User.email')
>    'contain' => array(
>     'User' => array(
>      'fields' => array(
>       'User.email';
>
>   $data $this->find('first', $params);
>
>         if (  $data['User']['email'] !=  $data['Profile']['email'] ) {
>                 $valid = true;
>
>         }
>
>         return $valid;
>
> }
>
> Dave

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en

To unsubscribe from this group, send email to 
cake-php+unsubscribegooglegroups.com or reply to this email with the words 
"REMOVE ME" as the subject.