//[ExpectedException()]
 public void CheckNullToken()
 {
     Assert.ThrowsException <Exception>(() =>
     {
         airlineFacade.CancelFlight(null, new Flight());
     });
     Assert.ThrowsException <Exception>(() =>
     {
         airlineFacade.GetAllTickets(null);
     });
     Assert.ThrowsException <Exception>(() =>
     {
         airlineFacade.CreateFlight(null, new Flight());
     });
     Assert.ThrowsException <Exception>(() =>
     {
         airlineFacade.UpdateFlight(null, new Flight());
     });
     Assert.ThrowsException <Exception>(() =>
     {
         airlineFacade.ChangeMyPassword(null, "old_password", "new_password");
     });
     Assert.ThrowsException <Exception>(() =>
     {
         airlineFacade.MofidyAirlineDetails(null, new AirlineCompany());
     });
 }
Exemplo n.º 2
0
        public void ChangeMyPassword()
        {
            UserRepository testUr    = new UserRepository("dad", "aes", RolesEnum.admin);
            Admin          testAdmin = new Admin("dav,", "id", 3);

            FlyingCenterSystem.GetInstance().TryLogin(ur.UserName, ur.Password, out ILogin token,
                                                      out FacadeBase facade);
            LoginToken <Admin>          myToken  = token as LoginToken <Admin>;
            LoggedInAdministratorFacade myFacade = facade as LoggedInAdministratorFacade;

            myFacade.CreateNewAdmin(myToken, testUr, testAdmin);
            Country country = new Country("Israel");

            myFacade.CreateNewCountry(myToken, country);
            AirlineCompany airlineCompany = new AirlineCompany("ElALL", 1, country.ID);
            UserRepository airlineTestUr  = new UserRepository("rad", "ass", RolesEnum.airline);

            myFacade.CreateNewAirline(myToken, airlineTestUr, airlineCompany, country);
            Flight flight = new Flight(DateTime.Now, DateTime.Now, 50, airlineCompany.ID, country.ID, country.ID);

            FlyingCenterSystem.GetInstance().TryLogin(airlineTestUr.UserName, airlineTestUr.Password, out ILogin tokenAir,
                                                      out FacadeBase facadeAir);
            LoginToken <AirlineCompany> myTokenair  = tokenAir as LoginToken <AirlineCompany>;
            LoggedInAirlineFacade       myFacadeAir = facadeAir as LoggedInAirlineFacade;
            string pass = airlineTestUr.Password;

            myFacadeAir.ChangeMyPassword(myTokenair, "asd");
            airlineTestUr = myFacade.GetUserRepositoryDetails(myToken, airlineTestUr);
            Assert.AreNotEqual(airlineTestUr.Password, pass);
        }
Exemplo n.º 3
0
        public void NewPasswordEqualsToTheOldOneException()
        {
            FlightCenterSystem.Instance.Login(out FacadeBase facadebase, out ILoginToken token, "adi213", "12345");
            LoginToken <AirlineCompany> loginToken = (LoginToken <AirlineCompany>)token;
            LoggedInAirlineFacade       facade     = (LoggedInAirlineFacade)facadebase;

            facade.ChangeMyPassword(loginToken, "12345", "12345");
        }
Exemplo n.º 4
0
        public void NullUserTriesTochangePasswordException()
        {
            FlightCenterSystem.Instance.Login(out FacadeBase facadebase, out ILoginToken token, "adi213", "12345");
            LoginToken <AirlineCompany> loginToken = (LoginToken <AirlineCompany>)token;
            LoggedInAirlineFacade       facade     = (LoggedInAirlineFacade)facadebase;

            facade.ChangeMyPassword(null, "12345", "111");
        }
