Skip to content

Commit fa5b7b4

Browse files
committed
cleanup language files and update readme
1 parent 66bd7c7 commit fa5b7b4

File tree

7 files changed

+109
-45
lines changed

7 files changed

+109
-45
lines changed

README.md

Lines changed: 59 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -110,8 +110,8 @@ twostep
110110
Example to start recording page views using middlware in `web.php`:
111111

112112
```php
113-
Route::group(['middleware' => ['auth', 'twostep']], function () {
114-
Route::get('/', 'WelcomeController@welcome')->name('welcome');
113+
Route::group(['middleware' => ['twostep']], function () {
114+
Route::get('/home', 'HomeController@index')->name('home');
115115
});
116116
```
117117

@@ -121,26 +121,74 @@ Route::group(['middleware' => ['auth', 'twostep']], function () {
121121
* ```/verification/resend```
122122

123123
### Screenshots
124-
![Verification Page](...)
125-
![Locked Page](...)
126-
![Verification Email](...)
124+
![Verification Page](https://s3-us-west-2.amazonaws.com/github-project-images/laravel2step/1-verification-page.jpeg)
125+
![Resent Email Modal](https://s3-us-west-2.amazonaws.com/github-project-images/laravel2step/2-verification-email-resent.jpeg)
126+
![Lock Warning Modal](https://s3-us-west-2.amazonaws.com/github-project-images/laravel2step/3-lock-warning.jpeg)
127+
![Locked Page](https://s3-us-west-2.amazonaws.com/github-project-images/laravel2step/4-lock-screen.jpeg)
128+
![Verification Email](https://s3-us-west-2.amazonaws.com/github-project-images/laravel2step/5-verification-email.jpeg)
127129

128130
### File Tree
129131

130132
```
131-
...
133+
└── laravel2step
134+
├── .gitignore
135+
├── LICENSE
136+
├── README.md
137+
├── composer.json
138+
└── src
139+
├── .env.example
140+
├── Laravel2stepServiceProvider.php
141+
├── app
142+
│   ├── Http
143+
│   │   ├── Controllers
144+
│   │   │   └── TwoStepController.php
145+
│   │   └── Middleware
146+
│   │   └── Laravel2step.php
147+
│   ├── Models
148+
│   │   └── TwoStepAuth.php
149+
│   ├── Notifications
150+
│   │   └── SendVerificationCodeEmail.php
151+
│   └── Traits
152+
│   └── Laravel2StepTrait.php
153+
├── config
154+
│   └── laravel2step.php
155+
├── database
156+
│   └── migrations
157+
│   └── 2017_12_09_070937_create_two_step_auth_table.php
158+
├── public
159+
│   └── css
160+
│   ├── app.css
161+
│   └── app.min.css
162+
├── resources
163+
│   ├── assets
164+
│   │   └── scss
165+
│   │   ├── _animations.scss
166+
│   │   ├── _mixins.scss
167+
│   │   ├── _modals.scss
168+
│   │   ├── _variables.scss
169+
│   │   ├── _verification.scss
170+
│   │   └── app.scss
171+
│   ├── lang
172+
│   │   └── en
173+
│   │   └── laravel-verification.php
174+
│   └── views
175+
│   ├── layouts
176+
│   │   └── app.blade.php
177+
│   ├── partials
178+
│   ├── scripts
179+
│   │   └── input-parsing-auto-stepper.blade.php
180+
│   └── twostep
181+
│   ├── exceeded.blade.php
182+
│   └── verification.blade.php
183+
└── routes
184+
└── web.php
132185
133186
```
134187

135188
* Tree command can be installed using brew: `brew install tree`
136189
* File tree generated using command `tree -a -I '.git|node_modules|vendor|storage|tests`
137190

138191
### Future
139-
* Readme
140-
* Screenshots
141-
* Language file cleanup.
142-
* Cleanup Service provider file.
143-
* Cleanup doc blocks.
144192
* Have more configurable options via the config file to run to env file. For:
145193
* Optional compiled CSS/JS
146194
* Optional use of modals/alerts in front end with optional sweetalert2.js

src/app/Http/Controllers/TwoStepController.php

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -184,16 +184,17 @@ public function verify(Request $request)
184184
* Resend the validation code triggered by user
185185
*
186186
* @return \Illuminate\Http\Response
187-
*
188187
*/
189188
public function resend()
190189
{
191190
$twoStepAuth = $this->_twoStepAuth;
192191
$this->sendVerificationCodeNotification($twoStepAuth);
193192

193+
194+
194195
$returnData = [
195-
'title' => 'Success!',
196-
'message' => 'Verification Email Sent!',
196+
'title' => trans('laravel2step::laravel-verification.verificationEmailSuccess'),
197+
'message' => trans('laravel2step::laravel-verification.verificationEmailSentMsg'),
197198
];
198199

199200
return response()->json($returnData, 200);

src/app/Http/Middleware/Laravel2step.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ class Laravel2step
1616
*
1717
* @param Request $request
1818
* @param \Closure $response
19+
*
1920
* @return mixed
2021
*/
2122
public function handle($request, Closure $next)

src/app/Traits/Laravel2StepTrait.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,9 @@ private function checkTimeSinceVerified($twoStepAuth)
6565

6666
/**
6767
* Reset TwoStepAuth collection item and code
68+
*
6869
* @param collection $twoStepAuth
70+
*
6971
* @return collection
7072
*/
7173
private function resetAuthStatus($twoStepAuth)
@@ -155,8 +157,7 @@ protected function exceededTimeParser($time)
155157
}
156158

157159
/**
158-
* Check if time since account lock has expired and return true
159-
* if account verification can be reset
160+
* Check if time since account lock has expired and return true if account verification can be reset
160161
*
161162
* @param datetime $time
162163
*

src/resources/lang/en/laravel-verification.php

Lines changed: 32 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -7,29 +7,37 @@
77
| Laravel 2 Step Verification Language Lines
88
|--------------------------------------------------------------------------
99
*/
10-
'title' => '2-Step Verification',
11-
'subtitle' => 'Verification Required',
12-
'titleFailed' => 'Verification Failed',
13-
'titlePassed' => 'Good news everyone!',
14-
15-
'inputAlt1' => 'Code Input 1',
16-
'inputAlt2' => 'Code Input 2',
17-
'inputAlt3' => 'Code Input 3',
18-
'inputAlt4' => 'Code Input 4',
19-
20-
'verifyButton' => 'Verify',
21-
'attemptsRemaining' => 'Attempt Remaining|Attempts Remaining',
22-
'missingCode' => 'Didn\'t receive verification code?',
23-
24-
25-
'exceededTitle' => 'Verification Attempts Exceeded',
26-
'lockedUntil' => 'Account Locked Until:',
27-
'tryAgainIn' => 'Try again in',
28-
'returnButton' => 'Return Home',
29-
30-
'verificationEmailSubject' => 'Verification Required',
31-
'verificationEmailGreeting' => 'Hello :username',
32-
'verificationEmailMessage' => 'Your account 2-step verification code is:',
33-
'verificationEmailButton' => 'Verify Now',
10+
'title' => '2-Step Verification',
11+
'subtitle' => 'Verification Required',
12+
'titleFailed' => 'Verification Failed',
13+
'titlePassed' => 'Good news everyone!',
14+
15+
'inputAlt1' => 'Code Input 1',
16+
'inputAlt2' => 'Code Input 2',
17+
'inputAlt3' => 'Code Input 3',
18+
'inputAlt4' => 'Code Input 4',
19+
20+
'verifyButton' => 'Verify',
21+
'attemptsRemaining' => 'Attempt Remaining|Attempts Remaining',
22+
'missingCode' => 'Didn\'t receive verification code?',
23+
24+
'exceededTitle' => 'Verification Attempts Exceeded',
25+
'lockedUntil' => 'Account Locked Until:',
26+
'tryAgainIn' => 'Try again in',
27+
'returnButton' => 'Return Home',
28+
29+
'verificationEmailSubject' => 'Verification Required',
30+
'verificationEmailGreeting' => 'Hello :username',
31+
'verificationEmailMessage' => 'Your account 2-step verification code is:',
32+
'verificationEmailButton' => 'Verify Now',
33+
34+
'verificationEmailSuccess' => 'Success!',
35+
'verificationEmailSentMsg' => 'Verification Email Sent!',
36+
37+
'verificationWarningTitle' => 'Warning!',
38+
'verificationWarningMessage' => 'This is your last attempt before your account locks for :hours hours.',
39+
40+
'verificationLockedTitle' => 'Doh!',
41+
'verificationLockedMessage' => 'Account Locked!',
3442

3543
];

src/resources/views/layouts/app.blade.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous">
1212

1313
{{-- Local Option --}}
14-
{{-- <link rel="stylesheet" type="text/css" href="{{ asset('css/app.css') }}"> --}}
14+
<link rel="stylesheet" type="text/css" href="{{ asset('css/app.css') }}">
1515

1616
{{-- Package Styles --}}
1717
<link rel="stylesheet" type="text/css" href="{{ asset('css/laravel2step/app.css') }}">

src/resources/views/twostep/verification.blade.php

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,11 @@
137137

138138
@section('foot')
139139

140+
@php
141+
$minutesToExpire = config('laravel2step.laravel2stepExceededCountdownMinutes');
142+
$hoursToExpire = $minutesToExpire / 60;
143+
@endphp
144+
140145
<script type="text/javascript" src="https://code.jquery.com/jquery-3.2.1.min.js"></script>
141146

142147
@include('laravel2step::scripts.input-parsing-auto-stepper');
@@ -175,17 +180,17 @@
175180
case 0:
176181
submitTrigger.addClass('btn-danger');
177182
swal(
178-
'Doh!',
179-
'Account Locked!',
183+
"{{ trans('laravel2step::laravel-verification.verificationLockedTitle') }}",
184+
"{{ trans('laravel2step::laravel-verification.verificationLockedMessage') }}",
180185
'error'
181186
);
182187
break;
183188
184189
case 1:
185190
submitTrigger.addClass('btn-danger');
186191
swal(
187-
'Warning!',
188-
'This is your last attempt before your account locks for 24 hours.',
192+
"{{ trans('laravel2step::laravel-verification.verificationWarningTitle') }}",
193+
"{{ trans('laravel2step::laravel-verification.verificationWarningMessage', ['hours' => $hoursToExpire, 'minutes' => $minutesToExpire,]) }}",
189194
'error'
190195
);
191196
break;

0 commit comments

Comments
 (0)