Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #49 from Kovah/dev
v0.0.15
- Loading branch information
Showing
16 changed files
with
165 additions
and
102 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
<?php | ||
|
||
namespace App\Http\Requests; | ||
|
||
use Illuminate\Foundation\Http\FormRequest; | ||
use Illuminate\Http\Request; | ||
|
||
class UserAccountUpdateRequest extends FormRequest | ||
{ | ||
/** @var bool */ | ||
private $validate_username = false; | ||
|
||
/** @var bool */ | ||
private $validate_email = false; | ||
|
||
/** | ||
* Determine if the user is authorized to make this request. | ||
* | ||
* @return bool | ||
*/ | ||
public function authorize(Request $request) | ||
{ | ||
// Validate the username if it was changed | ||
if ($request->get('username') !== auth()->user()->name) { | ||
$this->validate_username = true; | ||
} | ||
|
||
// Validate the email address if it was changed | ||
if ($request->get('email') !== auth()->user()->email) { | ||
$this->validate_email = true; | ||
} | ||
|
||
return true; | ||
} | ||
|
||
/** | ||
* Get the validation rules that apply to the request. | ||
* | ||
* @return array | ||
*/ | ||
public function rules() | ||
{ | ||
if ($this->validate_username) { | ||
$rules['username'] = 'unique:users,name'; | ||
} | ||
|
||
if ($this->validate_email) { | ||
$rules['email'] = 'unique:users,email'; | ||
} | ||
|
||
return $rules; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
87 changes: 45 additions & 42 deletions
87
resources/views/actions/settings/partials/change-pw.blade.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,44 +1,47 @@ | ||
<div class="card mt-4"> | ||
<div class="card-header"> | ||
@lang('settings.change_password') | ||
</div> | ||
<div class="card-body"> | ||
|
||
<form action="{{ route('change-user-password') }}" method="POST"> | ||
@csrf | ||
|
||
<div class="form-group"> | ||
<label for="old_password"> | ||
@lang('settings.old_password') | ||
</label> | ||
<input type="text" name="old_password" id="old_password" required | ||
class="form-control{{ $errors->has('old_password') ? ' is-invalid' : '' }}" | ||
placeholder="@lang('settings.old_password')"> | ||
</div> | ||
|
||
<div class="form-group"> | ||
<label for="new_password"> | ||
@lang('settings.new_password') | ||
</label> | ||
<input type="text" name="new_password" id="new_password" required | ||
class="form-control{{ $errors->has('new_password') ? ' is-invalid' : '' }}" | ||
placeholder="@lang('settings.new_password')"> | ||
</div> | ||
|
||
<div class="form-group"> | ||
<label for="new_password_confirmation"> | ||
@lang('settings.new_password2') | ||
</label> | ||
<input type="text" name="new_password_confirmation" id="new_password_confirmation" required | ||
class="form-control{{ $errors->has('new_password_confirmation') ? ' is-invalid' : '' }}" | ||
placeholder="@lang('settings.new_password2')"> | ||
</div> | ||
|
||
<button type="submit" class="btn btn-primary"> | ||
<i class="fa fa-key fa-mr"></i> @lang('settings.change_password') | ||
</button> | ||
|
||
</form> | ||
@if(!env('APP_DEMO', false)) | ||
<div class="card mt-4"> | ||
<div class="card-header"> | ||
@lang('settings.change_password') | ||
</div> | ||
<div class="card-body"> | ||
|
||
<form action="{{ route('change-user-password') }}" method="POST"> | ||
@csrf | ||
|
||
<div class="form-group"> | ||
<label for="old_password"> | ||
@lang('settings.old_password') | ||
</label> | ||
<input type="password" name="old_password" id="old_password" required | ||
class="form-control{{ $errors->has('old_password') ? ' is-invalid' : '' }}" | ||
placeholder="@lang('settings.old_password')"> | ||
</div> | ||
|
||
<div class="form-group"> | ||
<label for="new_password"> | ||
@lang('settings.new_password') | ||
</label> | ||
<input type="password" name="new_password" id="new_password" required | ||
class="form-control{{ $errors->has('new_password') ? ' is-invalid' : '' }}" | ||
placeholder="@lang('settings.new_password')"> | ||
</div> | ||
|
||
<div class="form-group"> | ||
<label for="new_password_confirmation"> | ||
@lang('settings.new_password2') | ||
</label> | ||
<input type="password" name="new_password_confirmation" id="new_password_confirmation" required | ||
class="form-control{{ $errors->has('new_password_confirmation') ? ' is-invalid' : '' }}" | ||
placeholder="@lang('settings.new_password2')"> | ||
</div> | ||
|
||
<button type="submit" class="btn btn-primary"> | ||
<i class="fa fa-key fa-mr"></i> @lang('settings.change_password') | ||
</button> | ||
|
||
</form> | ||
|
||
</div> | ||
</div> | ||
</div> | ||
@endif | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.