コード例 #1
0
ファイル: PasswordController.php プロジェクト: abada/backend
 public function postReset(Request $request)
 {
     $this->validate($request, ['company' => 'required|exists:companies,name']);
     $this->company = Company::whereName($request->input('company'))->firstOrFail();
     $request->merge(['company_id' => $this->company->id]);
     return $this->postResetOriginal($request);
 }
コード例 #2
0
ファイル: EmployeeAuthTest.php プロジェクト: abada/backend
 public function testResetPassword()
 {
     //perform restore request
     $response = $this->json('POST', '/employees/password/email', ['company' => 'testInit', 'email' => '*****@*****.**']);
     $response->seeStatusCode(200);
     //get the token
     $token = DB::table('password_resets_employees')->where('email', '*****@*****.**' . \plunner\Company::whereName('testInit')->firstOrFail()->id)->value('token');
     //perform reset with error
     $response = $this->json('POST', '/employees/password/reset', ['company' => 'testInit', 'email' => '*****@*****.**', 'password_confirmation' => 'testtest', 'password' => 'testtest', 'token' => 're' . $token]);
     $response->seeStatusCode(422);
     $response = $this->json('POST', '/employees/password/reset', ['company' => 'testInita', 'email' => '*****@*****.**', 'password_confirmation' => 'testtest', 'password' => 'testtest', 'token' => 're' . $token]);
     $response->seeStatusCode(422);
     //perform correct reset
     $response = $this->json('POST', '/employees/password/reset', ['company' => 'testInit', 'email' => '*****@*****.**', 'password_confirmation' => 'testtest', 'password' => 'testtest', 'token' => $token]);
     $response->seeStatusCode(200);
     $response = $this->json('POST', '/employees/auth/login', ['company' => 'testInit', 'email' => '*****@*****.**', 'password' => 'test']);
     $response->seeStatusCode(422);
     $response = $this->json('POST', '/employees/auth/login', ['company' => 'testInit', 'email' => '*****@*****.**', 'password' => 'testtest']);
     $response->seeStatusCode(200);
 }
コード例 #3
0
ファイル: AuthController.php プロジェクト: dsd-meetme/backend
 public function postLogin(Request $request)
 {
     //get company ID and impiled it in the request
     $this->validate($request, ['company' => 'required|exists:companies,name']);
     $this->company = Company::whereName($request->input('company'))->firstOrFail();
     $request->merge(['company_id' => $this->company->id]);
     //remember me
     $this->validate($request, ['remember' => 'required|boolean']);
     if ($request->input('remember', false)) {
         config(['jwt.ttl' => '43200']);
         //30 days
         $this->custom = array_merge($this->custom, ['remember' => 'true']);
     } else {
         $this->custom = array_merge($this->custom, ['remember' => 'false']);
     }
     $ret = $this->postLoginOriginal($request);
     if ($ret->getStatusCode() == 200) {
     }
     //TODO set the token
     return $ret;
 }