From 2d5777252897ab63e46c70efc931a62ec490f0fc Mon Sep 17 00:00:00 2001 From: BlameDylan Date: Tue, 8 Dec 2015 18:28:49 -0600 Subject: [PATCH] Migrate ability to reset passwords --- .../Controllers/Auth/PasswordController.php | 1 + app/Http/Routes/AuthRoutes.php | 8 +++ resources/lang/en/auth.php | 3 + resources/lang/en/strings.php | 1 + resources/views/auth/password.blade.php | 48 ++++++++++++++++ resources/views/auth/reset.blade.php | 56 +++++++++++++++++++ resources/views/emails/password.blade.php | 14 +++++ 7 files changed, 131 insertions(+) create mode 100644 resources/views/auth/password.blade.php create mode 100644 resources/views/auth/reset.blade.php create mode 100644 resources/views/emails/password.blade.php diff --git a/app/Http/Controllers/Auth/PasswordController.php b/app/Http/Controllers/Auth/PasswordController.php index 31872410a..2bdbcc6e3 100644 --- a/app/Http/Controllers/Auth/PasswordController.php +++ b/app/Http/Controllers/Auth/PasswordController.php @@ -19,6 +19,7 @@ class PasswordController extends Controller */ use ResetsPasswords; + protected $redirectTo = '/'; /** * Create a new password controller instance. diff --git a/app/Http/Routes/AuthRoutes.php b/app/Http/Routes/AuthRoutes.php index b6847d32a..8f6f0d081 100644 --- a/app/Http/Routes/AuthRoutes.php +++ b/app/Http/Routes/AuthRoutes.php @@ -11,6 +11,14 @@ class AuthRoutes { $router->get('login', [ 'as' => 'auth.login', 'uses' => 'Auth\AuthController@getLogin' ]); $router->post('login', [ 'as' => 'auth.login.submit', 'uses' => 'Auth\AuthController@postLogin' ]); + $router->get('password', [ 'as' => 'auth.password', 'uses' => 'Auth\PasswordController@getEmail' ]); + $router->post('password', [ 'as' => 'auth.password.submit', 'uses' => 'Auth\PasswordController@postEmail' ], function () { + return redirect('auth/password')->with('sent', true); + }); + + $router->get('password/verify/{token}', [ 'as' => 'auth.verify', 'uses' => 'Auth\PasswordController@getReset' ]); + $router->post('password/verify', [ 'as' => 'auth.verify.submit', 'uses' => 'Auth\PasswordController@postReset' ]); + $router->get('logout', [ 'as' => 'auth.logout', 'uses' => 'Auth\AuthController@getLogout' ]); }); } diff --git a/resources/lang/en/auth.php b/resources/lang/en/auth.php index a7c01d8dc..87fa9e453 100644 --- a/resources/lang/en/auth.php +++ b/resources/lang/en/auth.php @@ -17,6 +17,9 @@ return [ 'throttle' => 'Too many login attempts. Please try again in :seconds seconds.', 'errorencountered' => 'There was an error encountered while attempting to process this request.', 'resetpassword' => 'Reset Password', + 'confirmpassword' => 'Confirm Password', + 'sendlink' => 'Send Password Reset Link', + 'emailsent' => 'Your password reset email is on its way.', 'remeberme' => 'Remeber Me', ]; diff --git a/resources/lang/en/strings.php b/resources/lang/en/strings.php index ddcca09c7..6b452c4a6 100644 --- a/resources/lang/en/strings.php +++ b/resources/lang/en/strings.php @@ -12,6 +12,7 @@ return [ 'password' => 'Password', 'email' => 'Email', 'whoops' => 'Whoops', + 'success' => 'Success', 'location' => 'Location', 'node' => 'Node', 'connection' => 'Connection', diff --git a/resources/views/auth/password.blade.php b/resources/views/auth/password.blade.php new file mode 100644 index 000000000..ce3a1f5a9 --- /dev/null +++ b/resources/views/auth/password.blade.php @@ -0,0 +1,48 @@ +@extends('layouts.master') + +@section('title', 'Reset Password') + + +@section('right-nav') +@endsection + +@section('sidebar') +@endsection + +@section('content') +
+
+ {{ trans('auth.resetpassword') }} +
+ @if (count($errors) > 0) +
+ {{ trans('strings.whoops') }}! {{ trans('auth.errorencountered') }}

+
    + @foreach ($errors->all() as $error) +
  • {{ $error }}
  • + @endforeach +
+
+ @endif + @if (session('status')) +
+ {{ trans('strings.success') }}! {{ trans('auth.emailsent') }} +
+ @endif +
+ +
+ +
+
+
+
+ {!! csrf_field() !!} + +
+
+
+
+
+
+@endsection diff --git a/resources/views/auth/reset.blade.php b/resources/views/auth/reset.blade.php new file mode 100644 index 000000000..6b972a0a6 --- /dev/null +++ b/resources/views/auth/reset.blade.php @@ -0,0 +1,56 @@ +@extends('layouts.master') + +@section('title', 'Reset Password') + + +@section('right-nav') +@endsection + +@section('sidebar') +@endsection + +@section('content') +
+
+ {{ trans('auth.resetpassword') }} +
+ @if (count($errors) > 0) +
+ {{ trans('strings.whoops') }}! {{ trans('auth.errorencountered') }}

+
    + @foreach ($errors->all() as $error) +
  • {{ $error }}
  • + @endforeach +
+
+ @endif + +
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+
+ {!! csrf_field() !!} + +
+
+
+
+
+
+@endsection diff --git a/resources/views/emails/password.blade.php b/resources/views/emails/password.blade.php new file mode 100644 index 000000000..f6769f190 --- /dev/null +++ b/resources/views/emails/password.blade.php @@ -0,0 +1,14 @@ + + + + Pterodactyl Lost Password Recovery + + +

Pterodactyl Lost Password Recovery

+

Hello there! You are receiving this email because you requested a new password for your Pterodactyl account.

+

Please click the link below to confirm that you wish to change your password. If you did not make this request, or do not wish to continue simply ignore this email and nothing will happen. This link will expire in 1 hour.

+

{{ url('auth/password/verify/'.$token) }}

+

Please do not hesitate to contact us if you belive something is wrong. +

Thanks!
Pterodactyl

+ + \ No newline at end of file