Passed
Push — develop ( 319bd8...330c7a )
by Neill
16:41 queued 15s
created
neon/user/controllers/InviteController.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -87,11 +87,11 @@
 block discarded – undo
87 87
 			// allow authenticated users if invites are allowed
88 88
 			[
89 89
 				'allow' => setting('user', 'allowUserInvitations', false),
90
-				'roles' => [ 'neon-administrator' ]
90
+				'roles' => ['neon-administrator']
91 91
 			],
92 92
 			[
93 93
 				'allow' => setting('user', 'allowUserInvitations', false),
94
-				'matchCallback' => function ($rule, $action) {
94
+				'matchCallback' => function($rule, $action) {
95 95
 					return neon()->user->isSuper();
96 96
 				}
97 97
 			]
Please login to merge, or discard this patch.
neon/user/forms/UserEdit.php 1 patch
Braces   +12 added lines, -8 removed lines patch added patch discarded remove patch
@@ -27,15 +27,18 @@  discard block
 block discarded – undo
27 27
 			$user->username = $this->getField('username')->getValue();
28 28
 			$user->email = $this->getField('email')->getValue();
29 29
 			$password = $this->getField('password')->getValue();
30
-			if (strlen($password) >= setting('user', 'minimumPasswordLength', self::MIN_PASSWORD_LENGTH))
31
-				$user->setPassword($password);
30
+			if (strlen($password) >= setting('user', 'minimumPasswordLength', self::MIN_PASSWORD_LENGTH)) {
31
+							$user->setPassword($password);
32
+			}
32 33
 			$user->generateAuthKey();
33 34
 			$user->status = $this->getField('status')->getValue();
34
-			if (neon()->user->isSuper())
35
-				$user->super = $this->getField('super')->getValue();
35
+			if (neon()->user->isSuper()) {
36
+							$user->super = $this->getField('super')->getValue();
37
+			}
36 38
 			$success = $user->save();
37
-			if ($success)
38
-				$user->setRoles($this->getField('roles')->getValue());
39
+			if ($success) {
40
+							$user->setRoles($this->getField('roles')->getValue());
41
+			}
39 42
 		}
40 43
 		return $success;
41 44
 	}
@@ -43,7 +46,8 @@  discard block
 block discarded – undo
43 46
 	public function load($user = null)
44 47
 	{
45 48
 		parent::load($user);
46
-		if ($user)
47
-			$this->getField('roles')->setValue($user->getRoles());
49
+		if ($user) {
50
+					$this->getField('roles')->setValue($user->getRoles());
51
+		}
48 52
 	}
49 53
 }
Please login to merge, or discard this patch.
neon/user/forms/UserCreate.php 2 patches
Braces   +9 added lines, -6 removed lines patch added patch discarded remove patch
@@ -25,8 +25,9 @@  discard block
 block discarded – undo
25 25
 				'unique' => ['targetClass' => '\neon\user\models\User', 'message' => 'This username has already been taken.'],
26 26
 				'string' => ['min' => 2, 'max' => 255]
27 27
 		];
28
-		if ($this->editing)
29
-			unset($userNameValidators['unique']);
28
+		if ($this->editing) {
29
+					unset($userNameValidators['unique']);
30
+		}
30 31
 		$this->addFieldText('username')
31 32
 			->setLabel('Username')
32 33
 			->setValidators($userNameValidators);
@@ -38,8 +39,9 @@  discard block
 block discarded – undo
38 39
 				'string' => ['min'=>5, 'max' => 255],
39 40
 				'unique' => ['targetClass' => '\neon\user\models\User', 'message' => 'This email address has already been taken.']
40 41
 			];
41
-		if ($this->editing)
42
-			unset($emailValidators['unique']);
42
+		if ($this->editing) {
43
+					unset($emailValidators['unique']);
44
+		}
43 45
 		$this->addFieldEmail('email')
44 46
 			->setLabel('Email')
