Skip to content

Commit

Permalink
Merge pull request #1 from DDynamic/development
Browse files Browse the repository at this point in the history
Migrate ability to reset passwords
  • Loading branch information
DaneEveritt committed Dec 9, 2015
2 parents f47f0cd + 2d57772 commit ff063c3
Show file tree
Hide file tree
Showing 7 changed files with 131 additions and 0 deletions.
1 change: 1 addition & 0 deletions app/Http/Controllers/Auth/PasswordController.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ class PasswordController extends Controller
*/

use ResetsPasswords;
protected $redirectTo = '/';

/**
* Create a new password controller instance.
Expand Down
8 changes: 8 additions & 0 deletions app/Http/Routes/AuthRoutes.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,14 @@ public function map(Router $router) {
$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' ]);
});
}
Expand Down
3 changes: 3 additions & 0 deletions resources/lang/en/auth.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@
'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',

];
1 change: 1 addition & 0 deletions resources/lang/en/strings.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
'password' => 'Password',
'email' => 'Email',
'whoops' => 'Whoops',
'success' => 'Success',
'location' => 'Location',
'node' => 'Node',
'connection' => 'Connection',
Expand Down
48 changes: 48 additions & 0 deletions resources/views/auth/password.blade.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
@extends('layouts.master')

@section('title', 'Reset Password')


@section('right-nav')
@endsection

@section('sidebar')
@endsection

@section('content')
<div class="col-md-6">
<form action="/auth/password" method="POST">
<legend>{{ trans('auth.resetpassword') }}</legend>
<fieldset>
@if (count($errors) > 0)
<div class="alert alert-danger">
<strong>{{ trans('strings.whoops') }}!</strong> {{ trans('auth.errorencountered') }}<br><br>
<ul>
@foreach ($errors->all() as $error)
<li>{{ $error }}</li>
@endforeach
</ul>
</div>
@endif
@if (session('status'))
<div class="alert alert-success">
<strong>{{ trans('strings.success') }}!</strong> {{ trans('auth.emailsent') }}
</div>
@endif
<div class="form-group">
<label for="email" class="control-label">{{ trans('strings.email') }}</label>
<div>
<input type="text" class="form-control" name="email" id="email" value="{{ old('email') }}" placeholder="{{ trans('strings.email') }}" />
</div>
</div>
<div class="form-group">
<div>
{!! csrf_field() !!}
<button class="btn btn-default btn-sm">{{ trans('auth.sendlink') }}</button>
</div>
</div>
</fieldset>
</form>
</div>
<div class="col-md-3"></div>
@endsection
56 changes: 56 additions & 0 deletions resources/views/auth/reset.blade.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
@extends('layouts.master')

@section('title', 'Reset Password')


@section('right-nav')
@endsection

@section('sidebar')
@endsection

@section('content')
<div class="col-md-6">
<form action="/auth/password/verify" method="POST">
<legend>{{ trans('auth.resetpassword') }}</legend>
<fieldset>
@if (count($errors) > 0)
<div class="alert alert-danger">
<strong>{{ trans('strings.whoops') }}!</strong> {{ trans('auth.errorencountered') }}<br><br>
<ul>
@foreach ($errors->all() as $error)
<li>{{ $error }}</li>
@endforeach
</ul>
</div>
@endif
<input type="hidden" name="token" value="{{ $token }}">
<div class="form-group">
<label for="email" class="control-label">{{ trans('strings.email') }}</label>
<div>
<input type="text" class="form-control" name="email" id="email" value="{{ old('email') }}" placeholder="{{ trans('strings.email') }}" />
</div>
</div>
<div class="form-group">
<label for="password" class="control-label">{{ trans('strings.password') }}</label>
<div>
<input type="password" class="form-control" name="password" id="password" placeholder="{{ trans('strings.password') }}" />
</div>
</div>
<div class="form-group">
<label for="password_confirmation" class="control-label">{{ trans('auth.confirmpassword') }}</label>
<div>
<input type="password" class="form-control" id="password_confirmation" name="password_confirmation" />
</div>
</div>
<div class="form-group">
<div>
{!! csrf_field() !!}
<button class="btn btn-primary btn-sm">{{ trans('auth.resetpassword') }}</button>
</div>
</div>
</fieldset>
</form>
</div>
<div class="col-md-3"></div>
@endsection
14 changes: 14 additions & 0 deletions resources/views/emails/password.blade.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@

<html>
<head>
<title>Pterodactyl Lost Password Recovery</title>
</head>
<body>
<center><h1>Pterodactyl Lost Password Recovery</h1></center>
<p>Hello there! You are receiving this email because you requested a new password for your Pterodactyl account.</p>
<p>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. <strong>This link will expire in 1 hour.</strong></p>
<p><a href="{{ url('auth/password/verify/'.$token) }}">{{ url('auth/password/verify/'.$token) }}</a></p>
<p>Please do not hesitate to contact us if you belive something is wrong.
<p>Thanks!<br />Pterodactyl</p>
</body>
</html>

0 comments on commit ff063c3

Please sign in to comment.