Add ability to change password in settings
MODIFY
app/Http/Controllers/SettingsController.php
app/Http/Controllers/SettingsController.php
@@ -7,6 +7,7 @@ use Illuminate\Http\Request;
use Auth;
use Image;
use Storage;
+use Hash;
class SettingsController extends Controller {
public function index() {
@@ -21,7 +22,7 @@ class SettingsController extends Controller {
public function store(Request $request) {
$request->validate([
'avatar' => 'nullable|mimes:jpeg,jpg,png,gif',
- // TODO VALIDATE OTHER FIELDS
+ 'password' => 'nullable|confirmed',
'language' => 'required|in:' . implode(',', array_keys(config('app.locales')))
]);
@@ -42,6 +43,11 @@ class SettingsController extends Controller {
$user->name = $request->input('name');
$user->email = $request->input('email');
+
+ if ($password = $request->input('password')) {
+ $user->password = Hash::make($password);
+ }
+
$user->language = $request->input('language');
$user->save();

MODIFY
resources/views/settings.blade.php
resources/views/settings.blade.php
<label>E-mail</label>
<input type="text" name="email" value="{{ Auth::user()->email }}" />
</div>
+ <div class="input input--small">
+ <label>Password</label>
+ <input type="password" name="password" />
+ @include('partials.validation_error', ['payload' => 'password'])
+ </div>
+ <div class="input input--small">
+ <label>Verify Password</label>
+ <input type="password" name="password_confirmation" />
+ @include('partials.validation_error', ['payload' => 'password_confirmation'])
+ </div>
<div class="input input--small">
<label>Language</label>
<select name="language">

Add ability to change password in settings