Issues (1020)

Security Analysis    no vulnerabilities found

This project does not seem to handle request data directly as such no vulnerable execution paths were found.

  Cross-Site Scripting
Cross-Site Scripting enables an attacker to inject code into the response of a web-request that is viewed by other users. It can for example be used to bypass access controls, or even to take over other users' accounts.
  File Exposure
File Exposure allows an attacker to gain access to local files that he should not be able to access. These files can for example include database credentials, or other configuration files.
  File Manipulation
File Manipulation enables an attacker to write custom data to files. This potentially leads to injection of arbitrary code on the server.
  Object Injection
Object Injection enables an attacker to inject an object into PHP code, and can lead to arbitrary code execution, file exposure, or file manipulation attacks.
  Code Injection
Code Injection enables an attacker to execute arbitrary code on the server.
  Response Splitting
Response Splitting can be used to send arbitrary responses.
  File Inclusion
File Inclusion enables an attacker to inject custom files into PHP's file loading mechanism, either explicitly passed to include, or for example via PHP's auto-loading mechanism.
  Command Injection
Command Injection enables an attacker to inject a shell command that is execute with the privileges of the web-server. This can be used to expose sensitive data, or gain access of your server.
  SQL Injection
SQL Injection enables an attacker to execute arbitrary SQL code on your database server gaining access to user data, or manipulating user data.
  XPath Injection
XPath Injection enables an attacker to modify the parts of XML document that are read. If that XML document is for example used for authentication, this can lead to further vulnerabilities similar to SQL Injection.
  LDAP Injection
LDAP Injection enables an attacker to inject LDAP statements potentially granting permission to run unauthorized queries, or modify content inside the LDAP tree.
  Header Injection
  Other Vulnerability
This category comprises other attack vectors such as manipulating the PHP runtime, loading custom extensions, freezing the runtime, or similar.
  Regex Injection
Regex Injection enables an attacker to execute arbitrary code in your PHP process.
  XML Injection
XML Injection enables an attacker to read files on your local filesystem including configuration files, or can be abused to freeze your web-server process.
  Variable Injection
Variable Injection enables an attacker to overwrite program variables with custom data, and can lead to further vulnerabilities.
Unfortunately, the security analysis is currently not available for your project. If you are a non-commercial open-source project, please contact support to gain access.

models/Account.php (5 issues)

Upgrade to new PHP Analysis Engine

These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more

1
<?php
2
/**
3
 * This is the model class for table "account".
4
 *
5
 * The followings are the available columns in table 'account':
6
 * @property integer $id
7
 * @property string $email
8
 * @property string $password
9
 * @property string $verifyCode
10
 * @property string $verified
11
 * @property string $emailTemp
12
 */
