/** * login form POST request handler */ public function logindoc(Requests\doctorLogin $request) { $input = $_POST; $doc = DB::connection('centraldb')->select('select * from Doctors where name = ? and hospital = ?', [$input["name"], session("hospid")]); if ($doc == null) { session()->flash("error", "Enter the correct credentials"); return view("doctor.login"); } else { $doc = $doc[0]; if (Hash::check(trim($input["password"]), $doc->password)) { myAuth::login(1, $doc->id); return redirect("doctor/"); } else { session()->flash("error", "Enter the correct credentials"); return redirect("doctor/login"); } } }
/** * function to check if user already has a password * else redirect to singup */ public function checkLogin(Request $request) { $this->validate($request, ["name" => "required|min:2", "password" => "required|min:8"]); $name = $_POST["name"]; $password = $_POST["password"]; $pat = null; if ($this->isAPatient($name)) { $pat = $this->getPatient($name); if ($pat->password != "" && $pat->password != null) { if (Hash::check($password, $pat->password)) { //login myAuth::login(MyAuth::$isPatient, $pat->uid); return redirect("patient"); } else { session()->flash("error", "Enter correct credentials"); return redirect("patient/login"); } } } session()->flash("error", "Please Sign Up first"); return redirect("patient/signup"); }
public function logout() { myAuth::logout(); return redirect("desk/login"); }
public function logout() { myAuth::logout(); session()->flash("error", "Successfully logged out"); return redirect("phar/login"); }