Skip to content

Commit f1b92bc

Browse files
committed
Merge branch 'master' of github.com:thecodework/two-factor-authentication
2 parents 5e9204d + 735f859 commit f1b92bc

File tree

2 files changed

+10
-14
lines changed

2 files changed

+10
-14
lines changed

README.md

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,12 @@
11
[![Build Status](https://travis-ci.org/thecodework/two-factor-authentication.svg?branch=master)](https://travis-ci.org/thecodework/two-factor-authentication)
22
[![Scrutinizer Code Quality](https://scrutinizer-ci.com/g/thecodework/two-factor-authentication/badges/quality-score.png?b=master)](https://scrutinizer-ci.com/g/thecodework/two-factor-authentication/?branch=master)
33
[![StyleCI](https://styleci.io/repos/85341644/shield?branch=master)](https://styleci.io/repos/85341644)
4-
[![Total Downloads](https://poser.pugx.org/thecodework/two-factor-authentication/downloads)](https://packagist.org/packages/thecodework/two-factor-authentication)
54
[![License](https://poser.pugx.org/thecodework/two-factor-authentication/license)](https://packagist.org/packages/thecodework/two-factor-authentication)
65

76
# Laravel Two Factor Authentication
87

98
Two Factor Authentication is an extra security layer for your application. Two Factor authentication implements TOTP defined in [RFC 6238](https://tools.ietf.org/html/rfc6238)
109

11-
This package lets you setup your two factor authentication for your existing laravel applicaiton within a minute.
1210
## Requirements
1311
- PHP >= 7.0
1412
- Laravel >= 5.3

src/Http/Controllers/TwoFactorAuthenticationController.php

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -37,10 +37,10 @@ public function setupTwoFactorAuthentication(Request $request)
3737
$barcode = $totp->getQrCodeUri();
3838

3939
// Return Barcode image if ajax Request
40-
if($request->ajax())
41-
{
40+
if ($request->ajax()) {
4241
return $barcode;
4342
}
43+
4444
return view('2fa::setup', compact('barcode', 'user'));
4545
}
4646

@@ -57,12 +57,12 @@ public function enableTwoFactorAuthentication(Request $request)
5757
$user->is_two_factor_enabled = 1;
5858
$user->update();
5959

60-
if ($request-ajax()) {
60+
if ($request - ajax()) {
6161
return [
6262
'data' => [
6363
'message' => 'success',
64-
'description' => '2FA Enabled'
65-
]
64+
'description' => '2FA Enabled',
65+
],
6666
];
6767
}
6868
return redirect('home');
@@ -82,12 +82,12 @@ public function disableTwoFactorAuthentication(Request $request)
8282
$user->two_factor_secret_key = null;
8383
$user->update();
8484

85-
if ($request-ajax()) {
85+
if ($request - ajax()) {
8686
return [
8787
'data' => [
8888
'message' => 'success',
89-
'description' => '2FA Disabled'
90-
]
89+
'description' => '2FA Disabled',
90+
],
9191
];
9292
}
9393
return redirect('home');
@@ -122,8 +122,7 @@ public function verifyTwoFactorAuthentication(Request $request)
122122
* @return string
123123
*/
124124
private function base32EncodedString($length = 30):
125-
string
126-
{
125+
string {
127126
return Base32::encode($this->strRandom($length));
128127
}
129128

@@ -135,8 +134,7 @@ private function base32EncodedString($length = 30):
135134
* @return string
136135
*/
137136
private function strRandom($length = 30):
138-
string
139-
{
137+
string{
140138
$string = '';
141139

142140
while (($len = strlen($string)) < $length) {

0 commit comments

Comments
 (0)