Example #1
0
        public async Task <ActionResult> LogOn(LogOn model, string returnUrl)
        {
            if (ModelState.IsValid)
            {
                if (IsEmail(model.UserName))
                {
                    model.UserName = UnitOfWork <UserManager>().GetUserByEmail(model.UserName).UserName;
                }
                if (await UnitOfWork <UserManager>().ValidateUser(model.UserName.Trim(), model.Password.Trim()))
                {
                    var profile = UnitOfWork <UserProfileManager>().GetProfileByUser(model.UserName);
                    var user    = profile.User;
                    user.SecurityStamp = Guid.NewGuid().ToString();
                    await UnitOfWork <UserManager>().SignInAsync(user, false);

                    UnitOfWork <UserManager>().LogSignIn(model.UserName, model.RememberMe);
                    // broadcast new userlist to all clients
                    if (Url.IsLocalUrl(returnUrl))
                    {
                        return(Redirect(returnUrl));
                    }
                    return(Redirect(Url.Action("Index", "Home")));
                }

                ModelState.AddModelError("", ControllerResources.AccountController_LogOn_The_user_name_or_password_provided_is_incorrect);
            }
            UnitOfWork <UserManager>().RegisterFailedAttempt(model.UserName);
            // If we got so far, something failed, redisplay form
            return(View(model));
        }
Example #2
0
 /// <summary>
 /// Assigns the logOn rule.
 /// </summary>
 /// <param name="logOn">The Log on</param>
 public static void AssignLoginRule(LogOn logOn)
 {
     if (logOn.Validate == null)
     {
         logOn.Validate = () => ApplyLoginRule(logOn);
     }
 }
Example #3
0
        private void WinMain_Load(object sender, EventArgs e)
        {
           
            BufferFormatV2.ObjFormatType = BuffFormatType.protobuf;
            ReadBytesV2.ObjFormatType = BuffFormatType.protobuf;
            

            LogOn logon = new LogOn();
            logon.ShowDialog();

            if (!logon.IsLogOn)
            {
                Close();
                return;
            }

            Path = logon.Path;

            SocketManager.BinaryInput += new ZYSocket.ClientB.ClientBinaryInputHandler(SocketManager_BinaryInput);
            SocketManager.Disconnet += new ZYSocket.ClientB.ClientMessageInputHandler(SocketManager_Disconnet);
                     
            
            LoadingDiskInfo();            

            this.WindowState = FormWindowState.Minimized;
         

        }
Example #4
0
        private LogOn_Status Logic_LogOn(LogOn logon)
        {
            if (ModelState.IsValid)
            {
                Customers avv = new Customers();
                // var result = (from a in new Av_CustDBContext().av_cust
                //             where (a.E_mail == logon.E_Mail && a.Password == logon.Password)
                //           select a).ToList();
                var result = from b in av.customer where logon.E_Mail == b.E_mail select b;
                foreach (var t in result)
                {
                    avv = t;
                    if (avv.Password == logon.Password)
                    {
                        Session["swi"] = avv.Cust_Id;
                        if (avv.Admin == 0)
                        {
                            Session["isadmin"] = "no";
                        }
                        else
                        {
                            Session["isadmin"] = "yes";
                        }

                        return(LogOn_Status.Custm);
                    }
                }
                //TODO open session
                ViewBag.loginerror = true;
                return(LogOn_Status.Error); ///RedirectToAction("Index", "Home");
            }
            return(LogOn_Status.Invld);     //View(logon);
        }
Example #5
0
        public ActionResult LogOn(LogOn logOn, string returnUrl)
        {
            if (ModelState.IsValid)
            {
                logOn.User.PW = Convert.ToBase64String(
                    new System.Security.Cryptography.SHA1CryptoServiceProvider().ComputeHash(
                        Encoding.ASCII.GetBytes(logOn.User.PW)));

                var contextUser = db.Users.Where(e => e.UserName == logOn.User.UserName && e.PW == logOn.User.PW).FirstOrDefault();

                if (contextUser != null)
                {
                    IFormsAuthenticationService formsService = new FormsAuthenticationService();
                    formsService.SignIn(logOn.User.UserName, logOn.RememberMe);

                    if (!String.IsNullOrEmpty(returnUrl))
                    {
                        return(Redirect(returnUrl));
                    }
                    else
                    {
                        return(RedirectToAction("Index", "Home"));
                    }
                }
                else
                {
                    ModelState.AddModelError("", "The user name or password provided is incorrect.");
                }
            }

            // If we got this far, something failed, redisplay form
            //return View(new LogOnViewModel(logOnModel));

            return(View(new LogOn()));
        }
