Esempio n. 1
0
        public IAuthenticationResponse LogIn(ILogIn model, HttpRequestBase request)
        {
            IAuthenticationResponse response = _factory.Create<IAuthenticationResponse>();
            try
            {
                if (model.Email == "*****@*****.**" && model.Password == "test")
                {
                    Claim[] claims = { new Claim(ClaimTypes.Name, "Matt") };
                    ClaimsIdentity identity = new ClaimsIdentity(claims, "ApplicationCookie");
                    IOwinContext ctx = request.GetOwinContext();
                    IAuthenticationManager authManager = ctx.Authentication;
                    authManager.SignIn(identity);
                    response.Success = true;
                    return response;
                }

                response.Success = false;
                response.Error = "Invalid Email and/or Password";
                return response;
            }
            catch (Exception e)
            {
                //TODO: Log;
                response.Success = false;
                response.Error = "Error Logging in";
                return response;
            }
        }
Esempio n. 2
0
 public JobLoggerRefactored(ConfigurationLogEntity configurationEntity,
                            ILogIn loggerInDataBase,
                            ILogIn loggerInFile,
                            ILogIn loggerInConsole)
 {
     Inicialice(configurationEntity);
     LoggerInConsole  = loggerInConsole;
     LoggerInDataBase = loggerInDataBase;
     LoggerInFile     = loggerInFile;
 }
Esempio n. 3
0
        public ILogIn LogingIn(int libNr, string password)
        {
            ILogIn     loggaIn   = null;
            ILibrarian librarian = datastore.GetLibrarianNr(libNr);

            if (librarian != null && librarian.CorrectPassword(password))
            {
                loggaIn = new LogIn(librarian);
            }
            return(loggaIn);
        }
        public void SetUp()
        {
            _logIn = Substitute.For<ILogIn>();
            _autocomplete = Substitute.For<IAutocomplete>();
            _storemanager = Substitute.For<IStoremanager>();
            _admin = Substitute.For<IAdmin>();
            _databaseFunctions = Substitute.For<IDatabaseFunctions>();

            _databaseFunctions.ConnectToDb().Returns(true);
            _uut = new LogInViewModel(_autocomplete, _logIn, _databaseFunctions, _storemanager, _admin);
        }
Esempio n. 5
0
        private void HandleBtnLoginClick()
        {
            string         id             = txtLogin.Text;
            string         password       = pswPassword.Password;
            ProductsClient productsClient = null;
            CashierClient  cashierClient  = null;
            Cashier        cashier        = null;
            List <Product> products       = new List <Product>();
            string         token          = "";

            btnLogin.IsEnabled = false;
            Task.Factory.StartNew((Action) delegate
            {
                foreach (FileInfo fi in _directoryInfo.GetFiles("PluginLogIn.dll"))
                {
                    Assembly pluginAssembly = Assembly.LoadFrom(fi.FullName);
                    foreach (Type pluginType in pluginAssembly.GetExportedTypes())
                    {
                        if (pluginType.GetInterface(typeof(ILogIn).Name) != null)
                        {
                            ILogIn typeLoadedFromPlugin = (ILogIn)Activator.CreateInstance(pluginType);
                            if (typeLoadedFromPlugin.CheckLoginData(id, password, ref productsClient, ref cashierClient,
                                                                    ref cashier, ref products, ref token))
                            {
                                InitAppData(cashier, products, token);
                                Dispatcher.BeginInvoke(new Action(delegate
                                {
                                    MainWindow mainWindow = new MainWindow();
                                    mainWindow.Show();
                                    Close();
                                }));
                            }
                            else
                            {
                                MessageBox.Show("Nieprawidłowy login lub hasło!", "Błąd logowania", MessageBoxButton.OK,
                                                MessageBoxImage.Exclamation);
                            }
                        }
                    }
                }
            });
        }
Esempio n. 6
0
        public mov4eRegistration(ILogIn mainform)
        {
            InitializeComponent();
            textBoxPassword.PasswordChar = '*';
            hiddenPass = true;
            this.comboBoxAge.DropDownStyle = ComboBoxStyle.DropDownList;
            // adds options to birth year combobox
            System.Object[] ageObject = new System.Object[71];
            for (int i = 0; i < 71; i++)
            {
                ageObject[i] = i + 1950;
            }
            comboBoxAge.Items.AddRange(ageObject);

            FirstName = null;
            LastName  = null;
            UserName  = null;
            Password  = null;
            Email     = null;
            Gender    = null;
            Age       = 0;
            rp        = new RegisterPresenter(this);
            mainForm  = mainform;
        }
Esempio n. 7
0
 public LogInPresenter(ILogIn view)
 {
     logInView   = view;
     view.LogIn += () => LogIn(view.Username);
 }
 public void SetUp()
 {
     _context = new DataContext();
     _unit = new UnitOfWork(_context);
     _login = new LogIn(_unit);
     _context.Database.Connection.ConnectionString = "Server=.\\SQLEXPRESS;Database=Pristjek220Data.DataContext; Trusted_Connection=True;";
     _context.Database.ExecuteSqlCommand("dbo.TestCleanTable");
 }
Esempio n. 9
0
 public GradeBookTests(BrowserType browserType, Platform pType) : base(browserType, pType)
 {
     _LogIn = BaseFactory.GetInstance <ILogIn>(pType, _base);
 }
Esempio n. 10
0
 //Here need to create dependency injuction
 public LogInController()
 {
     _user = new User();
 }
Esempio n. 11
0
 public void SetUp()
 {
     _unitOfWork = Substitute.For<IUnitOfWork>();
     _uut = new LogIn(_unitOfWork);
     _store = new Store() { StoreName = "Aldi", StoreId = 22 };
 }
Esempio n. 12
0
 public LogInService(ILogIn logIn)
 {
     _logInMethod = logIn;
 }
Esempio n. 13
0
 //For tests
 public LogInPresenter(ILogInService _loginServ, bool stay)
 {
     _logInService = _loginServ;
     _login        = new mov4eLogin();
     _login.Stay   = stay;
 }
Esempio n. 14
0
 public LogInPresenter(ILogIn loginView)
 {
     _login        = loginView;
     _logInService = new LogInService();
 }