mirror of
https://gitlab.com/signalytic/client-external/streamline/streamline-emr.git
synced 2026-09-13 11:41:31 +00:00
Build modified streamline images
The official image from streamline does not currently work for the arm64 platform. As a temporary measure, the source code and docker build scripts have been lifted from the official images and are used to build locally. Some additional modifications are made to reduce overall image size, these are documented in docker/README.md
This commit is contained in:
+32
@@ -0,0 +1,32 @@
|
||||
<?php
|
||||
|
||||
namespace Streamline\Http\Controllers\Auth;
|
||||
|
||||
use Streamline\Http\Controllers\Controller;
|
||||
use Illuminate\Foundation\Auth\SendsPasswordResetEmails;
|
||||
|
||||
class ForgotPasswordController extends Controller
|
||||
{
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Password Reset Controller
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| This controller is responsible for handling password reset emails and
|
||||
| includes a trait which assists in sending these notifications from
|
||||
| your application to your users. Feel free to explore this trait.
|
||||
|
|
||||
*/
|
||||
|
||||
use SendsPasswordResetEmails;
|
||||
|
||||
/**
|
||||
* Create a new controller instance.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
$this->middleware('guest');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,135 @@
|
||||
<?php
|
||||
|
||||
namespace Streamline\Http\Controllers\Auth;
|
||||
|
||||
use Config;
|
||||
use DB;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
use Illuminate\Support\Facades\Session;
|
||||
use Streamline\Http\Controllers\Controller;
|
||||
use Illuminate\Foundation\Auth\AuthenticatesUsers;
|
||||
use Streamline\Models\GeneralSettings;
|
||||
use Streamline\Models\SecurityQuestion;
|
||||
use Carbon\Carbon;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class LoginController extends Controller
|
||||
{
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Login Controller
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| This controller handles authenticating users for the application and
|
||||
| redirecting them to your home screen. The controller uses a trait
|
||||
| to conveniently provide its functionality to your applications.
|
||||
|
|
||||
*/
|
||||
|
||||
use AuthenticatesUsers;
|
||||
|
||||
/**
|
||||
* Where to redirect users after login.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $redirectTo = '/home';
|
||||
|
||||
/**
|
||||
* Create a new controller instance.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
$this->middleware('guest')->except('logout');
|
||||
}
|
||||
|
||||
public function showLoginForm() {
|
||||
/* Flush everything from existing session to stop another user from inheriting some session variables of another */
|
||||
if (Auth::user()) {
|
||||
Auth::logout();
|
||||
}
|
||||
Session::flush();
|
||||
/* added by Bright */
|
||||
|
||||
$security_questions = SecurityQuestion::pluck('name', 'id');
|
||||
$security_questions->prepend('- select -', '');
|
||||
|
||||
return view('auth.login', compact('security_questions'));
|
||||
}
|
||||
|
||||
public function username()
|
||||
{
|
||||
return 'username';
|
||||
}
|
||||
|
||||
/**
|
||||
* The user has been authenticated.
|
||||
* We are over-riding this in order to log out users from other devices once they login
|
||||
* Davis
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
protected function authenticated(Request $request, $user)
|
||||
{
|
||||
$passwordExpired = $this->isPasswordExpired();
|
||||
if($passwordExpired) {
|
||||
flash("Your Password is expired, You need to change your password.")->error();
|
||||
return redirect('/passwordExpiration');
|
||||
}
|
||||
$this->setSessionExpirationTime();
|
||||
|
||||
Auth::logoutOtherDevices(request('password'));
|
||||
|
||||
// for those times when the systems logs people out, instead of going back to previous go home
|
||||
return redirect('home');
|
||||
}
|
||||
|
||||
protected function isPasswordExpired()
|
||||
{
|
||||
$user = Auth::user();
|
||||
|
||||
if ($user) {
|
||||
$general_settings = GeneralSettings::find(1);
|
||||
$password_security = $user->passwordSecurity;
|
||||
$password_expiry_days = $general_settings->password_expiration_days;
|
||||
|
||||
if ($password_security) {
|
||||
$password_updated_at = $user->passwordSecurity->password_updated_at;
|
||||
} else {
|
||||
DB::table('password_securities')->insert([
|
||||
'user_id' => $user->id,
|
||||
'password_expiry_days' => $password_expiry_days,
|
||||
'password_updated_at' => now(),
|
||||
'created_at' => now(),
|
||||
'updated_at' => now()
|
||||
]);
|
||||
|
||||
$password_updated_at = now();
|
||||
}
|
||||
|
||||
$password_expires_at = Carbon::parse($password_updated_at)->addDays($password_expiry_days);
|
||||
|
||||
if ($password_expires_at->lessThan(Carbon::now())) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
protected function setSessionExpirationTime()
|
||||
{
|
||||
$general_settings = GeneralSettings::find(1);
|
||||
|
||||
$session_expiration_time = $general_settings->session_expiration_time;
|
||||
|
||||
Session::put('session_expiration_time', $session_expiration_time);
|
||||
|
||||
Config::set('session.lifetime', $session_expiration_time);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
+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 !");
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,81 @@
|
||||
<?php
|
||||
|
||||
namespace Streamline\Http\Controllers\Auth;
|
||||
|
||||
use Streamline\Models\User;
|
||||
use Streamline\Http\Controllers\Controller;
|
||||
use Illuminate\Support\Facades\Validator;
|
||||
use Illuminate\Foundation\Auth\RegistersUsers;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
|
||||
class RegisterController extends Controller {
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Register Controller
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| This controller handles the registration of new users as well as their
|
||||
| validation and creation. By default this controller uses a trait to
|
||||
| provide this functionality without requiring any additional code.
|
||||
|
|
||||
*/
|
||||
|
||||
use RegistersUsers;
|
||||
|
||||
/**
|
||||
* Where to redirect users after registration.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $redirectTo = '/home';
|
||||
|
||||
/**
|
||||
* Create a new controller instance.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct() {
|
||||
$this->middleware('guest');
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a validator for an incoming registration request.
|
||||
*
|
||||
* @param array $data
|
||||
* @return \Illuminate\Contracts\Validation\Validator
|
||||
*/
|
||||
protected function validator(array $data) {
|
||||
return Validator::make($data, [
|
||||
'first_name' => 'required|string|max:255',
|
||||
'last_name' => 'required|string|max:255',
|
||||
'username' => 'required|string|max:255|unique:users',
|
||||
'pin' => 'required|min:5|max:5',
|
||||
'position_id' => 'required|integer',
|
||||
'password' => 'required|string|min:6|confirmed',
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a new user instance after a valid registration.
|
||||
*
|
||||
* @param array $data
|
||||
* @return \Streamline\Models\User
|
||||
*/
|
||||
protected function create(array $data) {
|
||||
return User::create([
|
||||
'first_name' => $data['first_name'],
|
||||
'last_name' => $data['last_name'],
|
||||
'username' => $data['username'],
|
||||
'registration_number' => $data['registration_number'],
|
||||
'photo' => $data['photo'],
|
||||
'position_id' => $data['position_id'],
|
||||
'expiry_date' => $data['expiry_date'],
|
||||
'email' => $data['email'],
|
||||
'pin' => $data['pin'],
|
||||
'phone' => $data['phone'],
|
||||
'password' => $data['password'],
|
||||
]);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
+39
@@ -0,0 +1,39 @@
|
||||
<?php
|
||||
|
||||
namespace Streamline\Http\Controllers\Auth;
|
||||
|
||||
use Streamline\Http\Controllers\Controller;
|
||||
use Illuminate\Foundation\Auth\ResetsPasswords;
|
||||
|
||||
class ResetPasswordController extends Controller
|
||||
{
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Password Reset Controller
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| This controller is responsible for handling password reset requests
|
||||
| and uses a simple trait to include this behavior. You're free to
|
||||
| explore this trait and override any methods you wish to tweak.
|
||||
|
|
||||
*/
|
||||
|
||||
use ResetsPasswords;
|
||||
|
||||
/**
|
||||
* Where to redirect users after resetting their password.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $redirectTo = '/home';
|
||||
|
||||
/**
|
||||
* Create a new controller instance.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
$this->middleware('guest');
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user