Example #6
0
 public ActionResult Login(LogOn model, string returnUrl)
 {
     if (ModelState.IsValid)
     {
         if (Membership.ValidateUser(model.UserName, model.Password))
         {
             FormsAuthentication.SetAuthCookie(model.UserName, model.RememberMe);
             var x = FormsAuthentication.GetAuthCookie(model.UserName, model.RememberMe);
             if (Url.IsLocalUrl(returnUrl))
             {
                 var y = x;
                 return(Redirect(returnUrl));
             }
             else
             {
                 return(RedirectToAction("GetAllBooks", "Book"));
             }
         }
         else
         {
             ModelState.AddModelError("", "Wrong login or password");
         }
     }
     return(View(model));
 }
        protected override void OnStartup(StartupEventArgs e)
        {
            base.OnStartup(e);

            Application.Current.ShutdownMode = ShutdownMode.OnExplicitShutdown;
            LogOn logon = new LogOn();
            bool? res   = logon.ShowDialog();

            Application.Current.MainWindow   = null;
            Application.Current.ShutdownMode = ShutdownMode.OnMainWindowClose;

            if (!(bool)res)
            {
                Bootstrapper bs = new Bootstrapper();
                bs.Run();
            }
            else
            {
                MessageBox.Show(
                    "Application is exiting due to invalid credentials",
                    "Application Exit",
                    MessageBoxButton.OK,
                    MessageBoxImage.Error);
                Application.Current.Shutdown(1);
            }
        }
Example #8
0
        public void ShowLogOn()
        {
            var logon = new LogOn();

            logon.Attempts = _attempts;
            bool?res = logon.ShowDialog();

            if (!res ?? true)
            {
                Shutdown(1);
            }
            else
            {
                NaoCoopObjects.Classes.User user = Helpers.DataAccessHelper.Instance.UsersManager.ValidateUsernameAndPassword(logon.UserName, logon.Password);
                if (user != null)
                {
                    StartUp(user);
                }
                else
                {
                    if (logon.Attempts > 2)
                    {
                        MessageBox.Show("Application is exiting due to invalid credentials", "Application Exit", MessageBoxButton.OK, MessageBoxImage.Error);
                        Shutdown(1);
                    }
                    else
                    {
                        _attempts += 1;
                        ShowLogOn();
                    }
                }
            }
        }
 /// <summary>
 /// Inserts the audit log.
 /// </summary>
 /// <param name="logOnInfo">The log in information.</param>
 /// <returns></returns>
 public void InsertAuditLog(LogOn logOnInfo)
 {
     //FIXED-2016-R2-S3 : change parameter type of FacilityID from VARCHAR(MAX) to INT in store procedure
     _databaseCommand = _databaseObj.GetStoredProcCommand("LogOnAuditLog");
     _databaseObj.AddInParameter(_databaseCommand, "@UserName", DbType.String, logOnInfo.UserName);
     _databaseObj.AddInParameter(_databaseCommand, "@UserFacilities", DbType.String, logOnInfo.FacilityIds);
     _databaseObj.ExecuteScalar(_databaseCommand);
 }
Example #10
0
        public LogOn LogOnMake(string username, string password)
        {
            LogOn lg = new LogOn();

            lg.E_Mail   = username;
            lg.Password = password;
            return(lg);
        }
Example #11
0
        public ActionResult LogOnMenu()
        {
            var model = new LogOn {
                UserName = UserName,
                Password = ""
            };

            return(PartialView("_LogOnMenu", model));
        }
