private void LoginBtn_Clicked(object sender, EventArgs e) { using (var sq = new Persistence.SQLiteDb()) { if (EmailEntry.Text == "nuke" && PasswordEntry.Text == "nuke") { sq.Nuke(); } else { var authdUser = sq.GetUserByEmail(EmailEntry.Text); authdUser = authdUser ?? sq.GetUserByUsername(EmailEntry.Text); if (authdUser != null) { if (authdUser.Password.Equals(PasswordEntry.Text)) { Navigation.PushAsync(new HomePage(authdUser)); } else // wrong password { DisplayAlert("", "Username or password is invalid", "Okay"); } } else // user not found by email nor username { DisplayAlert("", "Username or password is invalid", "Okay"); } } } PasswordEntry.Text = ""; }
public void Nuke() { var db = new SQLiteDb(); _DbConnection.DropTable <User>(); _DbConnection.DropTable <UserUser>(); _DbConnection.DropTable <Group>(); _DbConnection.DropTable <GroupUser>(); _DbConnection.DropTable <AudioRecord>(); _DbConnection.DropTable <GroupAudioRecord>(); db = new SQLiteDb(); db.CreateUser(new User() { ID = _DbConnection.Table <User>().Count() + 1, Username = "******", Email = "*****@*****.**", FirstName = "Christian", LastName = "Moore", PhoneNumber = "12345678910", Password = "******", }); db.CreateUser(new User() { ID = _DbConnection.Table <User>().Count() + 1, Username = "******", Email = "*****@*****.**", FirstName = "Kent", LastName = "Stringer", PhoneNumber = "12345678910", Password = "******", }); db.CreateUser(new User() { ID = _DbConnection.Table <User>().Count() + 1, Username = "******", Email = "*****@*****.**", FirstName = "Dylan", LastName = "Shoupe", PhoneNumber = "12345678910", Password = "******", }); db.CreateUser(new User() { ID = _DbConnection.Table <User>().Count() + 1, Username = "******", Email = "*****@*****.**", FirstName = "Kyle", LastName = "Murphy", PhoneNumber = "12345678910", Password = "******", }); }