mirror of
https://github.com/humhub/humhub.git
synced 2025-01-17 14:18:27 +01:00
Merge branch 'develop' of github.com:humhub/humhub into develop
This commit is contained in:
commit
ba96a15b2f
@ -7,4 +7,4 @@ HumHub Changelog
|
|||||||
- Enh #5841: Possibility to show Members/Followers as list from Space about page
|
- Enh #5841: Possibility to show Members/Followers as list from Space about page
|
||||||
- Enh #5850: Display all levels by default on info logging page
|
- Enh #5850: Display all levels by default on info logging page
|
||||||
- Enh #5864: Use Base URL from general settings for all generated absolute URLs
|
- Enh #5864: Use Base URL from general settings for all generated absolute URLs
|
||||||
|
- Enh #5872: Invalidate active sessions after password changing
|
||||||
|
@ -0,0 +1,25 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
use humhub\components\Migration;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Class m220919_104234_auth_key
|
||||||
|
*/
|
||||||
|
class m220919_104234_auth_key extends Migration
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* {@inheritdoc}
|
||||||
|
*/
|
||||||
|
public function safeUp()
|
||||||
|
{
|
||||||
|
$this->safeAddColumn('user', 'auth_key', $this->string(32)->null());
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@inheritdoc}
|
||||||
|
*/
|
||||||
|
public function safeDown()
|
||||||
|
{
|
||||||
|
$this->safeDropColumn('user', 'auth_key');
|
||||||
|
}
|
||||||
|
}
|
@ -24,6 +24,8 @@ use humhub\modules\user\components\CheckPasswordValidator;
|
|||||||
* @property string $password
|
* @property string $password
|
||||||
* @property string $salt
|
* @property string $salt
|
||||||
* @property string $created_at
|
* @property string $created_at
|
||||||
|
*
|
||||||
|
* @property-read User $user
|
||||||
*/
|
*/
|
||||||
class Password extends ActiveRecord
|
class Password extends ActiveRecord
|
||||||
{
|
{
|
||||||
@ -185,6 +187,7 @@ class Password extends ActiveRecord
|
|||||||
$this->salt = UUID::v4();
|
$this->salt = UUID::v4();
|
||||||
$this->algorithm = $this->defaultAlgorithm;
|
$this->algorithm = $this->defaultAlgorithm;
|
||||||
$this->password = $this->hashPassword($newPassword);
|
$this->password = $this->hashPassword($newPassword);
|
||||||
|
$this->user->auth_key = Yii::$app->security->generateRandomString(32);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getUser()
|
public function getUser()
|
||||||
@ -213,4 +216,15 @@ class Password extends ActiveRecord
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function afterSave($insert, $changedAttributes)
|
||||||
|
{
|
||||||
|
parent::afterSave($insert, $changedAttributes);
|
||||||
|
|
||||||
|
if ($this->user->isAttributeChanged('auth_key') &&
|
||||||
|
$this->user->save() &&
|
||||||
|
$this->user->isCurrentUser()) {
|
||||||
|
Yii::$app->user->switchIdentity($this->user);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -56,6 +56,7 @@ use yii\web\IdentityInterface;
|
|||||||
* @property integer $updated_by
|
* @property integer $updated_by
|
||||||
* @property string $last_login
|
* @property string $last_login
|
||||||
* @property string $authclient_id
|
* @property string $authclient_id
|
||||||
|
* @property string $auth_key
|
||||||
* @property integer $visibility
|
* @property integer $visibility
|
||||||
* @property integer $contentcontainer_id
|
* @property integer $contentcontainer_id
|
||||||
* @property Profile $profile
|
* @property Profile $profile
|
||||||
@ -350,7 +351,7 @@ class User extends ContentContainerActiveRecord implements IdentityInterface, Se
|
|||||||
|
|
||||||
public function getAuthKey()
|
public function getAuthKey()
|
||||||
{
|
{
|
||||||
return $this->guid;
|
return $this->auth_key ?: $this->guid;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function validateAuthKey($authKey)
|
public function validateAuthKey($authKey)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user