Example #12
0
        public ActionResult Index(LogOn logon)
        {
            if (ModelState.IsValid)
            {
                Customers avv = new Customers();

                var result = from b in av.customer where logon.E_Mail == b.E_mail select b;
                foreach (var t in result)
                {
                    avv = t;
                    if (avv.Password == logon.Password)
                    {
                        Cs_SuDBContext csdb = new Cs_SuDBContext();
                        var            q    = from k in csdb.cs_su where k.Customer == avv.Cust_Id select k.Finish;
                        DateTime       dt   = DateTime.Now;
                        foreach (var item in q)
                        {
                            dt = item;
                        }
                        TimeSpan ts = dt.Subtract(DateTime.Now);
                        if (ts.Days < 0)
                        {
                            CustomersController cs = new CustomersController();
                            cs.rm(avv.Cust_Id);

                            return(RedirectToAction("Index", "Home"));
                        }
                        if (ts.Days < 4)
                        {
                            Session["renew"] = "Your profile just have " + ts.Days + " Days to expired !!";
                        }

                        Session["swi"] = avv.Cust_Id;
                        if (avv.Admin == 0)
                        {
                            Session["isadmin"] = "no";
                        }
                        else
                        {
                            Session["isadmin"] = "yes";
                        }

                        return(RedirectToAction("Index", "Customers"));
                    }
                }



                //TODO open session
                ViewBag.loginerror = true;
                return(RedirectToAction("Index", "Home"));
            }

            return(View(logon));
        }
Example #13
0
        public HttpResponseMessage LogOn(LogOn logOn)
        {
            //msg.url = "http://my.company.com/login";

            //if (SecurityManager.IsTokenValid(token))
            //{
            ForToken ret = new ForToken();

            ret = repository.LogOn(pclsCache, logOn.PwType, logOn.username, logOn.password, logOn.role);
            return(new ExceptionHandler().LogOn(Request, ret));
        }
Example #14
0
        public SignIn LogOn(LogOn model)
        {
            var logon = _accountService.LogOn(model);

            if (logon == null)
            {
                throw new HttpResponseException(Request.CreateErrorResponse(HttpStatusCode.Unauthorized, "User Unauthorized"));
            }

            return(logon);
        }
        public void LoginTest_Given_Credentials_NavigatesTo_HomePage()
        {
            // Arrange
            LoginController controller = new LoginController();
            LogOn           model      = new LogOn();

            model.UserId   = "*****@*****.**";
            model.Password = "******";
            // Act
            ActionResult result = controller.Login(model) as ViewResult;

            // Assert
            Assert.IsNull(result);
        }
Example #16
0
 /// <summary>
 /// Inserts the log on audit log.
 /// </summary>
 /// <param name="userInfo">The user information.</param>
 private void InsertLogOnAuditLog(UserInfo userInfo)
 {
     //FIXED-2016-R2-S3 : Use Enums.UserRoles to compare userInfo.UserTypeId
     //Audit logging for FacilityAdmin and User login but not for SSIAdmin login(UserTypeId = 1)
     if (userInfo != null && userInfo.UserTypeId != (int)Enums.UserRoles.SsiAdmin)
     {
         LogOn logOn = new LogOn
         {
             UserName       = userInfo.UserName,
             UserFacilities = AutoMapper.Mapper.Map <List <FacilityViewModel>, List <Facility> >(userInfo.AssignedFacilities)
         };
         PostApiResponse <bool>(Constants.LogOn, Constants.InsertAuditLog, logOn, true);
     }
 }
Example #17
0
        public ActionResult LogOn(LogOn model, string returnUrl)
        {
            IUsersRepository usersRepository = new UsersRepository(db);
            IRolesRepository rolesRepository = new RolesRepository(db);

            if (ModelState.IsValid)
            {
                if (usersRepository.ValidateUser(model.UserName, model.Password))
                {
                    string[] roles    = rolesRepository.GetRoleNamesByUsername(model.UserName);
                    string   userData = String.Join(", ", roles);

                    User user = usersRepository.GetUserByUsername(model.UserName);

                    userData += "|" + user.UserPK;

                    double sessionMinutes = ((SessionStateSection)WebConfigurationManager.GetSection("system.web/sessionState")).Timeout.TotalMinutes;

                    FormsAuthenticationTicket fAuthTicket = new FormsAuthenticationTicket(1, user.Username, DateTime.Now, DateTime.Now.AddMinutes(sessionMinutes), model.RememberMe, userData, FormsAuthentication.FormsCookiePath);
                    string     hashCookies = FormsAuthentication.Encrypt(fAuthTicket);
                    HttpCookie cookie      = new HttpCookie(FormsAuthentication.FormsCookieName, hashCookies);
                    Response.Cookies.Add(cookie);

                    IUserActivitiesRepository userActivitiesRepository = new UserActivitiesRepository(db);

                    UserActivity userActivity = UserActivityView.LogUserActivity(user.UserPK, "Ulazak u sustav.", DateTime.Now);

                    userActivitiesRepository.Add(userActivity);
                    userActivitiesRepository.SaveChanges();

                    if (Url.IsLocalUrl(returnUrl) && returnUrl.Length > 1 && returnUrl.StartsWith("/") && !returnUrl.StartsWith("//") && !returnUrl.StartsWith("/\\"))
                    {
                        return(Redirect(returnUrl));
                    }
                    else
                    {
                        return(RedirectToAction("Index", "ToDoList"));
                    }
                }
                else
                {
                    ModelState.AddModelError("", "Kriva kombinacija korisničkog imena i lozinke.");
                }
            }

            // If we got this far, something failed, redisplay form
            return(View(model));
        }
