mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2024-11-10 21:22:58 +01:00
commit
a005716ca5
@ -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;
|
||||
|
@ -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);
|
||||
|
@ -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',
|
||||
|
@ -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()
|
||||
{
|
||||
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user