45 47
 			->setValidators($emailValidators);
@@ -105,8 +107,9 @@  discard block
 block discarded – undo
105 107
 			$user->username = $this->getField('username')->getValue();
106 108
 			$user->email = $this->getField('email')->getValue();
107 109
 			$user->setPassword($this->getField('password')->getValue());
108
-			if (neon()->user->isSuper())
109
-				$user->super = $this->getField('super')->getValue();
110
+			if (neon()->user->isSuper()) {
111
+							$user->super = $this->getField('super')->getValue();
112
+			}
110 113
 			$user->generateAuthKey();
111 114
 			$success = $user->save();
112 115
 			if ($success) {
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -98,7 +98,7 @@
 block discarded – undo
98 98
 		return $roleItems;
99 99
 	}
100 100
 
101
-	public function signupNewUser(&$user=null)
101
+	public function signupNewUser(&$user = null)
102 102
 	{
103 103
 		if ($this->validate()) {
104 104
 			$userClass = neon()->getUser()->identityClass;
Please login to merge, or discard this patch.
neon/user/forms/PasswordResetRequest.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -68,7 +68,7 @@
 block discarded – undo
68 68
 				return neon()->mailer->compose($templates, $templateData)
69 69
 					->setFrom([$fromAddress => $fromName])
70 70
 					->setTo($this->email)
71
-					->setSubject('Password reset for ' . $siteName)
71
+					->setSubject('Password reset for '.$siteName)
72 72
 					->send();
73 73
 			}
74 74
 		}
Please login to merge, or discard this patch.
Braces   +3 added lines, -2 removed lines patch added patch discarded remove patch
@@ -48,8 +48,9 @@
 block discarded – undo