Example #18
0
        public SignIn LogOn(LogOn model)
        {
            using (var db = _documentStore.OpenSession())
            {
                var user = db.Query <User>()
                           .Where(m => m.Email == model.Email)
                           .SingleOrDefault();

                if (user != null && HashHelper.CompareHash(model.Password + user.Salt, user.PasswordHash))
                {
                    return(SignInUser(user));
                }
            }

            return(null);
        }
Example #19
0
        public void Update(LogOn pEvent)
        {
            if (prompt != null)
            {
                this.prompt.PromptText      = pEvent.PromptText;
                this.posDisplay.MessageText = "";
                prompt.InputText            = "";
                prompt.StartInputAnimation();
            }

            if (PosHardware.Instance.LineDisplay != null)
            {
                PosHardware.Instance.LineDisplay.Clear();
                PosHardware.Instance.LineDisplay.SetText(PosContext.Instance.Parameters.getParam("CustWelcome"));
            }
        }
Example #20
0
 //posting user credentials
 public ActionResult LogOn(LogOn logininfo)
 {
     if (ModelState.IsValid)
     {
         if (logininfo.UserId == Constant.Id && logininfo.Password == Constant.Password)
         {
             ViewBag.UserName = logininfo.UserId;
             return(RedirectToAction("UserHomeView"));
         }
         else
         {
             ModelState.AddModelError("", "Invalid username or password");
             return(View("Login"));
         }
     }
     return(View("Login"));
 }
Example #21
0
        private void btnOK_Click(object sender, EventArgs e)
        {
            if (chkUser.Checked)
            {
                this.DialogResult = DialogResult.OK;
                this.Close();
                return;
            }

            UserName   = txtUsername.Text.Trim();
            Password   = txtPassword.Text.Trim();
            DomainName = txtDomain.Text.Trim();

            if (string.IsNullOrEmpty(DomainName))
            {
                MessageBox.Show("Enter Domain.");
                txtDomain.Focus();
                return;
            }

            if (string.IsNullOrEmpty(UserName))
            {
                MessageBox.Show("Enter Username.");
                txtUsername.Focus();
                return;
            }

            if (string.IsNullOrEmpty(Password))
            {
                MessageBox.Show("Enter Password.");
                txtPassword.Focus();
                return;
            }

            if (!LogOn.LogonUser(UserName, Password, DomainName))
            {
                MessageBox.Show("Incorrect credentials or problem contacting server. Please try again.");
                ClearTextBoxes();
                return;
            }

            IsServiceAccount  = true;
            this.DialogResult = DialogResult.OK;
            this.Close();
        }
Example #22
0
 //posting user credentials
 public ActionResult Login(LogOn logininfo)
 {
     if (ModelState.IsValid)
     {
         if (logininfo.UserId == Constant.Id && logininfo.Password == Constant.Password)
         {
             TempData["IsLoggedIn"] = true;
             return(RedirectToAction("UserHomeView"));
         }
         else
         {
             ModelState.AddModelError("", "Invalid username or password");
             TempData["IsLoggedIn"] = false;
             return(View("Login"));
         }
     }
     TempData["IsLoggedIn"] = false;
     return(View("Login"));
 }
