|
@@ -107,6 +107,30 @@ class UserController extends Controller
|
107
|
107
|
$form_values = $this->getRequest()->request->get($form->getName());
|
108
|
108
|
$user = $form->getData();
|
109
|
109
|
|
|
110
|
+ /**
|
|
111
|
+ * Contrôle du token
|
|
112
|
+ */
|
|
113
|
+
|
|
114
|
+ $r_token = $this->getDoctrine()->getRepository('MuzichCoreBundle:RegistrationToken')
|
|
115
|
+ ->findOneBy(array('token' => $form_values["token"], 'used' => false))
|
|
116
|
+ ;
|
|
117
|
+
|
|
118
|
+ if (!$r_token)
|
|
119
|
+ {
|
|
120
|
+ $errors[] = $this->get('translator')->trans(
|
|
121
|
+ 'registration.token.error',
|
|
122
|
+ array(),
|
|
123
|
+ 'validators'
|
|
124
|
+ );
|
|
125
|
+ }
|
|
126
|
+ else
|
|
127
|
+ {
|
|
128
|
+ $r_token->setUsed(true);
|
|
129
|
+ $em = $this->getDoctrine()->getEntityManager();
|
|
130
|
+ $em->persist($r_token);
|
|
131
|
+ $em->flush();
|
|
132
|
+ }
|
|
133
|
+
|
110
|
134
|
/*
|
111
|
135
|
* Contrôle de la taille du pseudo
|
112
|
136
|
* min: 3
|
|
@@ -176,11 +200,12 @@ class UserController extends Controller
|
176
|
200
|
return $this->container->get('templating')->renderResponse(
|
177
|
201
|
'MuzichIndexBundle:Index:index.html.twig',
|
178
|
202
|
array(
|
179
|
|
- 'form' => $form->createView(),
|
180
|
|
- 'error' => null,
|
181
|
|
- 'registration_errors' => $form->getErrors(),
|
|
203
|
+ 'form' => $form->createView(),
|
|
204
|
+ 'error' => null,
|
|
205
|
+ 'registration_errors' => $form->getErrors(),
|
182
|
206
|
'registration_errors_pers' => $errors,
|
183
|
|
- 'last_username' => null
|
|
207
|
+ 'last_username' => null,
|
|
208
|
+ 'registration_page' => true
|
184
|
209
|
)
|
185
|
210
|
);
|
186
|
211
|
}
|