public ActionResult <dynamic> Registration(UserCache cache) { string message = string.Empty; User user = authentication.Auth(cache, ref message); if (user != null) { return new { success = true, data = UserResponse(user) } } ; return(Return500Error(message)); }
public void Auth() { DeleteUser(); UserCache cache = new UserCache(); cache.user_login = UserLogin; cache.user_password = UserPassword; User success = authentication.Auth(cache, ref message); User unsuccess = authentication.Auth(cache, ref message); Assert.AreEqual(success.UserLogin, UserLogin); Assert.AreEqual(unsuccess, null); }
private void buttonConnexion_Click(object sender, EventArgs e) { Users user = new Users(TextBoxConnexionEmail.Text, TextBoxConnexionPassword.Text); Authentication auth = new Authentication(); Users utilisateur; try { utilisateur = auth.Auth(user); Console.WriteLine("Nom : {0}", utilisateur.nom); Console.WriteLine("Mail : {0}", utilisateur.mail); switch (utilisateur.reference_groupe) { case 1: Console.WriteLine("Parent"); break; case 2: Console.WriteLine("Prof"); break; case 3: Console.WriteLine("Administrateur"); break; } } catch (NullReferenceException NullExp) { MessageBox.Show("Veuillez vérifier votre mail ou mot de passe!"); Console.WriteLine("UserControlConnexion :: buttonConnexion_Click :: {0}", NullExp.StackTrace); } }
public void TestMethod1() { //registration = new Registration(); authentication = new Authentication(); //Assert.AreEqual(registration.Registr(), true); Assert.AreEqual(authentication.Auth(), true); }
static void Main(string[] args) { authentication = new Authentication(); //registration = new Registration(); authentication.Auth(); //registration.Registr(); }
public ReturnAllServices DeleteCustomer(int id) { ReturnAllServices ret = new ReturnAllServices(); try { _authenticationService.Auth(); new CustomerModel().DeleteCustomer(id); ret.Result = true; ret.ErrorMessage = string.Empty; } catch (Exception e) { ret.Result = false; ret.ErrorMessage = "Error while trying to delete a customer: " + e.Message; } return(ret); }
static void Main(string[] args) { /*Authentication auth = new Authentication(); * var authResult = auth.Auth().Result; * return;*/ if (!startupConfig.Instance.init(args)) { return; } /*try * { * OpenTL.Example example = new OpenTL.Example(); * string a = ""; * while (a != "exit") * { * Thread.Sleep(30000); * } * } * catch (Exception) * { * * throw; * } */ //Example ex = new Example(); var config = Configs.Instance; Authentication auth = new Authentication(); try { bool authProcess = auth.Auth().Result; Thread thr; if (auth.IsAuthenticated) { Forwarder.Instance.SetAuth(auth); Receiver.Instance.SetAuth(auth); //receiver.Init(); Receiver.Instance.Run(); /*thr = new Thread(receiver.Run); * thr.Start();*/ } else { log.Error("Not Authenticated "); return; } string a = ""; while (a != "exit") { Thread.Sleep(30000); } } catch (Exception) { throw; } }