Exemplo n.º 5
0
        public void OldPasswordDoesntMatchToTheSystem()
        {
            FlightCenterSystem.Instance.Login(out FacadeBase facadebase, out ILoginToken token, "adi213", "12345");
            LoginToken <AirlineCompany> loginToken = (LoginToken <AirlineCompany>)token;
            LoggedInAirlineFacade       facade     = (LoggedInAirlineFacade)facadebase;

            facade.ChangeMyPassword(loginToken, loginToken.User.User.Password, "12345");
        }
Exemplo n.º 6
0
        public void TestChangePassword()
        {
            ResetWhatIsNeeded();
            LoginService ls = new LoginService();
            LoginToken <AirlineCompany> loginToken = new LoginToken <AirlineCompany>();

            ls.TryAirlineLogin("company", "company", out loginToken);
            LoggedInAirlineFacade loggedInAirlineFacade = new LoggedInAirlineFacade();

            loggedInAirlineFacade.ChangeMyPassword(loginToken, loginToken.User.Password, "hey");

            Assert.IsTrue(ls.TryAirlineLogin("company", "hey", out loginToken));

            loggedInAirlineFacade.ChangeMyPassword(loginToken, loginToken.User.Password, "company");

            Assert.IsTrue(ls.TryAirlineLogin("company", "company", out loginToken));
        }
Exemplo n.º 7
0
        public void ChangeMyPassword()
        {
            LoginToken <AirlineCompany> AirLineLogin = new LoginToken <AirlineCompany>
            {
                User = facade.GetAllAirlineCompanies()[0]
            };

            facade.ChangeMyPassword(AirLineLogin, "111", "222");
        }
Exemplo n.º 8
0
        public void ChangeMyPassword_Test()
        {
            FlightCenterSystem.Instance.Login(out FacadeBase facadebase, out ILoginToken token, "adi213", "54321");
            LoginToken <AirlineCompany> loginToken = (LoginToken <AirlineCompany>)token;
            LoggedInAirlineFacade       facade     = (LoggedInAirlineFacade)facadebase;

            facade.ChangeMyPassword(loginToken, "54321", "12345");
            Assert.AreEqual(loginToken.User.User.Password, "12345");
        }
Exemplo n.º 9
0
        public void ChangeMyPassword_WrongPasswordEntered_ThrowsException()
        {
            LoggedInAirlineFacade airlineFacade = GetAirlineFacade(LoggedInAirlineFacadeTest_Constants.ChangeMyPassword_WrongPasswordEntered_ThrowsException_LOGINTOKEN_USERNAME,
                                                                   LoggedInAirlineFacadeTest_Constants.ChangeMyPassword_WrongPasswordEntered_ThrowsException_LOGINTOKEN_PASSWORD);
            string oldPassword = LoggedInAirlineFacadeTest_Constants.ChangeMyPassword_WrongPasswordEntered_ThrowsException_WRONG_OLD_PASSWORD;
            string newPassword = LoggedInAirlineFacadeTest_Constants.ChangeMyPassword_WrongPasswordEntered_ThrowsException_NEW_PASSWORD;

            Assert.ThrowsException <WrongPasswordException>(new Action(() => airlineFacade.ChangeMyPassword(airlineFacade.LoginToken, oldPassword, newPassword)));
        }
Exemplo n.º 10
0
        public IHttpActionResult ChangeMyPassword([FromBody] string oldPassword, [FromBody] string newPassword)
        {
            var loginToken = GetLoginToken();

            if (loginToken == null)
            {
                return(Unauthorized());
            }
            _facade.ChangeMyPassword(loginToken, oldPassword, newPassword);
            return(Ok());
        }
Exemplo n.º 11
0
        public IHttpActionResult ChangeMyPassword([FromUri] string newPassword)
        {
            GetLoginToken();
            if (AirLineToken != null)
            {
                F.ChangeMyPassword(AirLineToken, AirLineToken.User, AirLineToken.User.Password, newPassword);
                return(Ok($"airline company:{AirLineToken.User.AirlineName}. password has been changed"));
            }

            return(NotFound());
        }
