Permalink
Browse files

Stop using Utf8String for username, just trust Facebook API to return

data in utf8 format. This may change in the future if Facebook API
does not always return valid utf-8 string. We'll see
  • Loading branch information...
1 parent a1a29d9 commit d1c126a0cf006abde0bc107958bde6bf4d5f155e @snytkine committed Feb 20, 2012
Showing with 9 additions and 3 deletions.
  1. +8 −2 lib/Lampcms/ExternalAuth.php
  2. +1 −1 lib/Lampcms/Modules/Facebook/Client.php
@@ -132,13 +132,19 @@ public function __construct(Registry $Registry){
* be used as our own username
*
*/
- public function makeUsername($displayName){
+ public function makeUsername($displayName, $isUtf8 = false){
d('going to auto_create username based on displayName: '.$displayName);
/**
* Make 100% sure that displayName is in UTF8 encoding
+ * Commenting this out for now since it was causing
+ * a problem once.
+ * So for now we going to trust that Facebook give us results
+ * as a valid UTF-8 String
*/
- $displayName = Utf8String::factory($displayName)->valueOf();
+ if(!$isUtf8){
+ $displayName = Utf8String::factory($displayName)->valueOf();
+ }
$coll = $this->Registry->Mongo->USERS;
$res = null;
@@ -476,7 +476,7 @@ protected function createNewUser(){
$sid = (false === ($sid = Cookie::getSidCookie())) ? String::makeSid() : $sid;
$displayName = (!empty($this->aFbUserData['name'])) ? $this->aFbUserData['name'] : $this->aFbUserData['first_name'].' '.$this->aFbUserData['last_name'];
- $username = $extAuth->makeUsername($displayName);
+ $username = $extAuth->makeUsername($displayName, true);
if(!array_key_exists('email', $this->aFbUserData)){

0 comments on commit d1c126a

Please sign in to comment.