@@ 223-245 (lines=23) @@ | ||
220 | * @param Request $request |
|
221 | * @param ErrorCollection $errors |
|
222 | */ |
|
223 | protected function validate_username(Request $request, ErrorCollection $errors) |
|
224 | { |
|
225 | $username = $request[User::USERNAME]; |
|
226 | ||
227 | if (!$username) |
|
228 | { |
|
229 | return; |
|
230 | } |
|
231 | ||
232 | $uid = $this->key ?: 0; |
|
233 | $used = $this->model->where('username = ? AND uid != ?', $username, $uid)->exists; |
|
234 | ||
235 | if (!$used) |
|
236 | { |
|
237 | return; |
|
238 | } |
|
239 | ||
240 | $errors->add(User::USERNAME, "The user name %username is already used.", [ |
|
241 | ||
242 | '%username' => $username |
|
243 | ||
244 | ]); |
|
245 | } |
|
246 | ||
247 | /** |
|
248 | * Checks that the email is email. |
|
@@ 253-275 (lines=23) @@ | ||
250 | * @param Request $request |
|
251 | * @param ErrorCollection $errors |
|
252 | */ |
|
253 | protected function validate_email(Request $request, ErrorCollection $errors) |
|
254 | { |
|
255 | $email = $request[User::EMAIL]; |
|
256 | ||
257 | if (!$email) |
|
258 | { |
|
259 | return; |
|
260 | } |
|
261 | ||
262 | $uid = $this->key ?: 0; |
|
263 | $used = $this->model->where('email = ? AND uid != ?', $email, $uid)->exists; |
|
264 | ||
265 | if (!$used) |
|
266 | { |
|
267 | return; |
|
268 | } |
|
269 | ||
270 | $errors->add(User::EMAIL, "The email address %email is already used.", [ |
|
271 | ||
272 | '%email' => $email |
|
273 | ||
274 | ]); |
|
275 | } |
|
276 | ||
277 | protected function process() |
|
278 | { |