Thursday 15 January 2015

php - Authentication with email not username -


I followed the origin of KPPHP. If I add a user, I can not log in with him. The idea should be correct with inputs. Background : User Hasabelblonstomni Podcast with a table included.


Administrators / User Organizer

  Add Public Works () {If ($ this-> Request-> ('Post')) {$ this- & gt; User- & gt; Create (); If ($ this-> User- & gt; saved affiliate ($ this-> Request-> Data)) {// saveAssociatied () Below $ - this- & gt; Redirect (array ('action' => gt; index)); }} $ Podcast = $ this- & gt; User- & gt; Podcast-> Search ('list'); $ This- & gt; Set (compact ('podcast')); } Public Function Login () (if ($ this- & gt; Request- & gt; ('Post')) {if ($- >--> $-> Login->) {$ this- & Gt; Redirect ($ this-> Auth-> redirect ());}}}   

model / user.php The public is $ ANDBelongsToMany = array ('podcast' => Array ('classname' = & gt; 'podcast', 'joitable' => 'podcast'user', 'foreign ka' = & Gt; 'User_ID', 'AssociationOrgankey' = & gt; 'Podcast_ID', 'Unique' =>, Incorrect,)); // Password Encryption Initiates Public Function ($ Option = array ()) {if ($ iss-> ([$ this-> data [$ this- & gt; nickname] ['password'])) {$ this-> data [$ this-> gt; ; Nickname] ['password'] = AuthComponent :: password ($ this-> data [$ this-> nickname] ['password']);} back true;}

AppModel.php ()

  class increases AppModel model {public function saveAssociated ($ data = null, $ Options = array () ) {Foreach ($ alias = & gt; $ $ Data as $ modelData) {If (! (Empty ($ -> and Belongs [$ alias])) $ $ habtm = array (); $ model = classResistry :: init ($ this-> $ and $ [$ Alias] ['className']); Foreign currency ($ ModelDataTa $ ModelDatam) {if (empty ($ modeldata ['id'])) {$ Model- & gt; Create ();} $ model- & Gt; Save ($ ModelDateum); $ Habtm [] = Empty ($ ModelDate ['id']) $ model- & gt; getInsertID (): $ ModelDatom ['id'];} $ data [$ alias] = Array ($ alias = & gt; $ habtm);}} Return parent: saveAassociated ($ data, $ option);}}    

Solution: I want to authenticate by email, which I have to do

according to my AppController.php looks like this: < Pre = public $ component = array ('session', 'at' => array ('authentication' = array; array ('form' = & gt; array ('field' = & gt; array ('Username' = & gt; 'email'))), 'login radied' => array ('admin' => gt; 'xxx', 'action' = 'gt;' index '),' logout redirect '= & Gt; Array ('Controller' => User, 'Action' = & gt; 'Login')));

No comments:

Post a Comment