added pass change option
Cette révision appartient à :
Parent
4140765998
révision
62293c350d
@ -5,6 +5,7 @@
|
||||
use App\Http\Controllers\Controller;
|
||||
use Illuminate\Http\Request;
|
||||
use App\Models\Student;
|
||||
use Illuminate\Support\Facades\Hash;
|
||||
|
||||
class ProfileController extends Controller
|
||||
{
|
||||
@ -45,6 +46,29 @@ public function save_profile(Request $request)
|
||||
}
|
||||
}
|
||||
|
||||
public function change_password(Request $request)
|
||||
{
|
||||
try {
|
||||
$data = Student::find(currentUserId());
|
||||
|
||||
// Validate current password
|
||||
if (!Hash::check($request->current_password, $data->password)) {
|
||||
return redirect()->back()->with('error', 'Current password is incorrect.');
|
||||
}
|
||||
|
||||
$data->password = Hash::make($request->password);
|
||||
$data->language = 'en';
|
||||
|
||||
if ($data->save()) {
|
||||
$this->setSession($data);
|
||||
return redirect()->back()->with('success', 'Data Saved');
|
||||
}
|
||||
} catch (Exception $e) {
|
||||
// dd($e);
|
||||
return redirect()->back()->withInput()->with('error', 'Please try again');
|
||||
}
|
||||
}
|
||||
|
||||
public function setSession($student)
|
||||
{
|
||||
return request()->session()->put(
|
||||
|
||||
BIN
public/uploads/students/2931702880014.png
Fichier normal
BIN
public/uploads/students/2931702880014.png
Fichier normal
Fichier binaire non affiché.
|
Après Largeur: | Hauteur: | Taille: 71 KiB |
@ -74,7 +74,7 @@
|
||||
<div class="col-lg-7 order-1 order-lg-0">
|
||||
<div class="signup-area-image">
|
||||
<img src="{{asset('public/frontend/dist/images/signup/Illustration.png')}}" alt="Illustration Image"
|
||||
class="img-fluid" />
|
||||
class="img-fluid" />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@ -220,12 +220,13 @@ class="text-secondary">Dashboard</a></button>
|
||||
<div class="white-bg mt-4">
|
||||
<div class="students-info-form">
|
||||
<h6 class="font-title--card">Change Password</h6>
|
||||
<form action="#">
|
||||
<form action="{{route('change_password')}}" method="post">
|
||||
@csrf
|
||||
<div class="row">
|
||||
<div class="col-12">
|
||||
<label for="cpass">Current Password</label>
|
||||
<label for="current_password">Current Password</label>
|
||||
<div class="input-with-icon">
|
||||
<input type="password" id="cpass" class="form-control"
|
||||
<input type="password" id="cpass" name="current_password" class="form-control"
|
||||
placeholder="Enter Password" />
|
||||
<div class="input-icon" onclick="showPassword('cpass',this)">
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24"
|
||||
@ -242,9 +243,9 @@ class="text-secondary">Dashboard</a></button>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-12">
|
||||
<label for="npass">New Password</label>
|
||||
<label for="password">New Password</label>
|
||||
<div class="input-with-icon">
|
||||
<input type="password" id="npass" class="form-control"
|
||||
<input type="password" id="npass" name="password" class="form-control"
|
||||
placeholder="Enter Password" />
|
||||
<div class="input-icon" onclick="showPassword('npass',this)">
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24"
|
||||
@ -261,9 +262,9 @@ class="text-secondary">Dashboard</a></button>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-12">
|
||||
<label for="cnpass">Confirm New Password</label>
|
||||
<label for="password_confirmation">Confirm New Password</label>
|
||||
<div class="input-with-icon">
|
||||
<input type="password" id="cnpass" class="form-control"
|
||||
<input type="password" id="cnpass" name="password_confirmation" class="form-control"
|
||||
placeholder="Enter Password" />
|
||||
<div class="input-icon" onclick="showPassword('cnpass',this)">
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24"
|
||||
|
||||
@ -85,6 +85,7 @@
|
||||
Route::get('/dashboard', [studashboard::class, 'index'])->name('studentdashboard');
|
||||
Route::get('/profile', [stu_profile::class, 'index'])->name('student_profile');
|
||||
Route::post('/profile/save', [stu_profile::class, 'save_profile'])->name('student_save_profile');
|
||||
Route::post('/profile/savePass', [stu_profile::class, 'change_password'])->name('change_password');
|
||||
Route::post('/change-image', [stu_profile::class, 'changeImage'])->name('change_image');
|
||||
|
||||
/* ssl payment */
|
||||
|
||||
Chargement…
Référencer dans un nouveau ticket
Block a user