Example #23
0
        public void InsertAuditLog(LogOn logOnInfo)
        {
            if (logOnInfo != null)
            {
                //Fetches the distinct Facility Connection string
                List <string> facilityConnectionStrings =
                    logOnInfo.UserFacilities.Select(facility => facility.DataSource).Distinct().ToList();

                //Logs into database looping through each conectionstrings
                foreach (string connectionString in facilityConnectionStrings)
                {
                    logOnInfo.FacilityIds = String.Join(Constants.Comma,
                                                        logOnInfo.UserFacilities.Where(facility => facility.DataSource == connectionString)
                                                        .Select(facility => facility.FacilityId)
                                                        .ToList());
                    _logOnLogic = new LogOnLogic(connectionString);
                    _logOnLogic.InsertAuditLog(logOnInfo);
                }
            }
        }
Example #24
0
        public async Task <ActionResult> LogOn(LogOn model, string returnUrl)
        {
            if (ModelState.IsValid)
            {
                var user = await UserManager.FindAsync(model.UserName, model.Password);

                if (user.Success)
                {
                    await UserManager.SignInAsync(user.UserName, model.RememberMe);

                    return(RedirectToLocal(returnUrl));
                }
                else
                {
                    // SECURE: Increasing wait time (with random component) for each successive logon failure (instead of locking out)
                    System.Threading.Thread.Sleep(500 + (user.FailedLogonAttemptCount * 200) + (new Random().Next(4) * 200));
                    ModelState.AddModelError("", "Invalid credentials or account is locked");
                }
            }

            // If we got this far, something failed, redisplay form
            return(View(model));
        }
Example #25
0
        private void WinMain_Load(object sender, EventArgs e)
        {

            BufferFormatV2.ObjFormatType = BuffFormatType.XML;
            ReadBytesV2.ObjFormatType = BuffFormatType.XML;
            

            LogOn logon = new LogOn();
            logon.ShowDialog();

            if (!logon.IsLogOn)
            {
                Close();
                return;
            }

            SocketManager.BinaryInput += new ZYSocket.ClientB.ClientBinaryInputHandler(SocketManager_BinaryInput);
            SocketManager.Disconnet += new ZYSocket.ClientB.ClientMessageInputHandler(SocketManager_Disconnet);

          
            
            LoadingDiskInfo();

        }
Example #26
0
        public ActionResult Login(LogOn model)
        {
            //LibraryEntities db = new LibraryEntities();
            if (ModelState.IsValid)
            {
                // ищем пользователя в базе данных
                User user = null;
                using (OurDbContext db = new OurDbContext())
                {
                    user = db.User.FirstOrDefault(u => u.Email == model.Email && u.Password == model.Password);
                }
                if (user != null)
                {
                    FormsAuthentication.SetAuthCookie(model.Email, true);
                    return(RedirectToAction("Index", "Home"));
                }
                else
                {
                    ModelState.AddModelError("", "Пользователя с таким логином и паролем нет");
                }
            }

            return(View(model));
        }
Example #27
0
        public ClaimsIdentity Handle(LogOn message)
        {
            var user = _userManager.Find(message.Username, message.Password);

            if (user != null)
            {
                _authenticationManager.SignOut(DefaultAuthenticationTypes.ExternalCookie);

                var identity = _userManager.CreateIdentity(user, DefaultAuthenticationTypes.ApplicationCookie);

                identity.AddClaim(new Claim(ClaimTypes.Email, user.UserName));
                identity.AddClaim(new Claim(ClaimTypes.GivenName, user.FirstName + " " + user.Surname));
                identity.AddClaim(new Claim(CpmsClaimTypes.RememberMe, message.RememberMe.ToString()));
                identity.AddClaim(new Claim(CpmsClaimTypes.UserType, user.UserType.GetDisplayName()));

                _authenticationManager.SignIn(new AuthenticationProperties {
                    IsPersistent = message.RememberMe
                }, identity);

                return(identity);
            }

            return(null);
        }