13
class Account extends CActiveRecord
14
{
15
    public $oldPassword;
16
    public $confirmPassword;
17
    public $acceptTerms;
18
19
    private $identity;
20
21
    /**
22
     * Returns the static model of the specified AR class.
23
     * @param string $className active record class name.
24
     * @return Account the static model class
25
     */
26
    public static function model($className = __CLASS__)
27
    {
28
        return parent::model($className);
29
    }
30
31
    /**
32
     * @return string the associated database table name
33
     */
34
    public function tableName()
35
    {
36
        return 'account';
37
    }
38
39
    /**
40
     * @return array validation rules for model attributes.
41
     */
42
    public function rules()
43
    {
44
        return array(
45
            array('oldPassword', 'required', 'on'=>'changePassword', 'message'=>'A {attribute} kitöltése kötelező.'),
46
            array('username', 'required', 'on'=>array('completeSignup', 'signupNoMail'), 'message'=>'A {attribute} kitöltése kötelező.'),
47
            array('username', 'unique', 'on'=>array('completeSignup', 'signupNoMail'), 'message'=>'A választott {attribute} már foglalt.'),
48
            array('username', 'length', 'min'=>4, 'max'=>16, 'on'=>array('login', 'completeSignup', 'signupNoMail')),
49
            array('username', 'match', 'pattern' => '/^[A-Za-z0-9-]+$/u', 'on'=>array('login','completeSignup', 'signupNoMail'), 'message'=>'A {attribute} csak a következő karakterekből állhat: A-Z, a-z, 0-9 és -'),
50
            array('username', 'match', 'pattern' => '/^[A-Za-z]+/u', 'on'=>array('login', 'completeSignup', 'signupNoMail'), 'message'=>'A {attribute} csak a betűvel kezdődhet.'),
51
            array('username', 'match', 'pattern' => '/(\-).*(\-)/u', 'not'=>true, 'on'=>array('login', 'completeSignup', 'signupNoMail'), 'message'=>'A {attribute} csak egy kötőjelet tartalmazhat.'),
52
            array('email', 'required', 'on'=>array('signupWithMail','login','changeEmail','resetPassword'), 'message'=>'Az {attribute} kitöltése kötelező.'),
53
            array('email', 'length', 'max'=>128, 'on'=>array('signupWithMail','changeEmail')),
54
            array('email', 'email', 'on'=>array('signupWithMail','changeEmail'), 'message'=>'Az {attribute} nem érvényes.'),
55
            array('email', 'unique', 'on'=>array('signupWithMail','changeEmail'), 'message'=>'A választott {attribute} már foglalt.'),
56
            array('email', 'exist', 'on'=>'resetPassword'),
57
            array('password', 'required', 'on'=>array('login', 'completeSignup', 'signupNoMail', 'changeEmail','changePassword','completeResetPassword','desactivate'), 'message'=>'A {attribute} kitöltése kötelező.'),
58
            array('password', 'length', 'min'=>6, 'max'=>255, 'on'=>array('completeSignup', 'signupNoMail','changePassword','completeResetPassword')),
59
            array('password', 'match', 'pattern' => '/[A-Za-z]/u', 'on'=>array('completeSignup', 'signupNoMail','changePassword','completeResetPassword'), 'message'=>'A {attribute}nak tartalmaznia kell legalább egy betűt: A-Z, a-z'),
60
            array('password', 'match', 'pattern' => '/[0-9]/u', 'on'=>array('completeSignup', 'signupNoMail','changePassword','completeResetPassword'), 'message'=>'A {attribute}nak tartalmaznia kell legalább egy számot.'),
61
            array('confirmPassword', 'required', 'on'=>array('changePassword','completeResetPassword', 'signupNoMail'), 'message'=>'A {attribute} kitöltése kötelező.'),
62
            array('confirmPassword', 'compare', 'compareAttribute'=>'password', 'on'=>array('changePassword','completeResetPassword', 'signupNoMail')),
63
            array('password', 'authenticate', 'on'=>'login'),
64
            array('verifyCode, verified', 'safe', 'on'=>'completeSignup'),
65
            array('resetPasswordCode, passwordReset', 'safe', 'on'=>'completeResetPassword'),
66
            array('acceptTerms', 'required', 'on'=>array('completeSignup', 'signupNoMail'), 'requiredValue'=>1, 'message'=>'A regisztrációhoz el kell fogadni az általános felhasználói feltételeket.'),
67
        );
68
    }
69
70
    public function attributeLabels()
71
    {
72
        $attributes = [
73
            'username' => 'felhasználónév',
74
            'email' => 'e-mail cím',
75
            'password' => 'jelszó',
76
            'oldPassword' => 'régi jelszó',
77
            'confirmPassword' => 'jelszó újra',
78
            'acceptTerms' => 'Elfogadom az ÁFF-et',
79
            ];
80
        if ($this->scenario == 'login') {
81
            $attributes['email'] = 'e-mail vagy felh.név';
82
        }
83
        return $attributes;
84
    }
85
86
    /**
87
     * @return boolean
88
     */
89
    public function validatePassword($password)
90
    {
91
        return password_verify($password, $this->password);
92
    }
93
94
    /**
95
     * Generates a random code
96
     */
97
    public function generateCode()
98
    {
99
        return md5(mt_rand());
100
    }
101
102
    /**
103
     * Authenticates the password.
104
     * This is the 'authenticate' validator as declared in rules().
105
     */
106
    public function authenticate($attribute, $params)
107
    {
108
        if (!$this->hasErrors()) {
109
            $this->identity=new UserIdentity($this->email, $this->password);
0 ignored issues
show
Equals sign not aligned correctly; expected 1 space but found 0 spaces

This check looks for improperly formatted assignments.

Every assignment must have exactly one space before and one space after the equals operator.

To illustrate:

$a = "a";
$ab = "ab";
$abc = "abc";

will have no issues, while

$a   = "a";
$ab  = "ab";
$abc = "abc";

will report issues in lines 1 and 2.

Loading history...
110
            if (!$this->identity->authenticate()) {
111
                if ($this->identity->findEmail) {
0 ignored issues
show
The property findEmail cannot be accessed from this context as it is declared private in class UserIdentity.

This check looks for access to properties that are not accessible from the current context.

If you need to make a property accessible to another context you can either raise its visibility level or provide an accessible getter in the defining class.

Loading history...
112
                    $this->addError('validation', 'A megadott e-mail cím és jelszó nem érvényes.');
113
                } else {
114
                    $this->addError('validation', 'A megadott felhasználónév és jelszó nem érvényes.');
115
                }
116
            }
117
        }
118
    }
119
120
    /**
121
     * Logs in the user using the given username and password in the model.
122
     * @return boolean whether login is successful
123
     */
124
    public function login()
125
    {
126
        if ($this->identity===null) {
127
            $this->identity=new UserIdentity($this->email, $this->password);
0 ignored issues
show
Equals sign not aligned correctly; expected 1 space but found 0 spaces

This check looks for improperly formatted assignments.

Every assignment must have exactly one space before and one space after the equals operator.

To illustrate:

$a = "a";
$ab = "ab";
$abc = "abc";

will have no issues, while

$a   = "a";
$ab  = "ab";
$abc = "abc";

will report issues in lines 1 and 2.

Loading history...
128
            $this->identity->authenticate();
129
        }
130
131
        if ($this->identity->errorCode===UserIdentity::ERROR_NONE) {
132
            $duration = 3600*24*30; // 30 days
133
            Yii::app()->user->login($this->identity, $duration);
134
            Yii::app()->session['uid'] = $this->identity->uid;
0 ignored issues
show
The property uid cannot be accessed from this context as it is declared private in class UserIdentity.

This check looks for access to properties that are not accessible from the current context.

If you need to make a property accessible to another context you can either raise its visibility level or provide an accessible getter in the defining class.

Loading history...
135
136
            return true;
137
        } else {
138
            return false;
139
        }
140
    }
141
142
    /**
143
     * Finds an account by email
144
     * @param string $email The email
145
     * @return Account
146
     */
147
    public function findByEmail($email)
148
    {
149
        return $this->find('LOWER(email)=?', array(strtolower($email)));
150
    }
151
}
0 ignored issues
show
As per coding style, files should not end with a newline character.

This check marks files that end in a newline character, i.e. an empy line.

Loading history...
152