mirror of
https://github.com/elyby/accounts.git
synced 2025-05-31 14:11:46 +05:30
Add totp field for Minecraft auth protocol to login into accounts, protected with 2FA [deploy]
This commit is contained in:
@ -29,6 +29,11 @@ class AuthenticationForm extends ApiForm {
|
||||
*/
|
||||
public $password;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
public $totp;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
@ -42,6 +47,7 @@ class AuthenticationForm extends ApiForm {
|
||||
public function rules(): array {
|
||||
return [
|
||||
[['username', 'password', 'clientToken'], RequiredValidator::class],
|
||||
[['totp'], 'string'],
|
||||
[['clientToken'], ClientTokenValidator::class],
|
||||
[['requestUser'], 'boolean'],
|
||||
];
|
||||
@ -65,6 +71,7 @@ class AuthenticationForm extends ApiForm {
|
||||
$loginForm = new LoginForm();
|
||||
$loginForm->login = $this->username;
|
||||
$loginForm->password = $this->password;
|
||||
$loginForm->totp = $this->totp;
|
||||
if (!$loginForm->validate() || $loginForm->getAccount()->status === Account::STATUS_DELETED) {
|
||||
$errors = $loginForm->getFirstErrors();
|
||||
if (isset($errors['totp'])) {
|
||||
|
Reference in New Issue
Block a user