Hello boys and girls,
I've been looking at a way to maintain access to the user name when using the Custom Authentication by email, as explained in the book.
I think logging in via email is a good idea, as I still have members to our Curling site, who are quite forgetful of their usernames, but email's tend to not change. That being said, I've got at least one player who has actually gotten himself 3 different user accounts, because he forgets his username.
On the flip side, many folks like to be called by their names, be it a pseudonym, or their actual name, rather than johnny274@gmail.com.
So I tried what I thought would work, by setting the username much in the same way as the id as shown in the book. It didn't work.
Then I noticed in the blog, a commenter asked a similar question (Josh) and found a solution that worked for him. Which was surprising similar to what I thought would work. So I tried that, and it still didn't work. So obviously I'm missing something. To note, I have been coding for many years now, longer than I care to admit, but I'm kinda new to the Yii framework, so please be gentle!
Here's the code: UserIdentity
private $_name;
.
.
.
//within the authenticate function
$this->_name = $user->username;
.
.
.
public function getUsername(){
return $this->_name;
}
I'm sure you'll all laugh and say, "That's obvious!" and after I read it, I'll smack myself in the head for missing it, but anyway. :-)
Thanks,
Ray