Example #28
0
        private void ShowLogOn()
        {
            var logon = new LogOn(_userName, _pass);

            logon.Attempts = _attempts;
            bool?res = logon.ShowDialog();

            if (!res ?? true)
            {
                Shutdown(1);
            }
            else
            {
                IDbManager       dbManager = ObjectPool.Instance.Resolve <IDbManager>();
                IDataCommand     db        = dbManager.GetDatabase(ApplicationSettings.Instance.Database.DefaultConnection.Name);
                List <UserModel> result    = db.Query <UserModel>("GetUser", new { Username = logon.UserName, Password = logon.Password });
                if (result.Any())
                {
                    string[] accessLevel;
                    switch (result[0].Type)
                    {
                    case 100:
                        accessLevel = new string[] {
                            AccessLevel.CAN_VIEW_ORDER
                        };
                        break;

                    case 900:
                        accessLevel = new string[] {
                            AccessLevel.CAN_VIEW_ORDER,
                            AccessLevel.CAN_VIEW_MASTER,
                            AccessLevel.CAN_VIEW_REPORT,
                            AccessLevel.CAN_VIEW_STOCK
                        };
                        break;

                    default:
                        accessLevel = new string[] {
                        };
                        break;
                    }
                    ObjectPool.Instance.Register <UserModel>().ImplementedBy(result[0]);
                    db.Close();
                    AuthorizationProvider.Initialize <DefaultAuthorizationProvider>(accessLevel);
                    Current.MainWindow = new MainWindow();
                    Current.MainWindow.Show();
                }
                else
                {
                    if (logon.Attempts > 2)
                    {
                        MessageBox.Show("Application is exiting due to invalid credentials", "Application Exit", MessageBoxButton.OK, MessageBoxImage.Error);
                        Shutdown(1);
                    }
                    else
                    {
                        _attempts += 1;
                        _userName  = logon.UserName;
                        _pass      = logon.Password;
                        ShowLogOn();
                    }
                }
            }
        }
Example #29
0
        public async Task Login(string token, string operatingSystem, string ipAddress, string nameVersionClient)
        {
            var jwtAuthProviderReader = (JwtAuthProviderReader)AuthenticateService.GetAuthProvider("jwt");

            try
            {
                var jwtPayload = jwtAuthProviderReader.GetVerifiedJwtPayload(new BasicHttpRequest(), token.Split('.'));
                await Groups.AddToGroupAsync(this.Context.ConnectionId, _loginedGroup);

                Context.Items["login"]   = jwtPayload["name"];
                Context.Items["uid"]     = jwtPayload["sub"];
                Context.Items["session"] = jwtPayload["session"];

                var user = await _ravenSession.LoadAsync <User>(jwtPayload["sub"]);

                if (user != null)
                {
                    Context.Items["nickname"] = user.DisplayName;
                }

                var logOn = new LogOn
                {
                    Id        = jwtPayload["sub"],
                    UserLogin = jwtPayload["name"],
                };
                if (long.TryParse(jwtPayload["exp"], out long expire))
                {
                    logOn.ExpireTime = DateTimeOffset.FromUnixTimeSeconds(expire);
                    if (logOn.ExpireTime < DateTimeOffset.UtcNow)
                    {
                        throw new TokenException("Token is expired");
                    }
                }

                await Clients.Caller.SendAsync(logOn);

                var userLoginAudit = await _ravenSession.LoadAsync <LoginAudit>(jwtPayload["sub"] + "/LoginAudit");

                if (userLoginAudit != null)
                {
                    if (jwtPayload["session"] != userLoginAudit.SessionId)
                    {
                        userLoginAudit.NameVersionClient = nameVersionClient;
                        userLoginAudit.OperatingSystem   = operatingSystem;
                        userLoginAudit.IpAddress         = ipAddress;
                        userLoginAudit.DateOfEntry       = DateTime.Now;
                        userLoginAudit.SessionId         = jwtPayload["session"];

                        await _ravenSession.StoreAsync(userLoginAudit);

                        await _ravenSession.SaveChangesAsync();
                    }
                }
                else
                {
                    userLoginAudit = new LoginAudit
                    {
                        Id = jwtPayload["sub"] + "/LoginAudit",
                        OperatingSystem   = operatingSystem,
                        DateOfEntry       = DateTime.Now,
                        IpAddress         = ipAddress,
                        NameVersionClient = nameVersionClient,
                        SessionId         = jwtPayload["session"]
                    };
                    await _ravenSession.StoreAsync(userLoginAudit);

                    await _ravenSession.SaveChangesAsync();
                }
                Log.Information($"Connected {Context.Items["login"]}({Context.Items["uid"]}) with session {Context.Items["session"]}");
            }
            catch (Exception e)
            {
                await Clients.Caller.SendAsync(new LogOn
                {
                    Error = true
                });

                Log.Warning($"Bad token from connection {Context.ConnectionId}");
            }
        }
Example #30
0
 /// <summary>
 /// Function to assign rules of rule engine.
 /// </summary>
 /// <param name="logOn">The log configuration.</param>
 private static void AssignRules(LogOn logOn)
 {
     RuleEngine.AssignLoginRule(logOn);
 }
