1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-11-10 21:22:58 +01:00

Merge pull request #5176 from turbo124/v5-stable

Fixes for 2fa
This commit is contained in:
David Bomba 2021-03-18 22:47:46 +11:00 committed by GitHub
commit a005716ca5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 39 additions and 4 deletions

View File

@ -171,7 +171,7 @@ class LoginController extends BaseController
//if user has 2fa enabled - lets check this now:
if($user->google_2fa_secret)
if($user->google_2fa_secret && $request->has('one_time_password'))
{
$google2fa = new Google2FA();
@ -184,6 +184,13 @@ class LoginController extends BaseController
}
}
elseif($user->google_2fa_secret && !$request->has('one_time_password')) {
return response()
->json(['message' => ctrans('texts.invalid_one_time_password')], 401)
->header('X-App-Version', config('ninja.app_version'))
->header('X-Api-Version', config('ninja.minimum_client_version'));
}
$user->setCompany($user->account->default_company);
$timeout = auth()->user()->company()->default_password_timeout;

View File

@ -56,6 +56,7 @@ class TwoFactorController extends BaseController
if($google2fa->verifyKey($secret, $oneTimePassword) && $user->phone && $user->email_verified_at){
$user->google_2fa_secret = encrypt($secret);
$user->save();
return response()->json(['message' => ctrans('texts.enabled_two_factor')], 200);

View File

@ -21,9 +21,6 @@ class NinjaPdf
public function build($html)
{
nlog("building remotely");
$client = new \GuzzleHttp\Client(['headers' =>
[
'X-Ninja-Token' => 'test_token_for_now',

View File

@ -0,0 +1,30 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class Change2faColumnFromVarcharToText extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('users', function (Blueprint $table) {
$table->text('google_2fa_secret')->change();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
}
}