Skip to content

Instantly share code, notes, and snippets.

@isuvorov
Created September 4, 2014 14:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save isuvorov/67690ce0631559383285 to your computer and use it in GitHub Desktop.
Save isuvorov/67690ce0631559383285 to your computer and use it in GitHub Desktop.
public function registration()
{
$users = new User();
$users->username = $this->service->getAttribute('name');
$users->password = md5($this->service->getId());
$users->email = $this->service->getServiceName() . '@services.ru';
$users->save();
$userlink = new Userlink();
$userlink->userId = $users->id;
$userlink->serviceUsername = $this->service->id;
$userlink->serviceName = $this->service->getServiceName();
$userlink->params = ['attributes' => $this->service->attributes];
$userlink->save();
$this->_id = $users->id;
$this->username = $this->service->getAttribute('name');
return 0;
}
@MicroHappy
Copy link

$users->username = $this->service->getAttribute('name');

Об уникальности никто и не говорил. Для этого необходимо пересматривать саму структуру регистрации через соц сети. Чтобы люди вводили сразу себе username и email.
Или же делать эти поля не обязательными для заполнения. Тогда данные будут вытаскиваться из соц.сети, через которую зашёл человек.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment