1
1
mirror of https://github.com/pterodactyl/panel.git synced 2024-11-25 10:32:31 +01:00

Migrate ability to reset passwords

This commit is contained in:
BlameDylan 2015-12-08 18:28:49 -06:00
parent f47f0cd549
commit 2d57772528
7 changed files with 131 additions and 0 deletions

View File

@ -19,6 +19,7 @@ class PasswordController extends Controller
*/ */
use ResetsPasswords; use ResetsPasswords;
protected $redirectTo = '/';
/** /**
* Create a new password controller instance. * Create a new password controller instance.

View File

@ -11,6 +11,14 @@ class AuthRoutes {
$router->get('login', [ 'as' => 'auth.login', 'uses' => 'Auth\AuthController@getLogin' ]); $router->get('login', [ 'as' => 'auth.login', 'uses' => 'Auth\AuthController@getLogin' ]);
$router->post('login', [ 'as' => 'auth.login.submit', 'uses' => 'Auth\AuthController@postLogin' ]); $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' ]); $router->get('logout', [ 'as' => 'auth.logout', 'uses' => 'Auth\AuthController@getLogout' ]);
}); });
} }

View File

@ -17,6 +17,9 @@ return [
'throttle' => 'Too many login attempts. Please try again in :seconds seconds.', 'throttle' => 'Too many login attempts. Please try again in :seconds seconds.',
'errorencountered' => 'There was an error encountered while attempting to process this request.', 'errorencountered' => 'There was an error encountered while attempting to process this request.',
'resetpassword' => 'Reset Password', 'resetpassword' => 'Reset Password',
'confirmpassword' => 'Confirm Password',
'sendlink' => 'Send Password Reset Link',
'emailsent' => 'Your password reset email is on its way.',
'remeberme' => 'Remeber Me', 'remeberme' => 'Remeber Me',
]; ];

View File

@ -12,6 +12,7 @@ return [
'password' => 'Password', 'password' => 'Password',
'email' => 'Email', 'email' => 'Email',
'whoops' => 'Whoops', 'whoops' => 'Whoops',
'success' => 'Success',
'location' => 'Location', 'location' => 'Location',
'node' => 'Node', 'node' => 'Node',
'connection' => 'Connection', 'connection' => 'Connection',

View File

@ -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

View File

@ -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

View File

@ -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>