m3 Security Fixes
This commit is contained in:
@@ -2,89 +2,83 @@
|
||||
|
||||
namespace Modules\M3\Http\Controllers;
|
||||
|
||||
use Modules\M3\Http\Controllers\Controller;
|
||||
use DB;
|
||||
use Config;
|
||||
use Illuminate\Http\Request;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
use Modules\M3\Models\ICM428M;
|
||||
|
||||
|
||||
class userProfileController extends Controller
|
||||
{
|
||||
public static function index(Request $request)
|
||||
{
|
||||
|
||||
public static function index(Request $request) {
|
||||
|
||||
# Get Current USER
|
||||
$loggedUser = strtoUpper(m3_user());
|
||||
// Get Current USER
|
||||
$loggedUser = strtoupper(m3_user());
|
||||
|
||||
$ICM428M = DB::connection(config('m3.connection', 'pgsql'))->table('icm428m')
|
||||
->select('R428US','R428CO', 'R428WH','R428PL','R428FIRST','R428FAMILY')
|
||||
->where('R428US','=',$loggedUser)
|
||||
->where('R42821A','=','Y')
|
||||
->select('R428US', 'R428CO', 'R428WH', 'R428PL', 'R428FIRST', 'R428FAMILY')
|
||||
->where('R428US', '=', $loggedUser)
|
||||
->where('R42821A', '=', 'Y')
|
||||
->first();
|
||||
|
||||
$IC670M = DB::connection(config('m3.connection', 'pgsql'))->table('ic670m')->get();
|
||||
$IC670M = DB::connection(config('m3.connection', 'pgsql'))->table('ic670m')->get();
|
||||
|
||||
# Check if user is eligible for Profile update
|
||||
// Check if user is eligible for Profile update
|
||||
if (isset($ICM428M->R428US)) {
|
||||
return view('m3::liberty-theme.pages.userProfile', compact('ICM428M','IC670M'));
|
||||
}
|
||||
else{
|
||||
return view('m3::liberty-theme.pages.userProfile', compact('ICM428M', 'IC670M'));
|
||||
} else {
|
||||
abort(404);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public static function updateUserProfile(Request $request) {
|
||||
public static function updateUserProfile(Request $request)
|
||||
{
|
||||
// dd($request->all());
|
||||
|
||||
$R428US = isset($request->R428US) ? trim($request->R428US) : '';
|
||||
$R428DPW = isset($request->R428DPW) ? trim($request->R428DPW) : '';
|
||||
$R428US = isset($request->R428US) ? trim($request->R428US) : '';
|
||||
$R428DPW = isset($request->R428DPW) ? trim($request->R428DPW) : '';
|
||||
|
||||
$R428CO = substr($R428DPW, 0, 3);
|
||||
$R428PL = substr($R428DPW, 3, 3);
|
||||
$R428WH = substr($R428DPW, 6, 3);
|
||||
$R428CO = substr($R428DPW, 0, 3);
|
||||
$R428PL = substr($R428DPW, 3, 3);
|
||||
$R428WH = substr($R428DPW, 6, 3);
|
||||
// dd($R428US.'-'.$R428CO.'-'.$R428PL.'-'.$R428WH );
|
||||
|
||||
if ($R428US!='') {
|
||||
# Update record to ICM428M
|
||||
if ($R428US != '') {
|
||||
// Update record to ICM428M
|
||||
DB::connection(config('m3.connection', 'pgsql'))->update("update ICM428M
|
||||
set R428CO='$R428CO', R428PL='$R428PL', R428WH='$R428WH'
|
||||
where R428US='$R428US'");
|
||||
|
||||
// return "success";
|
||||
return redirect('/userprofile')->with('success', 'Profile updated successfully!');
|
||||
}
|
||||
else{
|
||||
} else {
|
||||
return redirect('/userprofile')->with('success', 'Profile updated successfully!');
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public static function updateUserProfileAjax(Request $request) {
|
||||
public static function updateUserProfileAjax(Request $request)
|
||||
{
|
||||
// dd($request->all());
|
||||
|
||||
$R428US = isset($request->R428US) ? trim($request->R428US) : '';
|
||||
$R428DPW = isset($request->R428DPW) ? trim($request->R428DPW) : '';
|
||||
$R428US = isset($request->R428US) ? trim($request->R428US) : '';
|
||||
$R428DPW = isset($request->R428DPW) ? trim($request->R428DPW) : '';
|
||||
|
||||
$R428CO = substr($R428DPW, 0, 3);
|
||||
$R428PL = substr($R428DPW, 3, 3);
|
||||
$R428WH = substr($R428DPW, 6, 3);
|
||||
$R428CO = substr($R428DPW, 0, 3);
|
||||
$R428PL = substr($R428DPW, 3, 3);
|
||||
$R428WH = substr($R428DPW, 6, 3);
|
||||
// dd($R428US.'-'.$R428CO.'-'.$R428PL.'-'.$R428WH );
|
||||
|
||||
if ($R428US!='') {
|
||||
# Update record to ICM428M
|
||||
if ($R428US != '') {
|
||||
// Update record to ICM428M
|
||||
DB::connection(config('m3.connection', 'pgsql'))->update("update ICM428M
|
||||
set R428CO='$R428CO', R428PL='$R428PL', R428WH='$R428WH'
|
||||
where R428US='$R428US'");
|
||||
|
||||
return response()->json(['success'=>true]);
|
||||
}
|
||||
else{
|
||||
return response()->json(['success'=>false]);
|
||||
return response()->json(['success' => true]);
|
||||
} else {
|
||||
return response()->json(['success' => false]);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user