SHOW:
|
|
- or go back to the newest paste.
| 1 | Implement change password in Symfony2 | |
| 2 | - | $builder->add('password', 'repeated', array( |
| 2 | + | $builder->add('password', 'repeated', array(
|
| 3 | - | 'first_name' => 'New password', |
| 3 | + | 'first_name' => 'New password', |
| 4 | - | 'second_name' => 'Confirm new password', |
| 4 | + | 'second_name' => 'Confirm new password', |
| 5 | - | 'type' => 'password' |
| 5 | + | 'type' => 'password' |
| 6 | )); | |
| 7 | ||
| 8 | - | // in action: |
| 8 | + | // in action: |
| 9 | - | $oldpassword = $user->getPassword(); |
| 9 | + | $oldpassword = $user->getPassword(); |
| 10 | - | |
| 10 | + | |
| 11 | - | if ($request->getMethod() == 'POST') |
| 11 | + | if ($request->getMethod() == 'POST') |
| 12 | - | { |
| 12 | + | {
|
| 13 | - | $form->bindRequest($request); |
| 13 | + | $form->bindRequest($request); |
| 14 | - | |
| 14 | + | |
| 15 | - | if ($form->isValid()) |
| 15 | + | if ($form->isValid()) |
| 16 | - | { |
| 16 | + | {
|
| 17 | // check password here (by hashing new one) |