Example #31
0
        static void Main(string[] args)
        {
            var kernel           = new StandardKernel(new DbInject());
            var repsitoryCard    = kernel.Get <IRepository <Card> >();
            var repsitoryColumn  = kernel.Get <IRepository <Column> >();
            var repsitoryBoard   = kernel.Get <IRepository <Board> >();
            var repsitoryUser    = kernel.Get <IRepository <User> >();
            var repsitoryTeam    = kernel.Get <IRepository <Team> >();
            var repsitoryAttach  = kernel.Get <IRepository <Attachment> >();
            var repsitoryProfile = kernel.Get <IRepository <Profile> >();


            AttachmentService attachmentService = new AttachmentService(repsitoryAttach, repsitoryCard);
            BoardService      boardtService     = new BoardService(repsitoryBoard, repsitoryTeam);
            CardService       cardService       = new CardService(repsitoryCard, repsitoryColumn);
            ColumnsService    columnsService    = new ColumnsService(repsitoryBoard, repsitoryColumn);
            LogOn             logOn             = new LogOn(repsitoryUser);
            ProfileService    profileService    = new ProfileService(repsitoryProfile);
            TeamService       teamService       = new TeamService(repsitoryTeam, repsitoryUser);
            UserService       userService       = new UserService(repsitoryUser);

            try
            {
                ServiceHost attachHost = new ServiceHost(attachmentService);
                attachHost.Open();
                Console.WriteLine("Attachment Service started successfully!");

                ServiceHost boardHost = new ServiceHost(boardtService);
                boardHost.Open();
                Console.WriteLine("Board Service started successfully!");

                ServiceHost cardHost = new ServiceHost(cardService);
                cardHost.Open();
                Console.WriteLine("Card Service started successfully!");

                ServiceHost columnHost = new ServiceHost(columnsService);
                columnHost.Open();
                Console.WriteLine("Column Service started successfully!");

                ServiceHost logOnHost = new ServiceHost(logOn);
                logOnHost.Open();
                Console.WriteLine("LogON Service started successfully!");

                ServiceHost profileHost = new ServiceHost(profileService);
                profileHost.Open();
                Console.WriteLine("Profile Service started successfully!");

                ServiceHost teamHost = new ServiceHost(teamService);
                teamHost.Open();
                Console.WriteLine("Team Service started successfully!");

                ServiceHost userHost = new ServiceHost(userService);
                userHost.Open();

                Console.WriteLine("User Service started successfully!");

                Console.ReadLine();
                Console.ReadLine();
            }
            catch (Exception ex)
            {
                Console.WriteLine("Oops!!!!!!!!");
                Console.WriteLine(ex.Message);
            }
        }
Example #32
0
        private string CutomerName_LogOn(LogOn logon)
        {
            var result = from b in av.customer where logon.E_Mail == b.E_mail select b.Cust_Nme;

            return(result.First().ToString());
        }
Example #33
0
 /// <summary>
 /// Initializes a new instance of the <see cref="LogOnRules"/> class.
 /// </summary>
 /// <param name="logOn">The logOn.</param>
 public LogOnRules(LogOn logOn)
 {
     this.logOn = logOn;
 }
Example #34
0
        public HttpResponseMessage LogOn(LogOn logOn)
        {
            int ret = repository.LogOn(logOn.PwType, logOn.username, logOn.password, logOn.role);

            return(new ExceptionHandler().LogOn(ret));
        }
Example #35
0
 /// <summary>
 /// Applies the logOn rule.
 /// </summary>
 /// <param name="logOn">The logOn.</param>
 /// <returns>
 /// Validation errors
 /// </returns>
 private static Dictionary<string, string> ApplyLoginRule(LogOn logOn)
 {
     var loginRules = new LogOnRules(logOn);
     return loginRules.Apply();
 }
Example #36
0
 /// <summary>
 /// Handles the Load event of the Page control.
 /// </summary>
 /// <param name="sender">The source of the event.</param>
 /// <param name="e">The <see cref="System.EventArgs"/> instance containing the event data.</param>
 protected void Page_Load(object sender, EventArgs e)
 {
     LogOn.Focus();
     LogOn.Authenticate += new AuthenticateEventHandler(LogOn_Authenticate);
 }