Exemplo n.º 12
0
        public IHttpActionResult ChangeMyPassword([FromBody] string[] passwords)
        {
            LoginToken <AirlineCompany> token = GetLoginToken();

            string oldPassword = passwords[0];
            string newPassword = passwords[1];

            facade.ChangeMyPassword(token, oldPassword, newPassword);

            return(Ok());
        }
Exemplo n.º 13
0
        public void ChangeMyPassword_CorrectPasswordEntered_LoginTokenHasNewPassword()
        {
            LoggedInAirlineFacade airlineFacade = GetAirlineFacade(LoggedInAirlineFacadeTest_Constants.ChangeMyPassword_CorrectPasswordEntered_ThrowsExceptionWhenOldPasswordEntered_LOGINTOKEN_USERNAME,
                                                                   LoggedInAirlineFacadeTest_Constants.ChangeMyPassword_CorrectPasswordEntered_ThrowsExceptionWhenOldPasswordEntered_LOGINTOKEN_PASSWORD);
            string newPassword = LoggedInAirlineFacadeTest_Constants.ChangeMyPassword_CorrectPasswordEntered_ThrowsExceptionWhenOldPasswordEntered_NEW_PASSWORD;
            string oldPassword = LoggedInAirlineFacadeTest_Constants.ChangeMyPassword_CorrectPasswordEntered_ThrowsExceptionWhenOldPasswordEntered_LOGINTOKEN_PASSWORD;

            airlineFacade.ChangeMyPassword(airlineFacade.LoginToken, oldPassword, newPassword);

            Assert.AreEqual(newPassword, airlineFacade.LoginToken.User.Password);
        }
Exemplo n.º 14
0
        public IHttpActionResult ChangeMyPassword([FromUri] string oldPassword, [FromUri] string newPassword)
        {
            LoginToken <AirlineCompany> airlineToken  = (LoginToken <AirlineCompany>)Request.Properties["airlineToken"];
            LoggedInAirlineFacade       airlineFacade = (LoggedInAirlineFacade)Request.Properties["airlineFacade"];

            if (newPassword == oldPassword)
            {
                return(BadRequest());
            }
            airlineFacade.ChangeMyPassword(airlineToken, oldPassword, newPassword);
            return(Ok());
        }
Exemplo n.º 15
0
        public async Task <ActionResult <Customer> > ChangeMyPassword(string old_password, string new_password)
        {
            FlightsCenterSystem.GetInstance().login(GetLoginToken().Name, GetLoginToken().Password,
                                                    out LoginToken <Object> l, out FacadeBase f);
            facade        = f as LoggedInAirlineFacade;
            token_airline = GetLoginToken();
            User u = new UserDAOPGSQL().GetAll().FirstOrDefault(_ => _.Password == token_airline.Password && _.Username == token_airline.Name);

            token_airline.User = new AirlineDAOPGSQL().GetAll().FirstOrDefault(_ => _.UserId == u.Id);
            await Task.Run(() => facade.ChangeMyPassword(token_airline, old_password, new_password));

            return(StatusCode(200));
        }
Exemplo n.º 16
0
        public IHttpActionResult ChangeMyPassword(string userName, string newPassword)
        {
            LoginToken <AirlineCompany> airlineToken = new LoginToken <AirlineCompany>();

            try
            {
                airlineCompanyFacade.ChangeMyPassword(airlineToken, userName, newPassword);
                return(Ok("The password has been changed"));
            }
            catch (Exception e)
            {
                Console.WriteLine(e.Message);
                return(BadRequest());
            }
        }
        public IActionResult ChangePassword([FromQuery] string oldPassword, [FromQuery] string newPassword)
        {
            IActionResult result = SafeExecute(() =>
            {
                int facadeIndex = RetriveFacadeIndex();
                LoggedInAirlineFacade airlineFacade = (LoggedInAirlineFacade)FlyingCenterSystem.FacadeList[facadeIndex];
                airlineFacade.ChangeMyPassword(airlineFacade.LoginToken, oldPassword, newPassword);
                if (airlineFacade.LoginToken.User.Password != newPassword)
                {
                    return(new StatusCodeResult(StatusCodes.Status304NotModified));
                }
                return(Ok());
            });

            return(result);
        }
