Skip to content

Conversation

@asbiin
Copy link
Member

@asbiin asbiin commented Dec 27, 2017

This will close #164

Based on my fork of pragmarx/google2fa-laravel, see https://github.com/asbiin/google2fa-laravel

Be careful to update the time of the machine/VM to make it works :

sudo service ntp stop
sudo ntpd -gq
sudo service ntp start 

Option is not activated by default, update your .env to add
2FA_ENABLED=true

This is a 1st release, which can:

  • add a new device
  • verify authentication code when logging
  • remove a device (checked with authentication code)

Still need to do :

  • using some Vue layout for the 2FA activation
  • Add recovery codes
  • Nice documentation to explain how to use it

Copy link
Member

@djaiss djaiss left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Excellent work, it works on my machine so far. I've added a few comments.
Also, don't forget the localization as well!

Finally, what do you think of moving both 2FA and password change to a new Security tab under Settings?

{{ csrf_field() }}

@if ($errors->has('totp'))
<span class="help-block">
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Indentation seems off here.

@endif
<div class="form-group">
<label for="one_time_password">Enter code</label>
<input type="number" class="form-control" id="one_time_password" name="one_time_password" />
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You could put required here, to enable browser validation of the field.

</div>

<div class="form-group actions">
<button type="submit" class="btn btn-primary">Validate</button>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would be nice to provide a Cancel button here to let users go back to the Login screen.

{{-- code --}}
<div class="form-group">
<label for="one_time_password">Enter code</label>
<input type="number" class="form-control" id="one_time_password" name="one_time_password" />
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can add required parameter here a well.

AWS_BUCKET=
AWS_SERVER=

2FA_ENABLED=false
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you add a comment here on what 2FA is and does?

@asbiin asbiin changed the title [wip] 2FA Two Authentication Factor #164 2FA Two Authentication Factor #164 Jan 6, 2018
@asbiin
Copy link
Member Author

asbiin commented Jan 7, 2018

SonarQube analysis reported 3 issues

  • MINOR 2 minor
  • INFO 1 info

Watch the comments in this conversation to review them.

public function up()
{
Schema::table('users', function ($table) {
$table->string('google2fa_secret')->nullable();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you put $table->string('google2fa_secret')->after('remember_token')->nullable(); instead?

That way, the new field won't be at the latest position in the table.

@djaiss djaiss merged commit 620c5de into monicahq:master Jan 8, 2018
turtles2 pushed a commit to turtles2/monica that referenced this pull request Jan 9, 2018
@asbiin asbiin deleted the 164-2FA-two-factor-auth branch January 9, 2018 08:33
$user = $request->user();

//generate image for QR barcode
$imageDataUri = Google2FA::getQRCodeInline(
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure if it's an issue, but static analysis says that this is an instance method, called statically

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You're right, we should use app('pragmarx.google2fa')->getQRCodeInline instead.
Thanks !
Do you want to open an issue ?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Or just add it to the (great) PR #878

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Have added

@github-actions
Copy link

This pull request has been automatically locked since there
has not been any recent activity after it was closed.
Please open a new issue for related bugs.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Feb 15, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2FA

3 participants