#12: Added a page for the current user to change their password - still needs hooking up to the controller

This commit is contained in:
Andy Heathershaw 2017-04-10 21:04:10 +01:00
parent 2c7dba6728
commit e1b80ae096
6 changed files with 101 additions and 18 deletions

View File

@ -0,0 +1,35 @@
<?php
namespace App\Http\Controllers\Auth;
use App\Facade\Theme;
use App\Http\Controllers\Controller;
use Illuminate\Foundation\Auth\ResetsPasswords;
use Illuminate\Http\Request;
class ChangePasswordController extends Controller
{
use ResetsPasswords;
/**
* Where to redirect users after a password reset.
*
* @var string
*/
protected $redirectTo = '/';
/**
* Create a new controller instance.
*
* @return void
*/
public function __construct()
{
$this->middleware('auth');
}
public function showChangePasswordForm(Request $request)
{
return Theme::render('auth.passwords.change_password');
}
}

View File

@ -20,6 +20,8 @@ return [
'and password you provided when you registered.', 'and password you provided when you registered.',
'activation_required_message' => 'An e-mail containing an activation link has been sent to the e-mail address you provided. ' . 'activation_required_message' => 'An e-mail containing an activation link has been sent to the e-mail address you provided. ' .
'Please click the link in this e-mail to activate your account.', 'Please click the link in this e-mail to activate your account.',
'change_password_action' => 'Change password',
'change_password_title' => 'Change your password',
'forgot_password_action' => 'Send Reset E-mail', 'forgot_password_action' => 'Send Reset E-mail',
'forgot_password_link' => 'Forgotten your password?', 'forgot_password_link' => 'Forgotten your password?',
'forgot_password_title' => 'Send password reset link', 'forgot_password_title' => 'Send password reset link',

View File

@ -24,6 +24,7 @@ return [
'navbar' => [ 'navbar' => [
'admin' => 'Manage', 'admin' => 'Manage',
'albums' => 'Albums', 'albums' => 'Albums',
'change_password' => 'Change password',
'login' => 'Login', 'login' => 'Login',
'logout' => 'Logout', 'logout' => 'Logout',
'register' => 'Register' 'register' => 'Register'

View File

@ -0,0 +1,61 @@
@extends('themes.base.layout')
@section('title', trans('auth.change_password_title'))
@section('content')
<div class="container">
<div class="row">
<div class="col-md-8 offset-md-2">
<div class="card">
<div class="card-header">
<ul class="nav nav-tabs card-header-tabs">
<li class="nav-item">
<a class="nav-link active" href="{{ url('/password/change') }}">@yield('title')</a>
</li>
</ul>
</div>
<div class="card-block">
<form role="form" method="POST" action="{{ url('/password/change') }}">
{{ csrf_field() }}
<div class="form-group row{{ $errors->has('password') ? ' has-danger' : '' }}">
<label for="password" class="col-md-4 col-form-label text-md-right">@lang('forms.password_label')</label>
<div class="col-md-6">
<input id="password" type="password" class="form-control" name="password">
@if ($errors->has('password'))
<div class="form-control-feedback">
<strong>{{ $errors->first('password') }}</strong>
</div>
@endif
</div>
</div>
<div class="form-group row{{ $errors->has('password_confirmation') ? ' has-danger' : '' }}">
<label for="password-confirm" class="col-md-4 col-form-label text-md-right">@lang('forms.password_confirm_label')</label>
<div class="col-md-6">
<input id="password-confirm" type="password" class="form-control" name="password_confirmation">
@if ($errors->has('password_confirmation'))
<div class="form-control-feedback">
<strong>{{ $errors->first('password_confirmation') }}</strong>
</div>
@endif
</div>
</div>
<div class="form-group row">
<div class="col-md-6 offset-md-4 text-right">
<a href="{{ url('/login') }}" class="btn btn-link">@lang('forms.cancel_action')</a>
<button type="submit" class="btn btn-success">
<i class="fa fa-fw fa-check"></i> @lang('auth.change_password_action')
</button>
</div>
</div>
</form>
</div>
</div>
</div>
</div>
</div>
@endsection

View File

@ -41,6 +41,7 @@
{{--<img class="avatar" src="{{ Theme::gravatarUrl(Auth::user()->email, 42) }}" alt="{{ Auth::user()->name }}" title="{{ Auth::user()->name }}" />--}} {{--<img class="avatar" src="{{ Theme::gravatarUrl(Auth::user()->email, 42) }}" alt="{{ Auth::user()->name }}" title="{{ Auth::user()->name }}" />--}}
</a> </a>
<div class="dropdown-menu"> <div class="dropdown-menu">
<a class="dropdown-item" href="{{ route('auth.changePassword') }}">@lang('navigation.navbar.change_password')</a>
<a class="dropdown-item" href="{{ url('/logout') }}" onclick="event.preventDefault(); document.getElementById('logout-form').submit();">@lang('navigation.navbar.logout')</a> <a class="dropdown-item" href="{{ url('/logout') }}" onclick="event.preventDefault(); document.getElementById('logout-form').submit();">@lang('navigation.navbar.logout')</a>
<form id="logout-form" action="{{ url('/logout') }}" method="POST" style="display: none;"> <form id="logout-form" action="{{ url('/logout') }}" method="POST" style="display: none;">
{{ csrf_field() }} {{ csrf_field() }}

View File

@ -13,24 +13,6 @@
Auth::routes(); Auth::routes();
Route::get('/openstack-test', function ()
{
$credentials = new \Aws\Credentials\Credentials('vyUv2MDny84Q3VD6Zvg0', 'TuQSzRbx3f6Rmnnf_N4LXod5DCtgUfGwprot7UpQ');
$client = new \Aws\S3\S3Client(array(
'endpoint' => 'https://objects-us-west-1.dream.io',
'credentials' => $credentials,
'version' => 'latest',
'region' => 'xxx'
));
$blist = $client->listBuckets();
echo " Buckets belonging to " . $blist['Owner']['ID'] . ":\n";
foreach ($blist['Buckets'] as $b) {
echo "{$b['Name']}\t{$b['CreationDate']}\n";
}
});
// Administration // Administration
Route::group(['prefix' => 'admin'], function () { Route::group(['prefix' => 'admin'], function () {
Route::get('/', 'Admin\DefaultController@index')->name('admin'); Route::get('/', 'Admin\DefaultController@index')->name('admin');
@ -82,6 +64,7 @@ Route::group(['prefix' => 'install'], function () {
// Gallery // Gallery
Route::get('/', 'Gallery\DefaultController@index')->name('home'); Route::get('/', 'Gallery\DefaultController@index')->name('home');
Route::get('/activate/{token}', 'Auth\ActivateController@activate')->name('auth.activate'); Route::get('/activate/{token}', 'Auth\ActivateController@activate')->name('auth.activate');
Route::get('/password/change', 'Auth\ChangePasswordController@showChangePasswordForm')->name('auth.changePassword');
Route::get('{albumUrlAlias}', 'Gallery\AlbumController@index')->name('viewAlbum'); Route::get('{albumUrlAlias}', 'Gallery\AlbumController@index')->name('viewAlbum');
Route::get('{albumUrlAlias}/{photoFilename}', 'Gallery\PhotoController@show')->name('viewPhoto'); Route::get('{albumUrlAlias}/{photoFilename}', 'Gallery\PhotoController@show')->name('viewPhoto');
Route::get('photo/{albumUrlAlias}/{photoFilename}', 'Gallery\PhotoController@download')->name('downloadPhoto'); Route::get('photo/{albumUrlAlias}/{photoFilename}', 'Gallery\PhotoController@download')->name('downloadPhoto');