48 48
 			if ($user->save()) {
49 49
 				$fromName = setting('admin', 'fromEmailName', neon()->name);
50 50
 				$fromAddress = setting('admin', 'fromEmailAddress', 'system@'.neon()->request->getHostName());
51
-				if (!$fromAddress)
52
-					throw new \Exception('The From Address needs to be set in the admin section for emails');
51
+				if (!$fromAddress) {
52
+									throw new \Exception('The From Address needs to be set in the admin section for emails');
53
+				}
53 54
 
54 55
 				$templates = [
55 56
 					'html' => '@neon/user/views/mail/passwordResetToken-html',
Please login to merge, or discard this patch.
neon/user/forms/UserInvite.php 1 patch
Braces   +3 added lines, -2 removed lines patch added patch discarded remove patch
@@ -70,8 +70,9 @@
 block discarded – undo
70 70
 				$user = new User;
71 71
 				$user->email = $this->getField('email')->getValue();
72 72
 				$user->status = User::STATUS_PENDING;
73
-				if (neon()->user->isSuper())
74
-					$user->super = $this->getField('super')->getValue();
73
+				if (neon()->user->isSuper()) {
74
+									$user->super = $this->getField('super')->getValue();
75
+				}
75 76
 				$user->setPassword(neon()->security->generateRandomString(32));
76 77
 				if (!$user->save()) {
77 78
 					return false;
Please login to merge, or discard this patch.
neon/user/migrations/m20200407_122322_user_store_user_uuid.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -14,7 +14,7 @@
 block discarded – undo
14 14
 		// the key fields in this table are responsible for the session
15 15
 		// this is the session id, expire and data fields.  After that the next important field is the user_uuid
16 16
 		// then the following additional information fields
17
-		$this->addColumn(\neon\user\models\Session::tableName(), 'user_uuid', $this->uuid64()  .' AFTER `data`');
17
+		$this->addColumn(\neon\user\models\Session::tableName(), 'user_uuid', $this->uuid64().' AFTER `data`');
18 18
 	}
19 19
 
20 20
 	public function safeDown()
Please login to merge, or discard this patch.
neon/user/migrations/m170104_26042017_user_api_tokens.php 1 patch
Indentation   +21 added lines, -21 removed lines patch added patch discarded remove patch
@@ -6,30 +6,30 @@
 block discarded – undo
6 6
 class m170104_26042017_user_api_tokens extends Migration
7 7
 {
8 8
 
9
-    /**
10
-     * @inheritdoc
11
-     * Install the User, AuthRule, AuthItem, AuthItemChild, AuthAssignment tables
12
-     */
9
+	/**
10
+	 * @inheritdoc
11
+	 * Install the User, AuthRule, AuthItem, AuthItemChild, AuthAssignment tables
12
+	 */
13 13
 	public function safeUp()
14
-    {
14
+	{
15 15
 		$sql = "DROP TABLE IF EXISTS ".UserApiToken::tableName();
16 16
 		\Yii::$app->getDb()->createCommand($sql)->execute();
17 17
 
18
-	    $this->createTable(UserApiToken::tableName(), [
19
-		    'token'=>'varchar(64) PRIMARY KEY COMMENT "The token"',
20
-	    	'name' => 'varchar(100) COMMENT "A name for this token"',
21
-		    'user_id'=>'int COMMENT "foreign key of the user who owns this token"',
22
-		    'active'=>'int not null default 0 COMMENT "whether the token is currently active, 1 is an active token, 0 is a non active token and will not produce successful requests"',
23
-		    'last_used'=>'datetime COMMENT "store the date and time of the last request that used this token"',
24
-		    'used_count'=>'int not null default 0 COMMENT "number of times this token has been used"',
25
-		    // timestamps
26
-		    'created_at' =>  $this->createdAt(),
27
-		    'updated_at' =>  $this->updatedAt(),
28
-	    ]);
29
-    }
18
+		$this->createTable(UserApiToken::tableName(), [
19
+			'token'=>'varchar(64) PRIMARY KEY COMMENT "The token"',
20
+			'name' => 'varchar(100) COMMENT "A name for this token"',
21
+			'user_id'=>'int COMMENT "foreign key of the user who owns this token"',
22
+			'active'=>'int not null default 0 COMMENT "whether the token is currently active, 1 is an active token, 0 is a non active token and will not produce successful requests"',
23
+			'last_used'=>'datetime COMMENT "store the date and time of the last request that used this token"',
24
+			'used_count'=>'int not null default 0 COMMENT "number of times this token has been used"',
25
+			// timestamps
26
+			'created_at' =>  $this->createdAt(),
27
+			'updated_at' =>  $this->updatedAt(),
28
+		]);
29
+	}
30 30
 
31
-    public function safeDown()
32
-    {
33
-	    $this->dropTable(UserApiToken::tableName());
34
-    }
31
+	public function safeDown()
32
+	{
33
+		$this->dropTable(UserApiToken::tableName());
34
+	}
35 35
 }
Please login to merge, or discard this patch.
neon/user/migrations/m181128_143758_user_create_invite_table.php 2 patches
Indentation   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -7,17 +7,17 @@
 block discarded – undo
7 7
 {
8 8
 	public function safeUp()
9 9
 	{
10
-	    $this->createTable(UserInvite::tableName(), [
11
-		    'token'=>'varchar(255) CHARACTER SET latin1 COLLATE latin1_general_cs PRIMARY KEY COMMENT "The token"',
12
-		    'user_id'=> $this->uuid64( 'foreign key of the user who owns this token')->notNull(),
13
-		    // timestamps
14
-		    'expires_at' => $this->dateTime(),
15
-		    'created_at' => $this->createdAt(),
16
-		    'updated_at' => $this->updatedAt(),
17
-		    // blames
18
-		    'created_by' => $this->createdBy(),
19
-		    'updated_by' => $this->updatedBy()
20
-	    ]);
10
+		$this->createTable(UserInvite::tableName(), [
11
+			'token'=>'varchar(255) CHARACTER SET latin1 COLLATE latin1_general_cs PRIMARY KEY COMMENT "The token"',
12
+			'user_id'=> $this->uuid64( 'foreign key of the user who owns this token')->notNull(),
13
+			// timestamps
14
+			'expires_at' => $this->dateTime(),
15
+			'created_at' => $this->createdAt(),
16
+			'updated_at' => $this->updatedAt(),
17
+			// blames
18
+			'created_by' => $this->createdBy(),
19
+			'updated_by' => $this->updatedBy()
20
+		]);
21 21
 	}
22 22
 
23 23
 	public function safeDown()
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -9,7 +9,7 @@
 block discarded – undo
9 9
 	{
10 10
 	    $this->createTable(UserInvite::tableName(), [
11 11
 		    'token'=>'varchar(255) CHARACTER SET latin1 COLLATE latin1_general_cs PRIMARY KEY COMMENT "The token"',
12
-		    'user_id'=> $this->uuid64( 'foreign key of the user who owns this token')->notNull(),
12
+		    'user_id'=> $this->uuid64('foreign key of the user who owns this token')->notNull(),
13 13
 		    // timestamps
14 14
 		    'expires_at' => $this->dateTime(),
15 15
 		    'created_at' => $this->createdAt(),
Please login to merge, or discard this patch.
neon/user/migrations/m140506_102106_user_init.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -71,22 +71,22 @@
 block discarded – undo
71 71
 			'created_at' => $this->integer(),
72 72
 			'updated_at' => $this->integer(),
73 73
 			'PRIMARY KEY (name)',
74
-			'FOREIGN KEY (rule_name) REFERENCES ' . neon()->authManager->ruleTable . ' (name) ON DELETE SET NULL ON UPDATE CASCADE'
74
+			'FOREIGN KEY (rule_name) REFERENCES '.neon()->authManager->ruleTable.' (name) ON DELETE SET NULL ON UPDATE CASCADE'
75 75
 		]);
76 76
 		$this->createIndex('idx-auth_item-type', AuthItem::tableName(), 'type');
77 77
 		$this->createTable(AuthItemChild::tableName(), [
78 78
 			'parent' => $this->string(64)->notNull(),
79 79
 			'child' => $this->string(64)->notNull(),
80 80
 			'PRIMARY KEY (parent, child)',
81
-			'FOREIGN KEY (parent) REFERENCES ' . neon()->authManager->itemTable . ' (name) ON DELETE CASCADE ON UPDATE CASCADE',
82
-			'FOREIGN KEY (child) REFERENCES ' . neon()->authManager->itemTable  . ' (name) ON DELETE CASCADE ON UPDATE CASCADE'
81
+			'FOREIGN KEY (parent) REFERENCES '.neon()->authManager->itemTable.' (name) ON DELETE CASCADE ON UPDATE CASCADE',
82
+			'FOREIGN KEY (child) REFERENCES '.neon()->authManager->itemTable.' (name) ON DELETE CASCADE ON UPDATE CASCADE'
83 83
 		]);
84 84
 		$this->createTable(AuthAssignment::tableName(), [
85 85
 			'item_name' => $this->string(64)->notNull(),
86 86
 			'user_id' => $this->string(64)->notNull(),
87 87
 			'created_at' => $this->integer(),
88 88
 			'PRIMARY KEY (item_name, user_id)',
89
-			'FOREIGN KEY (item_name) REFERENCES ' . neon()->authManager->itemTable . ' (name) ON DELETE CASCADE ON UPDATE CASCADE',
89
+			'FOREIGN KEY (item_name) REFERENCES '.neon()->authManager->itemTable.' (name) ON DELETE CASCADE ON UPDATE CASCADE',
90 90
 		]);
91 91
 		$this->createTable(Session::tableName(), [
92 92
 			'id' => 'CHAR(64) NOT NULL PRIMARY KEY',
Please login to merge, or discard this patch.