Guest User

Untitled

a guest
Oct 15th, 2018
102
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.60 KB | None | 0 0
  1. Event::on(User::class, User::EVENT_BEFORE_SAVE, function(Event $event) {
  2. $formData = $_POST;
  3. $newPassword = $formData['newPassword'];
  4. $confirmPassword = $formData['confirmPassword'];
  5.  
  6. if ($newPassword != $confirmPassword){
  7. Craft::$app->session->setError('Confirm password does not match new password');
  8. }
  9. });
  10.  
  11. {% set error = craft.app.session.getFlash('error') %}
  12. {% if error|length > 0 %}
  13. {{error}}
  14. {% endif %}
  15.  
  16. if ($newPassword != $confirmPassword){
  17. Craft::$app->session->setError('Confirm password does not match new password');
  18. $event->isValid = false;
  19. }
Add Comment
Please, Sign In to add comment