Exemple #1
0
 public static void ChangePassword(string login, string newPass, Client client)
 {
     try
     {
         ContentFromAuthorizationServer content = new ContentFromAuthorizationServer("ChangePassword", "*", login, newPass);
         string sms = content.GetContent(content);
         client.client.Send(clientAuth.Say(sms));
     }
     catch (Exception e)
     {
         CrashReports.Add(e.Message, "AuthorizationServerCommand - ChangePassword");
     }
     Log.Add(login, "ChangePassword", "AuthorizationServerCommand - ChangePassword");
 }
Exemple #2
0
 public static void SignUP(string name, string login, string password, Client client)
 {
     try
     {
         ContentFromAuthorizationServer content = new ContentFromAuthorizationServer("SignUP", name, login, password);
         string sms = content.GetContent(content);
         client.client.Send(clientAuth.Say(sms));
     }
     catch (Exception e)
     {
         CrashReports.Add(e.Message, "AuthorizationServerCommand - SignUP");
     }
     Log.Add(login, "SignUP", "AuthorizationServerCommand - SignUP");
 }
Exemple #3
0
 public static void ForgotPassword(string login, string email, Client client)
 {
     try
     {
         ContentFromAuthorizationServer content = new ContentFromAuthorizationServer("ForgotPassword", "*", login, "*");
         string sms      = content.GetContent(content);
         string callback = clientAuth.Say(sms);
         client.client.Send(callback);
         content = content.SetContent(callback);
         SendToEmail.ForgotPassword(content.Password, email);
     }
     catch (Exception e)
     {
         CrashReports.Add(e.Message, "AuthorizationServerCommand - ForgotPassword");
     }
     Log.Add(login, "ForgotPassword", "AuthorizationServerCommand - ForgotPassword");
 }
Exemple #4
0
 public static void Authorization(string login, string password, Client client)
 {
     try
     {
         ContentFromAuthorizationServer content = new ContentFromAuthorizationServer("Authorization", "*", login, password);
         string sms      = content.GetContent(content);
         string callback = clientAuth.Say(sms);
         content = content.SetContent(callback);
         if (content.Name != "Not registred")
         {
             client.name = content.Name;
         }
         client.client.Send(callback);
     }
     catch (Exception e)
     {
         CrashReports.Add(e.Message, "AuthorizationServerCommand - Authorization");
     }
     Log.Add(login, "Authorization", "AuthorizationServerCommand - Authorization");
 }
 public string Say(string message)
 {
     try
     {
         StreamWriter streamWriter = new StreamWriter(networkStream);
         streamWriter.WriteLine(message);
         streamWriter.Flush();
         while (true)
         {
             string sms = Listen();
             if (sms != null && sms != "")
             {
                 return(sms);
             }
         }
     }
     catch (Exception e)
     {
         CrashReports.Add(e.Message, "AuthorizationClient - Say");
         return(null);
     }
 }
 public string Listen()
 {
     try
     {
         StreamReader streamReader = new StreamReader(networkStream);
         while (true)
         {
             if (networkStream.DataAvailable)
             {
                 var message = streamReader.ReadLine();
                 if (message != null && message != "")
                 {
                     return(message);
                 }
             }
         }
     }
     catch (Exception e)
     {
         CrashReports.Add(e.Message, "AuthorizationClient - Listen");
         return(null);
     }
 }