function testCheckPassword() { $info = new UserInfo($this->data); $this->assertEquals("", $info->checkPassword()); $info = new UserInfo(array('password' => 'ab')); $this->assertEquals(UserInfo::CODE_PASSWORD_LENGTH, $info->checkPassword()); }
function handleUpdate() { $user = new UserInfo(array('user_id' => $this->userid, 'password' => $_REQUEST['password'])); if (!$this->userDb->authorizeUser($user)) { throw new VoiceWarning(CommonMessages::get()->msg('AUTH_ERROR')); } $passNew = $_REQUEST['password_new']; $passRetype = $_REQUEST['password_retype']; if ($passNew != $passRetype) { throw new VoiceWarning(CommonMessages::get()->msg('NOT_MATCH_PASSWORDS')); } $user = new UserInfo(array('user_id' => $this->userid, 'password' => $passNew)); $warn = $user->checkPassword(); if ($warn) { throw new VoiceWarning($warn); } $this->userDb->updateUser($user); $this->assign('mode', 'updated'); }