public IdSession Login(LoginPassword loginPassword) { string getUser = $"select * from Users where email = '{loginPassword.Email}'"; User loginUser = dbr.GetFirstOrDefault <User>(getUser); if (loginUser == null) { return(null); } string getPassword = $"select password from Passwords where ownerId = {loginUser.Id}"; string dbSavedPasswordHash = dbr.GetFirstOrDefault <string>(getPassword); if (String.IsNullOrEmpty(dbSavedPasswordHash)) { return(null); } if (sHelper.CheckIfPasswordMatches(dbSavedPasswordHash, loginPassword.Password, 20)) { Guid sessionGuid = sHelper.CreateLoginSession(loginUser.Id); IdSession sessionDetails = new IdSession { OwnerId = loginUser.Id, SessionGuid = sessionGuid }; return(sessionDetails); } else { return(null); } }
// Login in public void LogIn() { LoginButton.Click(); LoginName.SendKeys("guy"); LoginPassword.SendKeys("guy12345"); LoginSubmitButton.Click(); }
public UserInfo Login(LoginPassword input) { var info = _userLoginInfoRepository[input.Login]; if (info == null) { return(null); } //check password byte[] salt = info.Salt; // derive a 256-bit subkey (use HMACSHA1 with 10,000 iterations) string hashed = Convert.ToBase64String(KeyDerivation.Pbkdf2( password: input.Password, salt: salt, prf: KeyDerivationPrf.HMACSHA1, iterationCount: 10000, numBytesRequested: 256 / 8)); if (hashed != info.HashedPassword) { throw new Exception("Пароль не верен"); } return(new UserInfo() { Login = info.Login, Role = info.Role }); }
void ReleaseDesignerOutlets() { if (CancelBtn != null) { CancelBtn.Dispose(); CancelBtn = null; } if (LoginBtn != null) { LoginBtn.Dispose(); LoginBtn = null; } if (LoginEmail != null) { LoginEmail.Dispose(); LoginEmail = null; } if (LoginPassword != null) { LoginPassword.Dispose(); LoginPassword = null; } if (SignupBtn != null) { SignupBtn.Dispose(); SignupBtn = null; } }
public IEnumerator CallLogin(string User, string Pass) { WWW www = new WWW("http://mmahgoub-001-site1.htempurl.com/WebService.asmx/LogInXml?Username="******"&Password="******"Customer"); string userid = node [0].ChildNodes.Item(0).InnerText.Trim(); print("id is " + userid); if (int.Parse(userid) != 0) { PlayerPrefs.SetString("UserID", userid); PlayerPrefs.SetString("UserName", User); PlayerPrefs.SetString("UserPassword", Pass); SceneManager.LoadScene("Level01"); } else { LoginUserName.GetComponent <InputField>().text = ""; LoginPassword.GetComponent <InputField>().text = ""; StartCoroutine(InvalidInput(InvalidLogin)); } } catch (XmlException e) { print(e.Message); } }
// // LOGIN: // public void LoginCommandCanExecute() { User user = Fitness.Logic.Data.FitnessC.GetUserByUserEmail(LoginEmail); if (user != null) { if (LoginPassword == null) { MessageBox.Show("Please fill the password field."); return; } string hashedstrpassword = LoginPassword.GetHashCode().ToString(); if (user.Password.Equals(hashedstrpassword) /* TODO: Andi */) { LoggedInUser = user; LoginCommandExecute(); } else { MessageBox.Show("Wrong password!"); } } else { MessageBox.Show("Wrong email!"); } }
public void CreateUser([FromBody] UserCreate input) { var loginPassword = new LoginPassword() { Login = input.Login, Password = input.Password }; if (input.UserType == UserType.Integrator) { _accountService.RegisterIntegrator(loginPassword, input.UserGroupId); } else { _accountService.RegisterUser(loginPassword, input.UserGroupId); } _userRepository.Create(new User() { Login = input.Login, UserGroupId = input.UserGroupId, UserType = input.UserType, FIO = input.FIO, Info = input.Info }); _userRepository.SaveChanges(); }
public void PostUser([FromBody] UserCreate input) { var children = GetChildrenUserGroups(); if (!children.Contains(input.UserGroupId)) { throw new Exception("Эта группа пользователей вам не доступна"); } var loginPassword = new LoginPassword() { Login = input.Login, Password = input.Password }; if (input.UserType == UserType.Integrator) { _accountService.RegisterIntegrator(loginPassword, input.UserGroupId); } else { _accountService.RegisterUser(loginPassword, input.UserGroupId); } _userRepository.Create(new User() { Login = input.Login, FIO = input.FIO, Info = input.Info, UserGroupId = input.UserGroupId, UserType = input.UserType, }); _userRepository.SaveChanges(); }
public void TrimData() { if (Name == null) { Name = ""; } if (EmailId == null) { EmailId = ""; } if (EncryptedEmailId == null) { EncryptedEmailId = ""; } if (MobileNo == null) { MobileNo = ""; } if (EncryptedMobileNo == null) { EncryptedMobileNo = ""; } if (LoginPassword == null) { LoginPassword = ""; } if (EncryptedLoginPassword == null) { EncryptedLoginPassword = ""; } if (PasswordResetToken == null) { PasswordResetToken = ""; } if (Remarks == null) { Remarks = ""; } Name = Name.Trim(); EmailId = EmailId.Trim(); EncryptedEmailId = EncryptedEmailId.Trim(); MobileNo = MobileNo.Trim(); EncryptedMobileNo = EncryptedMobileNo.Trim(); LoginPassword = LoginPassword.Trim(); EncryptedLoginPassword = EncryptedLoginPassword.Trim(); PasswordResetToken = PasswordResetToken.Trim(); Remarks = Remarks.Trim(); }
public string Post([FromBody] string value) { LoginPassword loginPassword = JsonConvert.DeserializeObject <LoginPassword>(value); ILoginHelper ilHelper = new LoginHelper(); return(JsonConvert.SerializeObject(ilHelper.Login(loginPassword))); }
public async Task <IActionResult> Login([FromBody] LoginPassword loginForm) { DTO.Service.Token token; string userId; try { token = await authorization.Login(loginForm.Login, loginForm.Password); userId = userService.GetId(loginForm.Login); } catch (ApiException exp) { return(StatusCode( exp.GetStatusCode(), Error.CreateBuilder().SetErrorMessage(exp.GetErrorMessage()).Build() )); } catch { return(BadRequest()); } return(Ok(new { tokens = Token.CreateBuilder() .SetAccessToken(token.AccessToken) .SetRefreshToken(token.RefreshToken) .Build(), userId }) ); }
private bool CheckInputValidationForLogin(string PopServer, string PopPort, string LoginUserName, string LoingPassword) { if (PopServer.Equals("")) { MessageBox.Show(this, "You must provide pop server address.", "Email Client", MessageBoxButtons.OK, MessageBoxIcon.Information); return(false); } else if (PopPort.Equals("")) { MessageBox.Show(this, "You must provide pop port number.", "Email Client", MessageBoxButtons.OK, MessageBoxIcon.Information); return(false); } else if (LoginUserName.Equals("")) { MessageBox.Show(this, "You must provide username(Email).", "Email Client", MessageBoxButtons.OK, MessageBoxIcon.Information); return(false); } else if (LoginPassword.Equals("")) { MessageBox.Show(this, "You must provide password.", "Email Client", MessageBoxButtons.OK, MessageBoxIcon.Information); return(false); } return(true); }
async Task CallLogin(bool createAccount) { _sendingLogin = true; CommandManager.InvalidateRequerySuggested(); var result = await ParentViewModel.Game.Client.Login(LoginName, LoginPassword.ConvertToUnsecureString(), createAccount); _sendingLogin = false; if (result == LoginCheckResult.LoginOK) { IsLoggingIn = false; _gameListUpdateTimer.Change(0, System.Threading.Timeout.Infinite); } else if (result == LoginCheckResult.AccountDisabled) { if (createAccount) { MessageBox.Show("Account was requested.\r\nPlease wait until the administrator unlocks the account."); } else { MessageBox.Show("Account is disabled.\r\nPlease wait until the administrator unlocks the account."); } } else if (result == LoginCheckResult.CreateAccountDenied) { MessageBox.Show("Create account denied!"); _canCreateAccount = false; } CommandManager.InvalidateRequerySuggested(); // TODO: We must check if the server is still connected. There is currently no feedback. This must be done directly on the socket. }
private void Login_Click(object sender, EventArgs e) { User = new Profile(); string folderName = System.IO.Directory.GetCurrentDirectory(); string subFolder1 = LoginName.Text + LoginPassword.Text; string pathString = System.IO.Path.Combine(folderName, subFolder1); string fileName = LoginName.Text + ".txt"; string newPathString = System.IO.Path.Combine(pathString, fileName); if (System.IO.Directory.Exists(pathString)) { using (StreamReader reader = new StreamReader(newPathString)) { User.ProfileName = reader.ReadLine(); User.Password = reader.ReadLine(); User.UserName = reader.ReadLine(); } MyApp.SelectedIndex = 3; LoginName.Clear(); LoginPassword.Clear(); } else { DialogResult result = MessageBox.Show("This Account Does Not Exist, Do You Wish To Signup?", "Login error", MessageBoxButtons.YesNo, MessageBoxIcon.Error); if (result == DialogResult.Yes) { MyApp.SelectedIndex = 2; } LoginName.Clear(); LoginPassword.Clear(); } }
public void Register(LoginPassword input, string role) { byte[] salt = new byte[128 / 8]; using (var rng = RandomNumberGenerator.Create()) { rng.GetBytes(salt); } // derive a 256-bit subkey (use HMACSHA1 with 10,000 iterations) string hashed = Convert.ToBase64String(KeyDerivation.Pbkdf2( password: input.Password, salt: salt, prf: KeyDerivationPrf.HMACSHA1, iterationCount: 10000, numBytesRequested: 256 / 8)); _userLoginInfoRepository.Add(new UserLoginInfo() { Login = input.Login, HashedPassword = hashed, //get hashed password Salt = salt, //get salt Role = role }); _userLoginInfoRepository.SaveChanges(); }
public /*HomePage*/ LoginPage AuthorizationPage(LoginPassword user) { NameInput.SendKeys(user.selectLogin); PasswordInput.SendKeys(user.selectPassword); //new Actions(driver).SendKeys(Keys.Enter).Build().Perform(); //return new HomePage(driver); return(this); }
private void ResetErrors(object sender, TappedRoutedEventArgs e) { LoginMail.Header = ResourceLoader.GetString("LoginMail/Header"); LoginMail.ClearValue(BorderBrushProperty); LoginPassword.Header = ResourceLoader.GetString("LoginPassword/Header"); LoginPassword.ClearValue(BorderBrushProperty); }
public Demo2 LoginAs(String user, String passwd) { LoginUsername.SendKeys(user); LoginPassword.SendKeys(passwd); LoginBtn.Click(); return(new Demo2(_driver)); }
public Login() { InitializeComponent(); LoginViewModel = App.Current.Services.GetService <LoginViewModel>(); DataContext = LoginViewModel; ResourceLoader = ResourceLoader.GetForCurrentView(); LoginMail.AddHandler(TappedEvent, new TappedEventHandler(ResetErrors), true); LoginPassword.AddHandler(TappedEvent, new TappedEventHandler(ResetErrors), true); }
public void ValidLogin() { LoginPassword loginPassword = new LoginPassword { Email = "*****@*****.**", Password = "******" }; Assert.AreEqual(9, loginHelper.Login(loginPassword)); }
public void InValidPassword() { LoginPassword loginPassword = new LoginPassword { Email = "*****@*****.**", Password = "******" }; Assert.AreEqual(0, loginHelper.Login(loginPassword)); }
void ReleaseDesignerOutlets() { if (button_next != null) { button_next.Dispose(); button_next = null; } if (EmailBar != null) { EmailBar.Dispose(); EmailBar = null; } if (LoginBackButton != null) { LoginBackButton.Dispose(); LoginBackButton = null; } if (LoginButton != null) { LoginButton.Dispose(); LoginButton = null; } if (LoginEmail != null) { LoginEmail.Dispose(); LoginEmail = null; } if (LoginHelpButton != null) { LoginHelpButton.Dispose(); LoginHelpButton = null; } if (LoginPassword != null) { LoginPassword.Dispose(); LoginPassword = null; } if (PasswordBar != null) { PasswordBar.Dispose(); PasswordBar = null; } }
private bool CheckFields() { if (LoginEmail.Text.Trim() == "") { checkFormMessage = Resource.String.LoginEmailEmpty; LoginEmail.RequestFocus(); return(false); } if (LoginPassword.Text.Trim().Length < 6) { checkFormMessage = Resource.String.LoginPasswordShort; LoginPassword.RequestFocus(); return(false); } return(true); }
public void ValidationLogin() { LoginNameText = LoginUserName.GetComponent <InputField> ().text; LoginPassText = LoginPassword.GetComponent <InputField> ().text; if (LoginNameText != "" && LoginPassText != "") { StartCoroutine(CallLogin(LoginNameText, LoginPassText)); } else { LoginUserName.GetComponent <InputField>().text = ""; LoginPassword.GetComponent <InputField>().text = ""; StartCoroutine(InvalidInput(InvalidLogin)); } }
private void buttonusuario_Click(object sender, EventArgs e) { try { buttonusuario.Enabled = false; _usuario = LoginUsuario.Text; string sql = "SELECT NOMBRE,APELLIDOS,SUCURSAL,IMAG FROM VISTA1 WHERE ACTIVO=1 AND USUARIO=@USUARIO"; db.PreparedSQL(sql); db.command.Parameters.AddWithValue("@USUARIO", LoginUsuario.Text); res = db.getTable(); if (res.Next()) { labelnombre.Text = res.Get("NOMBRE") + " " + res.Get("APELLIDOS"); labelsucursal.Text = res.Get("SUCURSAL"); byte[] imagen = (!string.IsNullOrEmpty(res.Get("IMAG"))) ? Convert.FromBase64String(res.Get("IMAG")) : null; pictureBox1.Image = (imagen != null) ? Image.Bytes_A_Imagen((byte[])imagen) : null; pictureBox1.SizeMode = PictureBoxSizeMode.StretchImage; groupBoxusuario.Visible = false; groupBoxingresar.Visible = true; this.Width = 450; this.Height = 385; ValidateUser(); LoginPassword.Focus(); buttonusuario.Enabled = true; } else { buttonusuario.Enabled = true; error.Visible = true; error.Text = "Usuario incorrecto"; } this.CenterToScreen(); } catch (Exception err) { internet = false; string error = err.Message; MessageBox.Show("Ocurrio un Error, intente de nuevo."); string funcion = "ingresar"; Utilerias.LOG.write(_clase, funcion, error); } }
public Token RegisterAdmin(LoginPassword input) { _loginService.Register(input, Constants.RoleNames.Admin); var claims = new List <Claim> { new Claim(ClaimsIdentity.DefaultNameClaimType, input.Login), new Claim(ClaimsIdentity.DefaultRoleClaimType, Constants.RoleNames.Admin) }; var claimsIdentity = new ClaimsIdentity(claims, "Token", ClaimsIdentity.DefaultNameClaimType, ClaimsIdentity.DefaultRoleClaimType); return(_tokenService.GetFullTokenAsync(claimsIdentity).Result); }
public Token RegisterIntegrator(LoginPassword input, long userGroupId) { _loginService.Register(input, Constants.RoleNames.Integrator); var claims = new List <Claim> { new Claim(ClaimsIdentity.DefaultNameClaimType, input.Login), new Claim(ClaimsIdentity.DefaultRoleClaimType, Constants.RoleNames.Integrator) }; claims.Add(new Claim(Constants.ClaimTypeNames.UserGroupId, userGroupId.ToString())); var claimsIdentity = new ClaimsIdentity(claims, "Token", ClaimsIdentity.DefaultNameClaimType, ClaimsIdentity.DefaultRoleClaimType); return(_tokenService.GetFullTokenAsync(claimsIdentity).Result); }
public Shell <bool> Login([FromBody] LoginPassword input) { if (CheckLogin()) { return(true); } uint userid = db.Get <uint>("SELECT userid FROM user where (login='******' and password='******');", out bool success, input.Login, input.Password); if (!success) { return(false); } var session = UserSession.Open(userid); Response.Cookies.Append("session", session.UIN.ToString()); return(true); }
public async Task <IActionResult> Register([FromBody] LoginPassword registerForm) { try { await authorization.Register(registerForm.Login, registerForm.Password); } catch (ApiException exp) { return(StatusCode( exp.GetStatusCode(), Error.CreateBuilder().SetErrorMessage(exp.GetErrorMessage()).Build() )); } catch { return(BadRequest()); } return(Ok()); }
public LoginPasswordViewModel() { loginpassword = this; ThisUser = UserViewModel.GetUser(); dataBase = PlannerDataBaseContext.GetPlannerBaseContext(); //loginPassword = new LoginPassword("Name", "Email", "Login"); LoginPasswords = new ObservableCollection <LoginPassword>(); foreach (LoginPassword lp in dataBase.LoginPasswords.Where(lp => lp.User.UserId == ThisUser.UserId).AsEnumerable()) { LoginPasswords.Add(lp); } LoginPassword = new LoginPassword(ThisUser); loginPasswords.Add(LoginPassword); dataBase.LoginPasswords.Add(LoginPassword); dataBase.SaveChanges(); }