Jelajahi Sumber

Added the missing validation and the creation of the api token

Christophe Coevoet 12 tahun lalu
induk
melakukan
7aad2d47fc

+ 3 - 0
src/Packagist/WebBundle/Form/Handler/OAuthRegistrationFormHandler.php

@@ -68,6 +68,9 @@ class OAuthRegistrationFormHandler implements RegistrationFormHandlerInterface
                 $user->setPlainPassword($randomPassword);
                 $user->setEnabled(true);
 
+                $apiToken = substr($this->tokenGenerator->generateToken(), 0, 20);
+                $user->setApiToken($apiToken);
+
                 return true;
             }
         }

+ 1 - 0
src/Packagist/WebBundle/Form/Type/OAuthRegistrationFormType.php

@@ -31,6 +31,7 @@ class OAuthRegistrationFormType extends AbstractType
         $resolver->setDefaults(array(
             'data_class' => 'Packagist\WebBundle\Entity\User',
             'intention'  => 'registration',
+            'validation_groups' => array('Default', 'Profile'),
         ));
     }