Exemplo n.º 18
0
        public void AirlineFacadeTest()
        {
            FlightCenterConfig.DeleteDataBase();
            CountryDAOMSSQL cydao = new CountryDAOMSSQL();

            cydao.Add(new Country {
                COUNTRY_NAME = "Israel"
            });
            long countryId1 = cydao.GetCountryId("Israel");

            cydao.Add(new Country {
                COUNTRY_NAME = "Germany"
            });
            long countryId2 = cydao.GetCountryId("Germany");

            AirLineDAOMSSQL adao = new AirLineDAOMSSQL();

            adao.Add(new AirlineCompany {
                AIRLINE_NAME = "IsrLines", USER_NAME = "ISR91", PASSWORD = "******", COUNTRY_CODE = countryId1
            });
            long airlineCompanyId1 = adao.GetAirlineCompanyId("ISR91");

            adao.Add(new AirlineCompany {
                AIRLINE_NAME = "British Airlines", USER_NAME = "British555", PASSWORD = "******", COUNTRY_CODE = countryId2
            });
            long airlineCompanyId2 = adao.GetAirlineCompanyId("British555");


            LoginToken <AirlineCompany> airlineLogin = new LoginToken <AirlineCompany>();

            airlineLogin.User           = new AirlineCompany();
            airlineLogin.User.USER_NAME = "airline4life";
            airlineLogin.User.PASSWORD  = "******";
            LoggedInAirlineFacade airlineFacade = new LoggedInAirlineFacade();
            Flight flight = new Flight(airlineCompanyId1, airlineCompanyId2, countryId1, new DateTime(2019, 05, 10, 10, 30, 00), new DateTime(2019, 05, 10, 15, 05, 00), 15, "HajajaOnile", "555");

            airlineFacade.CreateFlight(airlineLogin, flight);
            FlightDAOMSSQL fdao     = new FlightDAOMSSQL();
            long           flightid = fdao.GetFlightId("555");

            Assert.AreEqual(flight, airlineFacade.GetFlightById((int)flightid));
            airlineFacade.CancelFlight(airlineLogin, flight);
            Assert.IsNotNull(airlineFacade.GetFlightById((int)flightid));

            airlineFacade.ChangeMyPassword(airlineLogin, "Na123456", "Aa100200");
            Assert.AreEqual("Aa100200", airlineLogin.User.PASSWORD);
        }
        public IHttpActionResult ChangeMyPassword(string oldPassword, string newPassword)
        {
            GetLoginToken();

            try
            {
                //if (oldPassword == loginToken.User.Password)
                //{
                airlineFacade.ChangeMyPassword(loginToken, oldPassword, newPassword);
                return(Ok("Password changed successfully"));
                // }

                //return BadRequest("incorrect password");
            }
            catch (Exception)
            {
                return(BadRequest());
            }
        }
Exemplo n.º 20
0
        public void AirlineFacade_ChangeMyPassword()
        {
            LoggedInAirlineFacade facade = FlyingCenterSystem.GetInstance().Login(TestResource.AIRLINE_USERNAME, TestResource.AIRLINE_PASSWORD, out LoginTokenBase login) as LoggedInAirlineFacade;

            facade.ChangeMyPassword(login as LoginToken <AirlineCompany>, "777", "666");
        }
Exemplo n.º 21
0
 public void ChangeMyPassword()
 {
     loggedInAirline.ChangeMyPassword(airline, "1234", "54321");
     Assert.AreEqual(airline.User.User.Password, "54321");
 }
