Permalink
Browse files

check if some fields are empties

  • Loading branch information...
1 parent 638fc24 commit a58afc39164eabcd314a794c294b8d9b4c97c10f @juanramon juanramon committed Sep 3, 2011
Showing with 17 additions and 3 deletions.
  1. +6 −1 login.php
  2. +11 −2 user.php
View
@@ -123,8 +123,13 @@ function doModel() {
}
break;
case('forgot_post'):
+ if( (Params::getParam('new_password') == '') || (Params::getParam('new_password2') == '') ) {
+ osc_add_flash_error_message( _m('Password cannot be blank')) ;
+ $this->redirectTo(osc_forgot_user_password_confirm_url(Params::getParam('userId'), Params::getParam('code')));
+ }
+
$user = User::newInstance()->findByIdPasswordSecret(Params::getParam('userId'), Params::getParam('code'));
- if($user['b_enabled']==1) {
+ if($user['b_enabled'] == 1) {
if(Params::getParam('new_password')==Params::getParam('new_password2')) {
User::newInstance()->update(
array('s_pass_code' => osc_genRandomPassword(50)
View
@@ -153,13 +153,22 @@ function doModel() {
case 'change_password_post': //change password post
$user = User::newInstance()->findByPrimaryKey( Session::newInstance()->_get('userId') ) ;
+ if( (Params::getParam('password') == '') || (Params::getParam('new_password') == '') || (Params::getParam('new_password2') == '') ) {
+ osc_add_flash_error_message( _m('Password cannot be blank')) ;
+ $this->redirectTo( osc_change_user_password_url() ) ;
+ }
+
if( $user['s_password'] != sha1( Params::getParam('password') ) ) {
osc_add_flash_error_message( _m('Current password doesn\'t match')) ;
$this->redirectTo( osc_change_user_password_url() ) ;
- } elseif( !Params::getParam('new_password') ) {
+ }
+
+ if( !Params::getParam('new_password') ) {
osc_add_flash_error_message( _m('Passwords can\'t be empty')) ;
$this->redirectTo( osc_change_user_password_url() ) ;
- } elseif( Params::getParam('new_password') != Params::getParam('new_password2') ) {
+ }
+
+ if( Params::getParam('new_password') != Params::getParam('new_password2') ) {
osc_add_flash_error_message( _m('Passwords don\'t match'));
$this->redirectTo( osc_change_user_password_url() ) ;
}

0 comments on commit a58afc3

Please sign in to comment.