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: [email protected] [mailto:[email protected]] 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" <[email protected]> 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: [email protected] [mailto:[email protected]] 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" <[email protected]> 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 [email protected]. > > > 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 [email protected] To > unsubscribe from this group, send email to > [email protected] 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 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 [email protected] To unsubscribe from this group, send email to [email protected] 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 [email protected] To unsubscribe from this group, send email to [email protected] 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.