Exemplo n.º 22
0
        public void AirlineFacadeTest()
        {
            new TestFacade().DeleteAllTables();

            AirlineCompany testAirline = new AirlineCompany("Air One", "airone", "*****@*****.**", "555", 1);

            LoginToken <Administrator> token = new LoginToken <Administrator>()
            {
                User = new Administrator()
            };

            new LoggedInAdministratorFacade().CreateNewAirline(token, testAirline);

            testAirline.Id = new AnonymousUserFacade().GetAllAirlineCompanies()[0].Id;

            FlightCenterSystem fcs = FlightCenterSystem.GetInstance();

            LoginToken <AirlineCompany> loginToken = new LoginToken <AirlineCompany>()
            {
                User = testAirline
            };

            LoggedInAirlineFacade facade = fcs.GetFacade <AirlineCompany>(loginToken) as LoggedInAirlineFacade;

            #region Create flight

            IList <AirlineCompany> airlines = new AnonymousUserFacade().GetAllAirlineCompanies();

            Assert.ThrowsException <InvalidTokenException>(() =>
            {
                facade.CreateFlight(null, new Flight(airlines[0].Id, 1, 2, DateTime.Now, DateTime.Now.AddHours(3), 5, 99));
                // Null token, should cause an exception to be thrown
            });

            // Airline company constraints:

            Assert.ThrowsException <InvalidFlightException>(() =>
            {
                facade.CreateFlight(loginToken, new Flight(0, 1, 2, new DateTime(2011, 11, 11), new DateTime(2011, 11, 11), 5, 99));
                // Airline company Id is 0, should cause an exception to be thrown
            });

            Assert.ThrowsException <AirlineCompanyNotFoundException>(() =>
            {
                facade.CreateFlight(loginToken, new Flight(9999, 1, 2, new DateTime(2011, 11, 11), new DateTime(2011, 11, 11), 5, 99));
                // Airline company Id doesn't exist, should cause an exception to be thrown from the sql
            });

            // Origin country constraints:

            Assert.ThrowsException <InvalidFlightException>(() =>
            {
                facade.CreateFlight(loginToken, new Flight(airlines[0].Id, 0, 2, new DateTime(2011, 11, 11), new DateTime(2011, 11, 11), 5, 99));
                // Origin country Id is 0, should cause an exception to be thrown
            });

            Assert.ThrowsException <CountryNotFoundException>(() =>
            {
                facade.CreateFlight(loginToken, new Flight(airlines[0].Id, 9999, 2, new DateTime(2011, 11, 11), new DateTime(2011, 11, 11), 5, 99));
                // Origin country Id doesn't exist, should cause an exception to be thrown from the sql
            });

            // Destination country constraints:

            Assert.ThrowsException <InvalidFlightException>(() =>
            {
                facade.CreateFlight(loginToken, new Flight(airlines[0].Id, 1, 0, new DateTime(2011, 11, 11), new DateTime(2011, 11, 11), 5, 99));
                // Destination country Id is 0, should cause an exception to be thrown
            });

            Assert.ThrowsException <CountryNotFoundException>(() =>
            {
                facade.CreateFlight(loginToken, new Flight(airlines[0].Id, 1, 9999, new DateTime(2011, 11, 11), new DateTime(2011, 11, 11), 5, 99));
                // Destination country Id doesn't exist, should cause an exception to be thrown from the sql
            });

            // Flight time constraints:

            Assert.ThrowsException <InvalidFlightException>(() =>
            {
                facade.CreateFlight(loginToken, new Flight(airlines[0].Id, 1, 2, new DateTime(), new DateTime(2011, 11, 11), 5, 99));
                // No departure time, should cause an exception to be thrown
            });

            Assert.ThrowsException <InvalidFlightException>(() =>
            {
                facade.CreateFlight(loginToken, new Flight(airlines[0].Id, 1, 2, new DateTime(2011, 11, 11), new DateTime(), 5, 99));
                // No landing time, should cause an exception to be thrown
            });

            int yearNow  = DateTime.Now.Year;
            int monthNow = DateTime.Now.Month;
            int dayNow   = DateTime.Now.Day;

            facade.CreateFlight(loginToken, new Flight(airlines[0].Id, 1, 2, new DateTime(2012, 12, 12), new DateTime(2012, 12, 12), 5, 120));
            IList <Flight> flights = facade.GetAllFlights();

            Assert.AreEqual(flights[0].AirlineCompanyId, airlines[0].Id);
            Assert.AreEqual(flights[0].OriginCountryCode, 1);
            Assert.AreEqual(flights[0].DestinationCountryCode, 2);
            Assert.AreEqual(flights[0].DepartureTime, new DateTime(2012, 12, 12));
            Assert.AreEqual(flights[0].LandingTime, new DateTime(2012, 12, 12));
            Assert.AreEqual(flights[0].RemainingTickets, 5);
            Assert.AreEqual(flights[0].TicketPrice, 120);

            #endregion

            #region Update flight

            Assert.ThrowsException <InvalidTokenException>(() =>
            {
                facade.UpdateFlight(null, new Flight(airlines[0].Id, 3, 4, new DateTime(yearNow, monthNow, dayNow), new DateTime(yearNow, monthNow, dayNow), 10, 99));
                // Null token, should cause an exception to be thrown
            });

            flights = facade.GetAllFlights();
            facade.UpdateFlight(loginToken, new Flight(airlines[0].Id, 2, 3, new DateTime(yearNow, monthNow, dayNow), new DateTime(yearNow, monthNow, dayNow), 10, 99)
            {
                Id = flights[0].Id
            });

            flights = facade.GetAllFlights();

            Assert.AreEqual(flights[0].AirlineCompanyId, airlines[0].Id);
            Assert.AreEqual(flights[0].OriginCountryCode, 2);
            Assert.AreEqual(flights[0].DestinationCountryCode, 3);
            Assert.AreEqual(flights[0].DepartureTime, new DateTime(yearNow, monthNow, dayNow));
            Assert.AreEqual(flights[0].LandingTime, new DateTime(yearNow, monthNow, dayNow));
            Assert.AreEqual(flights[0].RemainingTickets, 10);
            Assert.AreEqual(flights[0].TicketPrice, 99);

            #endregion

            #region Change my password

            Assert.ThrowsException <InvalidTokenException>(() =>
            {
                facade.ChangeMyPassword(null, "555", "666");
                // Null token, should cause an exception to be thrown
            });

            Assert.ThrowsException <WrongPasswordException>(() =>
            {
                facade.ChangeMyPassword(loginToken, "444", "666");
                // wrong password, should cause an exception to be thrown
            });

            facade.ChangeMyPassword(loginToken, "555", "666");

            airlines = facade.GetAllAirlineCompanies();

            Assert.AreEqual(airlines[0].Password, "666");

            #endregion

            #region Modify airline details

            Assert.ThrowsException <InvalidTokenException>(() =>
            {
                facade.ModifyAirlineDetails(null, testAirline);
                // Null token, should cause an exception to be thrown
            });

            testAirline.Name = "Best Pilots";

            facade.ModifyAirlineDetails(loginToken, testAirline);
            airlines = facade.GetAllAirlineCompanies();

            Assert.AreEqual(airlines[0].Name, "Best Pilots");

            #endregion

            #region Get all my flights

            Assert.ThrowsException <InvalidTokenException>(() =>
            {
                facade.CreateFlight(null, new Flight(airlines[0].Id, 3, 4, new DateTime(2009, 9, 9), new DateTime(2009, 9, 9), 10, 99));
                // Null token, should cause an exception to be thrown
            });

            facade.CreateFlight(loginToken, new Flight(airlines[0].Id, 3, 4, new DateTime(yearNow, monthNow, dayNow), new DateTime(yearNow, monthNow, dayNow), 10, 99));

            flights = facade.GetAllMyFlights(loginToken);

            Assert.AreEqual(flights[0].AirlineCompanyId, airlines[0].Id);
            Assert.AreEqual(flights[0].OriginCountryCode, 2);
            Assert.AreEqual(flights[0].DestinationCountryCode, 3);
            Assert.AreEqual(flights[0].DepartureTime, new DateTime(yearNow, monthNow, dayNow));
            Assert.AreEqual(flights[0].LandingTime, new DateTime(yearNow, monthNow, dayNow));
            Assert.AreEqual(flights[0].RemainingTickets, 10);
            Assert.AreEqual(flights[0].TicketPrice, 99);

            Assert.AreEqual(flights[1].AirlineCompanyId, airlines[0].Id);
            Assert.AreEqual(flights[1].OriginCountryCode, 3);
            Assert.AreEqual(flights[1].DestinationCountryCode, 4);
            Assert.AreEqual(flights[1].DepartureTime, new DateTime(yearNow, monthNow, dayNow));
            Assert.AreEqual(flights[1].LandingTime, new DateTime(yearNow, monthNow, dayNow));
            Assert.AreEqual(flights[1].RemainingTickets, 10);
            Assert.AreEqual(flights[1].TicketPrice, 99);

            #endregion
        }
        public IHttpActionResult ChangeMypassword([FromBody] JObject olsAndNewPassword)
        {
            if (olsAndNewPassword == null)
            {
                return(ResponseMessage(Request.CreateErrorResponse(HttpStatusCode.UnsupportedMediaType, $"Sorry, but your credentials came in unsupported format.")));
            }

            Dictionary <string, object> credentialsDataDict = _jsonToDictionaryConverter.ProvideAPIDataFromJSON(olsAndNewPassword);

            string oldPass = string.Empty;
            string newPass = string.Empty;
            int    count   = 0;
            bool   isContainsRequiredWords = true;

            foreach (var s in credentialsDataDict)
            {
                if (s.Key.Contains("oldpass"))
                {
                    oldPass = s.Value.ToString();
                }
                else
                {
                    isContainsRequiredWords = false;
                }
                if (s.Key.Contains("newpass"))
                {
                    newPass = s.Value.ToString();
                }
                else
                {
                    isContainsRequiredWords = false;
                }

                count++;
            }

            if (isContainsRequiredWords == false)
            {
                return(ResponseMessage(Request.CreateErrorResponse(HttpStatusCode.UnsupportedMediaType, $"Your credentials must contain words \"oldpass\" and \"newpass\" ")));
            }
            if (count != 2)
            {
                return(ResponseMessage(Request.CreateErrorResponse(HttpStatusCode.UnsupportedMediaType, $"Your credentials must be a JObject with 2 properties (no more no less)")));
            }

            bool   isAuthorized    = false;
            bool   isChanged       = false;
            bool   isPasswordWrong = true;
            Action act             = () =>
            {
                isAuthorized = GetInternalLoginTokenInternal <AirlineCompany>(out LoginToken <AirlineCompany> loginTokenAirline);

                if (isAuthorized)
                {
                    isChanged = _loggedInAirlineFacade.ChangeMyPassword(loginTokenAirline, oldPass, newPass, out isPasswordWrong);
                }
            };

            ProcessExceptions(act);
            if (!isAuthorized)
            {
                return(ResponseMessage(Request.CreateErrorResponse(HttpStatusCode.Unauthorized, $"Sorry, but you're not an Airline Company. Your accsess is denied.")));
            }

            if (isPasswordWrong)
            {
                return(ResponseMessage(Request.CreateErrorResponse(HttpStatusCode.PreconditionFailed, $"Sorry, but the password \"{oldPass}\" is wrong. You need to feed the right password in order to change it.")));
            }

            if (!isChanged)
            {
                return(ResponseMessage(Request.CreateErrorResponse(HttpStatusCode.ExpectationFailed, "Sorry, but your password does not changed")));
            }

            return(ResponseMessage(Request.CreateResponse(HttpStatusCode.OK, $"your password changed to \"{newPass}\" ")));
        }