allow users to change their password from edit form

Posted 6 days ago by nogepog

I have a edit users form with all the fields user filled in registration form.How do i allow the user to modify their password and confirm password on edit. I have this way,which prints the old password.How do i unhash it and then hash it upon submit.When i try to submit the form without changing the old password the password is changed.

<div class="form-group row @if ($errors->has('password')) is-invalid @endif">
<label class="col-lg-4 col-form-label" for="password">Password <span class="text-danger">*</span></label>
<div class="col-lg-6">

<input type="password" class="form-control" id="password" name="password" value="{{ old('password',$user->password) }}" placeholder="Choose a safe one.." aria-required="true" aria-describedby="password-error">

<div id="password-error" class="invalid-feedback animated fadeInDown">{{ $errors->first('password',$user->password) }}</div>
User::whereId($id)->update(['password' => bcrypt($request->password)]);

Please sign in or create an account to participate in this conversation.

Reply to

Use Markdown with GitHub-flavored code blocks.