mirror of
https://gitlab.com/signalytic/client-external/streamline/streamline-emr.git
synced 2026-09-11 18:51:31 +00:00
updated streamline-setup v2
This commit is contained in:
+124
@@ -0,0 +1,124 @@
|
||||
<?php
|
||||
|
||||
namespace Streamline\Http\Controllers\Auth;
|
||||
|
||||
use Streamline\Models\User;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
use Carbon\Carbon;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\Hash;
|
||||
use Streamline\Http\Controllers\Controller;
|
||||
|
||||
class PwdExpirationController extends Controller
|
||||
{
|
||||
/**
|
||||
* Display a listing of the resource.
|
||||
*
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function index()
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the form for creating a new resource.
|
||||
*
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function create()
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Store a newly created resource in storage.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function store(Request $request)
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Display the specified resource.
|
||||
*
|
||||
* @param int $id
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function show($id)
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the form for editing the specified resource.
|
||||
*
|
||||
* @param int $id
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function edit($id)
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Update the specified resource in storage.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @param int $id
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function update(Request $request, $id)
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove the specified resource from storage.
|
||||
*
|
||||
* @param int $id
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function destroy($id)
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
public function showPasswordExpirationForm(Request $request){
|
||||
return view('users.password_expiration');
|
||||
}
|
||||
|
||||
public function postPasswordExpiration(Request $request){
|
||||
|
||||
$user = User::find(Auth::user()->id);
|
||||
if (!(Hash::check($request->get('current-password'), $user->password))) {
|
||||
// The passwords matches
|
||||
return redirect()->back()->with("error","Your current password does not matches with the password you provided. Please try again.");
|
||||
}
|
||||
|
||||
if(strcmp($request->get('current-password'), $request->get('new-password')) == 0){
|
||||
//Current password and new password are same
|
||||
return redirect()->back()->with("error","New Password cannot be same as your current password. Please choose a different password.");
|
||||
}
|
||||
|
||||
$request->validate([
|
||||
'current-password' => 'required',
|
||||
'new-password' => 'required|string|min:6|confirmed',
|
||||
]);
|
||||
|
||||
|
||||
//Change Password
|
||||
$user->password = bcrypt($request->get('new-password'));
|
||||
$user->save();
|
||||
|
||||
//Update password updation timestamp
|
||||
$user->passwordSecurity->password_updated_at = Carbon::now();
|
||||
$user->passwordSecurity->save();
|
||||
flash("Password changed successfully, You can now login !")->success();
|
||||
|
||||
return redirect('/login')->with("status","Password changed successfully, You can now login !");
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user