Method resetPassword
has 71 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function resetPassword(): void
{
$this->climate->arguments->add([
'login' => [
'prefix' => 'l',
Method resetAllPasswords
has 44 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function resetAllPasswords(): void
{
$this->climate->arguments->add([
'confirmation' => [
'prefix' => 'c',
Function resetPassword
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
public function resetPassword(): void
{
$this->climate->arguments->add([
'login' => [
'prefix' => 'l',
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Method passwordAuth
has 38 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function passwordAuth(): void
{
$this->climate->arguments->add([
'login' => [
'prefix' => 'l',
Function passwordAuth
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
public function passwordAuth(): void
{
$this->climate->arguments->add([
'login' => [
'prefix' => 'l',
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
The method resetPassword() has an NPath complexity of 384. The configured NPath complexity threshold is 200. Open
public function resetPassword(): void
{
$this->climate->arguments->add([
'login' => [
'prefix' => 'l',
- Read upRead up
- Exclude checks
NPathComplexity
Since: 0.1
The NPath complexity of a method is the number of acyclic execution paths through that method. A threshold of 200 is generally considered the point where measures should be taken to reduce complexity.
Example
class Foo {
function bar() {
// lots of complicated code
}
}
Source https://phpmd.org/rules/codesize.html#npathcomplexity
The method resetPassword() has a Cyclomatic Complexity of 11. The configured cyclomatic complexity threshold is 10. Open
public function resetPassword(): void
{
$this->climate->arguments->add([
'login' => [
'prefix' => 'l',
- Read upRead up
- Exclude checks
CyclomaticComplexity
Since: 0.1
Complexity is determined by the number of decision points in a method plus one for the method entry. The decision points are 'if', 'while', 'for', and 'case labels'. Generally, 1-4 is low complexity, 5-7 indicates moderate complexity, 8-10 is high complexity, and 11+ is very high complexity.
Example
// Cyclomatic Complexity = 11
class Foo {
1 public function example() {
2 if ($a == $b) {
3 if ($a1 == $b1) {
fiddle();
4 } elseif ($a2 == $b2) {
fiddle();
} else {
fiddle();
}
5 } elseif ($c == $d) {
6 while ($c == $d) {
fiddle();
}
7 } elseif ($e == $f) {
8 for ($n = 0; $n < $h; $n++) {
fiddle();
}
} else {
switch ($z) {
9 case 1:
fiddle();
break;
10 case 2:
fiddle();
break;
11 case 3:
fiddle();
break;
default:
fiddle();
break;
}
}
}
}
Source https://phpmd.org/rules/codesize.html#cyclomaticcomplexity
Missing class import via use statement (line '60', column '15'). Open
$row = (new \App\Db\Query())->select(['id', 'deleted'])->from('vtiger_users')->where(['or', ['user_name' => $userName], ['user_name' => strtolower($userName)]])->limit(1)->one();
- Read upRead up
- Exclude checks
MissingImport
Since: 2.7.0
Importing all external classes in a file through use statements makes them clearly visible.
Example
function make() {
return new \stdClass();
}
Source http://phpmd.org/rules/cleancode.html#MissingImport
Missing class import via use statement (line '140', column '24'). Open
$eventHandler = new \App\EventHandler();
- Read upRead up
- Exclude checks
MissingImport
Since: 2.7.0
Importing all external classes in a file through use statements makes them clearly visible.
Example
function make() {
return new \stdClass();
}
Source http://phpmd.org/rules/cleancode.html#MissingImport
Missing class import via use statement (line '131', column '19'). Open
$userIds = (new \App\Db\Query())->select(['id'])->from('vtiger_users')->where(['deleted' => 0])->column();
- Read upRead up
- Exclude checks
MissingImport
Since: 2.7.0
Importing all external classes in a file through use statements makes them clearly visible.
Example
function make() {
return new \stdClass();
}
Source http://phpmd.org/rules/cleancode.html#MissingImport
Missing class import via use statement (line '188', column '15'). Open
$row = (new \App\Db\Query())->select(['id', 'deleted'])->from('vtiger_users')->where(['or', ['user_name' => $userName], ['user_name' => strtolower($userName)]])->limit(1)->one();
- Read upRead up
- Exclude checks
MissingImport
Since: 2.7.0
Importing all external classes in a file through use statements makes them clearly visible.
Example
function make() {
return new \stdClass();
}
Source http://phpmd.org/rules/cleancode.html#MissingImport
Missing class import via use statement (line '85', column '23'). Open
$eventHandler = new \App\EventHandler();
- Read upRead up
- Exclude checks
MissingImport
Since: 2.7.0
Importing all external classes in a file through use statements makes them clearly visible.
Example
function make() {
return new \stdClass();
}
Source http://phpmd.org/rules/cleancode.html#MissingImport
The method resetPassword uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them. Open
} else {
$password = \App\Encryption::generateUserPassword();
$this->climate->lightGreen('New password: ' . $password);
}
- Read upRead up
- Exclude checks
ElseExpression
Since: 1.4.0
An if expression with an else branch is basically not necessary. You can rewrite the conditions in a way that the else clause is not necessary and the code becomes simpler to read. To achieve this, use early return statements, though you may need to split the code it several smaller methods. For very simple assignments you could also use the ternary operations.
Example
class Foo
{
public function bar($flag)
{
if ($flag) {
// one branch
} else {
// another branch
}
}
}
Source https://phpmd.org/rules/cleancode.html#elseexpression
Avoid using static access to class '\App\Fields\DateTime' in method 'resetAllPasswords'. Open
'expirationDate' => \App\Fields\DateTime::formatToDisplay($expirationDate),
- Read upRead up
- Exclude checks
StaticAccess
Since: 1.4.0
Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.
Example
class Foo
{
public function bar()
{
Bar::baz();
}
}
Source https://phpmd.org/rules/cleancode.html#staticaccess
The method resetPassword uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them. Open
} else {
$this->cli->actionsList('Users');
}
- Read upRead up
- Exclude checks
ElseExpression
Since: 1.4.0
An if expression with an else branch is basically not necessary. You can rewrite the conditions in a way that the else clause is not necessary and the code becomes simpler to read. To achieve this, use early return statements, though you may need to split the code it several smaller methods. For very simple assignments you could also use the ternary operations.
Example
class Foo
{
public function bar($flag)
{
if ($flag) {
// one branch
} else {
// another branch
}
}
}
Source https://phpmd.org/rules/cleancode.html#elseexpression
Avoid using static access to class '\App\Encryption' in method 'resetAllPasswords'. Open
$userRecordModel->set('user_password', \App\Encryption::generateUserPassword());
- Read upRead up
- Exclude checks
StaticAccess
Since: 1.4.0
Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.
Example
class Foo
{
public function bar()
{
Bar::baz();
}
}
Source https://phpmd.org/rules/cleancode.html#staticaccess
The method resetPassword uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them. Open
} else {
$input = $this->climate->input('Enter login/username:');
$userName = $input->prompt();
}
- Read upRead up
- Exclude checks
ElseExpression
Since: 1.4.0
An if expression with an else branch is basically not necessary. You can rewrite the conditions in a way that the else clause is not necessary and the code becomes simpler to read. To achieve this, use early return statements, though you may need to split the code it several smaller methods. For very simple assignments you could also use the ternary operations.
Example
class Foo
{
public function bar($flag)
{
if ($flag) {
// one branch
} else {
// another branch
}
}
}
Source https://phpmd.org/rules/cleancode.html#elseexpression
Avoid using static access to class '\Users_Record_Model' in method 'resetPassword'. Open
$userRecordModel = \Users_Record_Model::getInstanceById($row['id'], 'Users');
- Read upRead up
- Exclude checks
StaticAccess
Since: 1.4.0
Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.
Example
class Foo
{
public function bar()
{
Bar::baz();
}
}
Source https://phpmd.org/rules/cleancode.html#staticaccess
Avoid using static access to class '\App\Encryption' in method 'resetPassword'. Open
$password = \App\Encryption::generateUserPassword();
- Read upRead up
- Exclude checks
StaticAccess
Since: 1.4.0
Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.
Example
class Foo
{
public function bar()
{
Bar::baz();
}
}
Source https://phpmd.org/rules/cleancode.html#staticaccess
Avoid using static access to class '\App\Fields\DateTime' in method 'resetPassword'. Open
'expirationDate' => \App\Fields\DateTime::formatToDisplay($expirationDate),
- Read upRead up
- Exclude checks
StaticAccess
Since: 1.4.0
Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.
Example
class Foo
{
public function bar()
{
Bar::baz();
}
}
Source https://phpmd.org/rules/cleancode.html#staticaccess
Avoid using static access to class '\Users_Record_Model' in method 'passwordAuth'. Open
$userRecordModel = \Users_Record_Model::getInstanceById($row['id'], 'Users');
- Read upRead up
- Exclude checks
StaticAccess
Since: 1.4.0
Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.
Example
class Foo
{
public function bar()
{
Bar::baz();
}
}
Source https://phpmd.org/rules/cleancode.html#staticaccess
Avoid using static access to class '\App\Utils\Tokens' in method 'resetPassword'. Open
$token = \App\Utils\Tokens::generate('Users_LoginForgotPassword_Action', [$userRecordModel->getId()], $expirationDate);
- Read upRead up
- Exclude checks
StaticAccess
Since: 1.4.0
Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.
Example
class Foo
{
public function bar()
{
Bar::baz();
}
}
Source https://phpmd.org/rules/cleancode.html#staticaccess
Avoid using static access to class '\App\Mailer' in method 'resetPassword'. Open
\App\Mailer::sendFromTemplate([
'template' => 'UsersResetPassword',
'moduleName' => 'Users',
'recordId' => $userRecordModel->getId(),
'to' => $userRecordModel->get('email1'),
- Read upRead up
- Exclude checks
StaticAccess
Since: 1.4.0
Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.
Example
class Foo
{
public function bar()
{
Bar::baz();
}
}
Source https://phpmd.org/rules/cleancode.html#staticaccess
The method passwordAuth uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them. Open
} else {
$input = $this->climate->input('Enter login/username:');
$userName = $input->prompt();
}
- Read upRead up
- Exclude checks
ElseExpression
Since: 1.4.0
An if expression with an else branch is basically not necessary. You can rewrite the conditions in a way that the else clause is not necessary and the code becomes simpler to read. To achieve this, use early return statements, though you may need to split the code it several smaller methods. For very simple assignments you could also use the ternary operations.
Example
class Foo
{
public function bar($flag)
{
if ($flag) {
// one branch
} else {
// another branch
}
}
}
Source https://phpmd.org/rules/cleancode.html#elseexpression
Avoid using static access to class '\Users_Record_Model' in method 'resetAllPasswords'. Open
$userRecordModel = \Users_Record_Model::getInstanceById($userId, 'Users');
- Read upRead up
- Exclude checks
StaticAccess
Since: 1.4.0
Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.
Example
class Foo
{
public function bar()
{
Bar::baz();
}
}
Source https://phpmd.org/rules/cleancode.html#staticaccess
The method passwordAuth uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them. Open
} else {
$this->cli->actionsList('Users');
}
- Read upRead up
- Exclude checks
ElseExpression
Since: 1.4.0
An if expression with an else branch is basically not necessary. You can rewrite the conditions in a way that the else clause is not necessary and the code becomes simpler to read. To achieve this, use early return statements, though you may need to split the code it several smaller methods. For very simple assignments you could also use the ternary operations.
Example
class Foo
{
public function bar($flag)
{
if ($flag) {
// one branch
} else {
// another branch
}
}
}
Source https://phpmd.org/rules/cleancode.html#elseexpression
Avoid using static access to class '\App\Utils\Tokens' in method 'resetAllPasswords'. Open
$token = \App\Utils\Tokens::generate('Users_LoginForgotPassword_Action', [$userRecordModel->getId()], $expirationDate);
- Read upRead up
- Exclude checks
StaticAccess
Since: 1.4.0
Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.
Example
class Foo
{
public function bar()
{
Bar::baz();
}
}
Source https://phpmd.org/rules/cleancode.html#staticaccess
Avoid using static access to class '\App\Mailer' in method 'resetAllPasswords'. Open
\App\Mailer::sendFromTemplate([
'template' => 'UsersResetPassword',
'moduleName' => 'Users',
'recordId' => $userRecordModel->getId(),
'to' => $userRecordModel->get('email1'),
- Read upRead up
- Exclude checks
StaticAccess
Since: 1.4.0
Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.
Example
class Foo
{
public function bar()
{
Bar::baz();
}
}
Source https://phpmd.org/rules/cleancode.html#staticaccess
Define a constant instead of duplicating this literal "user_name" 4 times. Open
$row = (new \App\Db\Query())->select(['id', 'deleted'])->from('vtiger_users')->where(['or', ['user_name' => $userName], ['user_name' => strtolower($userName)]])->limit(1)->one();
- Read upRead up
- Exclude checks
Duplicated string literals make the process of refactoring error-prone, since you must be sure to update all occurrences.
On the other hand, constants can be referenced from many places, but only need to be updated in a single place.
Noncompliant Code Example
With the default threshold of 3:
function run() { prepare('action1'); // Non-Compliant - 'action1' is duplicated 3 times execute('action1'); release('action1'); }
Compliant Solution
ACTION_1 = 'action1'; function run() { prepare(ACTION_1); execute(ACTION_1); release(ACTION_1); }
Exceptions
To prevent generating some false-positives, literals having less than 5 characters are excluded.
Define a constant instead of duplicating this literal "confirmation" 5 times. Open
'confirmation' => [
- Read upRead up
- Exclude checks
Duplicated string literals make the process of refactoring error-prone, since you must be sure to update all occurrences.
On the other hand, constants can be referenced from many places, but only need to be updated in a single place.
Noncompliant Code Example
With the default threshold of 3:
function run() { prepare('action1'); // Non-Compliant - 'action1' is duplicated 3 times execute('action1'); release('action1'); }
Compliant Solution
ACTION_1 = 'action1'; function run() { prepare(ACTION_1); execute(ACTION_1); release(ACTION_1); }
Exceptions
To prevent generating some false-positives, literals having less than 5 characters are excluded.
Define a constant instead of duplicating this literal "deleted" 5 times. Open
$row = (new \App\Db\Query())->select(['id', 'deleted'])->from('vtiger_users')->where(['or', ['user_name' => $userName], ['user_name' => strtolower($userName)]])->limit(1)->one();
- Read upRead up
- Exclude checks
Duplicated string literals make the process of refactoring error-prone, since you must be sure to update all occurrences.
On the other hand, constants can be referenced from many places, but only need to be updated in a single place.
Noncompliant Code Example
With the default threshold of 3:
function run() { prepare('action1'); // Non-Compliant - 'action1' is duplicated 3 times execute('action1'); release('action1'); }
Compliant Solution
ACTION_1 = 'action1'; function run() { prepare(ACTION_1); execute(ACTION_1); release(ACTION_1); }
Exceptions
To prevent generating some false-positives, literals having less than 5 characters are excluded.
Define a constant instead of duplicating this literal "vtiger_users" 3 times. Open
$row = (new \App\Db\Query())->select(['id', 'deleted'])->from('vtiger_users')->where(['or', ['user_name' => $userName], ['user_name' => strtolower($userName)]])->limit(1)->one();
- Read upRead up
- Exclude checks
Duplicated string literals make the process of refactoring error-prone, since you must be sure to update all occurrences.
On the other hand, constants can be referenced from many places, but only need to be updated in a single place.
Noncompliant Code Example
With the default threshold of 3:
function run() { prepare('action1'); // Non-Compliant - 'action1' is duplicated 3 times execute('action1'); release('action1'); }
Compliant Solution
ACTION_1 = 'action1'; function run() { prepare(ACTION_1); execute(ACTION_1); release(ACTION_1); }
Exceptions
To prevent generating some false-positives, literals having less than 5 characters are excluded.
Define a constant instead of duplicating this literal "password" 3 times. Open
'password' => [
- Read upRead up
- Exclude checks
Duplicated string literals make the process of refactoring error-prone, since you must be sure to update all occurrences.
On the other hand, constants can be referenced from many places, but only need to be updated in a single place.
Noncompliant Code Example
With the default threshold of 3:
function run() { prepare('action1'); // Non-Compliant - 'action1' is duplicated 3 times execute('action1'); release('action1'); }
Compliant Solution
ACTION_1 = 'action1'; function run() { prepare(ACTION_1); execute(ACTION_1); release(ACTION_1); }
Exceptions
To prevent generating some false-positives, literals having less than 5 characters are excluded.
Define a constant instead of duplicating this literal "prefix" 5 times. Open
'prefix' => 'l',
- Read upRead up
- Exclude checks
Duplicated string literals make the process of refactoring error-prone, since you must be sure to update all occurrences.
On the other hand, constants can be referenced from many places, but only need to be updated in a single place.
Noncompliant Code Example
With the default threshold of 3:
function run() { prepare('action1'); // Non-Compliant - 'action1' is duplicated 3 times execute('action1'); release('action1'); }
Compliant Solution
ACTION_1 = 'action1'; function run() { prepare(ACTION_1); execute(ACTION_1); release(ACTION_1); }
Exceptions
To prevent generating some false-positives, literals having less than 5 characters are excluded.
Define a constant instead of duplicating this literal "login" 6 times. Open
'login' => [
- Read upRead up
- Exclude checks
Duplicated string literals make the process of refactoring error-prone, since you must be sure to update all occurrences.
On the other hand, constants can be referenced from many places, but only need to be updated in a single place.
Noncompliant Code Example
With the default threshold of 3:
function run() { prepare('action1'); // Non-Compliant - 'action1' is duplicated 3 times execute('action1'); release('action1'); }
Compliant Solution
ACTION_1 = 'action1'; function run() { prepare(ACTION_1); execute(ACTION_1); release(ACTION_1); }
Exceptions
To prevent generating some false-positives, literals having less than 5 characters are excluded.
Define a constant instead of duplicating this literal "action" 4 times. Open
$eventHandler->setParams(['action' => 'reset']);
- Read upRead up
- Exclude checks
Duplicated string literals make the process of refactoring error-prone, since you must be sure to update all occurrences.
On the other hand, constants can be referenced from many places, but only need to be updated in a single place.
Noncompliant Code Example
With the default threshold of 3:
function run() { prepare('action1'); // Non-Compliant - 'action1' is duplicated 3 times execute('action1'); release('action1'); }
Compliant Solution
ACTION_1 = 'action1'; function run() { prepare(ACTION_1); execute(ACTION_1); release(ACTION_1); }
Exceptions
To prevent generating some false-positives, literals having less than 5 characters are excluded.
Define a constant instead of duplicating this literal "Users" 13 times. Open
public $moduleName = 'Users';
- Read upRead up
- Exclude checks
Duplicated string literals make the process of refactoring error-prone, since you must be sure to update all occurrences.
On the other hand, constants can be referenced from many places, but only need to be updated in a single place.
Noncompliant Code Example
With the default threshold of 3:
function run() { prepare('action1'); // Non-Compliant - 'action1' is duplicated 3 times execute('action1'); release('action1'); }
Compliant Solution
ACTION_1 = 'action1'; function run() { prepare(ACTION_1); execute(ACTION_1); release(ACTION_1); }
Exceptions
To prevent generating some false-positives, literals having less than 5 characters are excluded.
Define a constant instead of duplicating this literal "description" 5 times. Open
'description' => 'Login/User name',
- Read upRead up
- Exclude checks
Duplicated string literals make the process of refactoring error-prone, since you must be sure to update all occurrences.
On the other hand, constants can be referenced from many places, but only need to be updated in a single place.
Noncompliant Code Example
With the default threshold of 3:
function run() { prepare('action1'); // Non-Compliant - 'action1' is duplicated 3 times execute('action1'); release('action1'); }
Compliant Solution
ACTION_1 = 'action1'; function run() { prepare(ACTION_1); execute(ACTION_1); release(ACTION_1); }
Exceptions
To prevent generating some false-positives, literals having less than 5 characters are excluded.
Define a constant instead of duplicating this literal "Y-m-d H:i:s" 4 times. Open
$userRecordModel->set('date_password_change', date('Y-m-d H:i:s'));
- Read upRead up
- Exclude checks
Duplicated string literals make the process of refactoring error-prone, since you must be sure to update all occurrences.
On the other hand, constants can be referenced from many places, but only need to be updated in a single place.
Noncompliant Code Example
With the default threshold of 3:
function run() { prepare('action1'); // Non-Compliant - 'action1' is duplicated 3 times execute('action1'); release('action1'); }
Compliant Solution
ACTION_1 = 'action1'; function run() { prepare(ACTION_1); execute(ACTION_1); release(ACTION_1); }
Exceptions
To prevent generating some false-positives, literals having less than 5 characters are excluded.
Call to method confirm
from undeclared class \League\CLImate\CLImate
Open
if ($this->climate->arguments->defined('confirmation') || $this->climate->confirm('Re-enter login?')->confirmed()) {
- Exclude checks
Call to undeclared method \App\Db\Query::select
Open
$row = (new \App\Db\Query())->select(['id', 'deleted'])->from('vtiger_users')->where(['or', ['user_name' => $userName], ['user_name' => strtolower($userName)]])->limit(1)->one();
- Exclude checks
Call to method input
from undeclared class \League\CLImate\CLImate
Open
$input = $this->climate->input('Enter login/username:');
- Exclude checks
Reference to instance property arguments
from undeclared class \League\CLImate\CLImate
Open
if (!$this->climate->arguments->defined('action')) {
- Exclude checks
Call to method confirm
from undeclared class \League\CLImate\CLImate
Open
if (!$this->climate->arguments->defined('confirmation') && !$this->climate->confirm('Do you want to reset the passwords of all active users?')->confirmed()) {
- Exclude checks
Call to method input
from undeclared class \League\CLImate\CLImate
Open
$input = $this->climate->input('Enter login/username:');
- Exclude checks
Reference to instance property arguments
from undeclared class \League\CLImate\CLImate
Open
$password = $this->climate->arguments->get('password');
- Exclude checks
Call to method confirm
from undeclared class \League\CLImate\CLImate
Open
if ($this->climate->arguments->defined('confirmation') || $this->climate->confirm('Send password reset link to user\'s email address?')->confirmed()) {
- Exclude checks
Call to method lightGreen
from undeclared class \League\CLImate\CLImate
Open
$this->climate->lightGreen('User inactive!!!');
- Exclude checks
Call to method red
from undeclared class \League\CLImate\CLImate
Open
$this->climate->red('User not found');
- Exclude checks
Call to method generateUserPassword
from undeclared class \App\Encryption
(Did you mean class \Tests\App\Encryption) Open
$password = \App\Encryption::generateUserPassword();
- Exclude checks
Reference to static property site_URL
from undeclared class \Config\Main
Open
'url' => \Config\Main::$site_URL . 'index.php?module=Users&view=LoginPassChange&token=' . $token,
- Exclude checks
Call to method generateUserPassword
from undeclared class \App\Encryption
(Did you mean class \Tests\App\Encryption) Open
$userRecordModel->set('user_password', \App\Encryption::generateUserPassword());
- Exclude checks
Argument 2 (value)
is true
but \Users_Record_Model::set()
takes string
defined at /code/modules/Users/models/Record.php:52
Open
$userRecordModel->set('changeUserPassword', true);
- Exclude checks
Call to method lightGreen
from undeclared class \League\CLImate\CLImate
Open
$this->climate->lightGreen('New password: ' . $password);
- Exclude checks
Reference to instance property arguments
from undeclared class \League\CLImate\CLImate
Open
if ($this->climate->arguments->defined('login')) {
- Exclude checks
Reference to instance property arguments
from undeclared class \League\CLImate\CLImate
Open
if ($this->climate->arguments->defined('confirmation') || $this->climate->confirm('Re-enter login?')->confirmed()) {
- Exclude checks
Reference to instance property arguments
from undeclared class \League\CLImate\CLImate
Open
if ($this->climate->arguments->defined('confirmation') || $this->climate->confirm('Send password reset link to user\'s email address?')->confirmed()) {
- Exclude checks
Reference to instance property arguments
from undeclared class \League\CLImate\CLImate
Open
$this->climate->arguments->add([
- Exclude checks
Reference to static property site_URL
from undeclared class \Config\Main
Open
'url' => \Config\Main::$site_URL . 'index.php?module=Users&view=LoginPassChange&token=' . $token,
- Exclude checks
Reference to instance property arguments
from undeclared class \League\CLImate\CLImate
Open
if (!$this->climate->arguments->defined('action')) {
- Exclude checks
Reference to instance property arguments
from undeclared class \League\CLImate\CLImate
Open
$userName = $this->climate->arguments->get('login');
- Exclude checks
Call to method progress
from undeclared class \League\CLImate\CLImate
Open
$progress = $this->climate->progress()->total(\count($userIds));
- Exclude checks
Call to method red
from undeclared class \League\CLImate\CLImate
Open
$this->climate->red('User not found');
- Exclude checks
Reference to instance property arguments
from undeclared class \League\CLImate\CLImate
Open
if ($this->climate->arguments->defined('password')) {
- Exclude checks
Reference to instance property arguments
from undeclared class \League\CLImate\CLImate
Open
if (!$this->climate->arguments->defined('confirmation') && !$this->climate->confirm('Do you want to reset the passwords of all active users?')->confirmed()) {
- Exclude checks
Reference to instance property arguments
from undeclared class \League\CLImate\CLImate
Open
$this->climate->arguments->parse();
- Exclude checks
Reference to instance property arguments
from undeclared class \League\CLImate\CLImate
Open
if ($this->climate->arguments->defined('login')) {
- Exclude checks
Call to method lightGreen
from undeclared class \League\CLImate\CLImate
Open
$this->climate->lightGreen('Number of passwords reset: ' . $i);
- Exclude checks
Call to method confirm
from undeclared class \League\CLImate\CLImate
Open
if ($this->climate->confirm('Re-enter login?')->confirmed()) {
- Exclude checks
Call to method lightGreen
from undeclared class \League\CLImate\CLImate
Open
$this->climate->lightGreen('User inactive!!!');
- Exclude checks
Reference to instance property arguments
from undeclared class \League\CLImate\CLImate
Open
$this->climate->arguments->add([
- Exclude checks
Call to undeclared method \App\Db\Query::select
Open
$row = (new \App\Db\Query())->select(['id', 'deleted'])->from('vtiger_users')->where(['or', ['user_name' => $userName], ['user_name' => strtolower($userName)]])->limit(1)->one();
- Exclude checks
Call to method lightBlue
from undeclared class \League\CLImate\CLImate
Open
$this->climate->lightBlue($userRecordModel->getDisplayName() . ' (' . $userRecordModel->getDisplayValue('roleid', false, true) . ')');
- Exclude checks
Call to method lightBlue
from undeclared class \League\CLImate\CLImate
Open
$this->climate->lightBlue('New passwords will be sent to the user\'s e-mail, it is required that the e-mail sending works properly.');
- Exclude checks
Argument 2 (value)
is true
but \Users_Record_Model::set()
takes string
defined at /code/modules/Users/models/Record.php:52
Open
$userRecordModel->set('changeUserPassword', true);
- Exclude checks
Reference to instance property arguments
from undeclared class \League\CLImate\CLImate
Open
$userName = $this->climate->arguments->get('login');
- Exclude checks
Reference to instance property arguments
from undeclared class \League\CLImate\CLImate
Open
$this->climate->arguments->add([
- Exclude checks
Call to undeclared method \App\Db\Query::select
Open
$userIds = (new \App\Db\Query())->select(['id'])->from('vtiger_users')->where(['deleted' => 0])->column();
- Exclude checks
Reference to instance property arguments
from undeclared class \League\CLImate\CLImate
Open
$this->climate->arguments->parse();
- Exclude checks
Call to method lightBlue
from undeclared class \League\CLImate\CLImate
Open
$this->climate->lightBlue($userRecordModel->getDisplayName() . ' (' . $userRecordModel->getDisplayValue('roleid', false, true) . ')');
- Exclude checks
Avoid variables with short names like $i. Configured minimum length is 3. Open
$i = 0;
- Read upRead up
- Exclude checks
ShortVariable
Since: 0.2
Detects when a field, local, or parameter has a very short name.
Example
class Something {
private $q = 15; // VIOLATION - Field
public static function main( array $as ) { // VIOLATION - Formal
$r = 20 + $this->q; // VIOLATION - Local
for (int $i = 0; $i < 10; $i++) { // Not a Violation (inside FOR)
$r += $this->q;
}
}
}
Source https://phpmd.org/rules/naming.html#shortvariable
Spaces must be used to indent lines; tabs are not allowed Open
public $methods = [
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public $moduleName = 'Users';
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
/** {@inheritdoc} */
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'passwordAuth' => 'Disable 2FA or LDAP auth',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
/** @var string[] Methods list */
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'resetPassword' => 'Reset user password',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'resetAllPasswords' => 'Reset all user passwords',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->climate->arguments->add([
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if ($this->climate->arguments->defined('login')) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$row = (new \App\Db\Query())->select(['id', 'deleted'])->from('vtiger_users')->where(['or', ['user_name' => $userName], ['user_name' => strtolower($userName)]])->limit(1)->one();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->resetPassword();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$eventHandler->trigger('UsersAfterPasswordChange');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if ($this->climate->arguments->defined('confirmation') || $this->climate->confirm('Send password reset link to user\'s email address?')->confirmed()) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$token = \App\Utils\Tokens::generate('Users_LoginForgotPassword_Action', [$userRecordModel->getId()], $expirationDate);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'recordId' => $userRecordModel->getId(),
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$progress = $this->climate->progress()->total(\count($userIds));
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->climate->lightGreen('Number of passwords reset: ' . $i);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'prefix' => 'c',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'description' => 'Don\'t ask for confirmation',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->climate->red('User not found');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
\App\Mailer::sendFromTemplate([
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'token' => $token,
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @return void
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'token' => $token,
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->climate->arguments->add([
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'prefix' => 'l',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'description' => 'New password',
- Exclude checks
Line exceeds 120 characters; contains 128 characters Open
if ($this->climate->arguments->defined('confirmation') || $this->climate->confirm('Re-enter login?')->confirmed()) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$userRecordModel->set('changeUserPassword', true);
- Exclude checks
Line exceeds 120 characters; contains 131 characters Open
$token = \App\Utils\Tokens::generate('Users_LoginForgotPassword_Action', [$userRecordModel->getId()], $expirationDate);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
foreach ($userIds as $userId) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
]);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
/**
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
]);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$eventHandler->setParams(['action' => 'reset']);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'to' => $userRecordModel->get('email1'),
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
],
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
]);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$userRecordModel->set('user_password', \App\Encryption::generateUserPassword());
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$userRecordModel->save();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @return void
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*/
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
{
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (0 !== (int) $row['deleted']) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->climate->lightGreen('New password: ' . $password);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'url' => \Config\Main::$site_URL . 'index.php?module=Users&view=LoginPassChange&token=' . $token,
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->climate->lightBlue('New passwords will be sent to the user\'s e-mail, it is required that the e-mail sending works properly.');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$i = 0;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$eventHandler->setRecordModel($userRecordModel);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'moduleName' => 'Users',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$progress->advance();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$userName = $this->climate->arguments->get('login');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$userName = $input->prompt();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
} else {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$eventHandler->setModuleName('Users');
- Exclude checks
Line exceeds 120 characters; contains 159 characters Open
if ($this->climate->arguments->defined('confirmation') || $this->climate->confirm('Send password reset link to user\'s email address?')->confirmed()) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public function passwordAuth(): void
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public function resetPassword(): void
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (!$row) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->climate->lightGreen('User inactive!!!');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$expirationDate = date('Y-m-d H:i:s', strtotime('+24 hour'));
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'prefix' => 'c',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$userIds = (new \App\Db\Query())->select(['id'])->from('vtiger_users')->where(['deleted' => 0])->column();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$eventHandler->trigger('UsersBeforePasswordChange');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'to' => $userRecordModel->get('email1'),
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'description' => 'Login/User name',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->climate->arguments->parse();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Line exceeds 120 characters; contains 186 characters Open
$row = (new \App\Db\Query())->select(['id', 'deleted'])->from('vtiger_users')->where(['or', ['user_name' => $userName], ['user_name' => strtolower($userName)]])->limit(1)->one();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->cli->actionsList('Users');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'template' => 'UsersResetPassword',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if ($this->helpMode) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (!$this->climate->arguments->defined('confirmation') && !$this->climate->confirm('Do you want to reset the passwords of all active users?')->confirmed()) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'expirationDate' => \App\Fields\DateTime::formatToDisplay($expirationDate),
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'login' => [
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'prefix' => 'l',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->passwordAuth();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->cli->actionsList('Users');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$eventHandler->trigger('UsersBeforePasswordChange');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$userRecordModel->save();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
]);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
{
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->climate->arguments->add([
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$eventHandler->setParams(['action' => 'massReset']);
- Exclude checks
Line exceeds 120 characters; contains 131 characters Open
$token = \App\Utils\Tokens::generate('Users_LoginForgotPassword_Action', [$userRecordModel->getId()], $expirationDate);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
++$i;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
{
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
} else {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->climate->lightBlue($userRecordModel->getDisplayName() . ' (' . $userRecordModel->getDisplayValue('roleid', false, true) . ')');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Reset user password.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$eventHandler = new \App\EventHandler();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
/**
- Exclude checks
Line exceeds 120 characters; contains 166 characters Open
if (!$this->climate->arguments->defined('confirmation') && !$this->climate->confirm('Do you want to reset the passwords of all active users?')->confirmed()) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$expirationDate = date('Y-m-d H:i:s', strtotime('+24 hour'));
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'url' => \Config\Main::$site_URL . 'index.php?module=Users&view=LoginPassChange&token=' . $token,
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if ($this->climate->arguments->defined('login')) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$userName = $input->prompt();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->climate->lightBlue($userRecordModel->getDisplayName() . ' (' . $userRecordModel->getDisplayValue('roleid', false, true) . ')');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if ($this->climate->arguments->defined('password')) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$userRecordModel->set('user_password', $password);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (!$this->climate->arguments->defined('action')) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$userRecordModel->set('changeUserPassword', true);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'login' => [
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'prefix' => 'p',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$userRecordModel = \Users_Record_Model::getInstanceById($row['id'], 'Users');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'moduleName' => 'Users',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (0 !== (int) $row['deleted']) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'template' => 'UsersResetPassword',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->cli->actionsList('Users');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
],
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
]);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
} else {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (!$row) {
- Exclude checks
Line exceeds 120 characters; contains 142 characters Open
$this->climate->lightBlue($userRecordModel->getDisplayName() . ' (' . $userRecordModel->getDisplayValue('roleid', false, true) . ')');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$userRecordModel->set('authy_secret_totp', '');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @return void
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'password' => [
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if ($this->climate->arguments->defined('confirmation') || $this->climate->confirm('Re-enter login?')->confirmed()) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$userRecordModel = \Users_Record_Model::getInstanceById($row['id'], 'Users');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$eventHandler->setRecordModel($userRecordModel);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->cli->actionsList('Users');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Reset all user passwords.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'confirmation' => [
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'description' => 'Don\'t ask for confirmation',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$eventHandler->setModuleName('Users');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$token = \App\Utils\Tokens::generate('Users_LoginForgotPassword_Action', [$userRecordModel->getId()], $expirationDate);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'recordId' => $userRecordModel->getId(),
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
/**
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Disable 2FA or LDAP auth of any user.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$row = (new \App\Db\Query())->select(['id', 'deleted'])->from('vtiger_users')->where(['or', ['user_name' => $userName], ['user_name' => strtolower($userName)]])->limit(1)->one();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (!$this->climate->arguments->defined('action')) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
],
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'confirmation' => [
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if ($this->helpMode) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->climate->arguments->parse();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
} else {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Line exceeds 120 characters; contains 142 characters Open
$this->climate->lightBlue($userRecordModel->getDisplayName() . ' (' . $userRecordModel->getDisplayValue('roleid', false, true) . ')');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$password = \App\Encryption::generateUserPassword();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*/
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public function resetAllPasswords(): void
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$eventHandler->trigger('UsersAfterPasswordChange');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
\App\Mailer::sendFromTemplate([
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*/
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$userRecordModel->save();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
],
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$input = $this->climate->input('Enter login/username:');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$password = $this->climate->arguments->get('password');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
} else {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'expirationDate' => \App\Fields\DateTime::formatToDisplay($expirationDate),
- Exclude checks
Line exceeds 120 characters; contains 142 characters Open
$this->climate->lightBlue('New passwords will be sent to the user\'s e-mail, it is required that the e-mail sending works properly.');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$userRecordModel = \Users_Record_Model::getInstanceById($userId, 'Users');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$userRecordModel->set('date_password_change', date('Y-m-d H:i:s'));
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'description' => 'Login/User name',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
],
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$userRecordModel->set('date_password_change', date('Y-m-d H:i:s'));
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->cli->actionsList('Users');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$eventHandler = new \App\EventHandler();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if ($this->helpMode) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if ($this->climate->confirm('Re-enter login?')->confirmed()) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$userRecordModel->set('login_method', 'PLL_PASSWORD');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$input = $this->climate->input('Enter login/username:');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->climate->red('User not found');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->climate->lightGreen('User inactive!!!');
- Exclude checks
Line exceeds 120 characters; contains 186 characters Open
$row = (new \App\Db\Query())->select(['id', 'deleted'])->from('vtiger_users')->where(['or', ['user_name' => $userName], ['user_name' => strtolower($userName)]])->limit(1)->one();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$userName = $this->climate->arguments->get('login');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$userRecordModel->set('authy_methods', '');
- Exclude checks