private void LogIn() { LogIn.Model.User user = new LogIn.Model.User(TextBox.Text, pasBox.Password); if (service.LogIn(user, knownUser, booking).Item1) { loginAsUser(service.LogIn(user, knownUser, booking).Item2); } else if (user.UserName.Equals("admin") && (user.UserPass).Equals("admin")) { service.toggleTaskManager(true); service.toggleControlPanel(true); service.toggleCMD(true); bw.CancelAsync(); startUser(); this.Hide(); System.Windows.Forms.Application.Exit(); } else if (service.validateUser(user.UserName, user.UserPass, libID) != null) { System.Windows.Forms.MessageBox.Show("You will have access later :)" + service.validateUser(user.UserName, user.UserPass, libID).UserBirth); //loginAsUser() } else { System.Windows.Forms.MessageBox.Show("Access denied"); } }
internal Tuple <bool, TimeSpan> LogIn(LogIn.Model.User userAtComputer, ServiceReference1.Credentials knownUser, LogIn.ServiceReference1.Booking booking) { TimeSpan time = new TimeSpan(0, 0, 0); if (knownUser != null) { if (isSameUser(userAtComputer, knownUser)) { return(Tuple.Create <bool, TimeSpan>(true, getTimeForLogIn(booking))); } } return(Tuple.Create <bool, TimeSpan>(false, time)); }
internal bool isSameUser(LogIn.Model.User userAtPC, ServiceReference1.Credentials theUser) { byte[] hashSalt = Convert.FromBase64String(theUser.ClientPass); return(validate(userAtPC.UserName, hashSalt, theUser.ClientID)); }