Example #1
0
        private static bool RegisterApp(UserRegistrationModel UserRegistration)
        {
            // Connects to SUP Context
            if (!App.CurrentSUPContext.IsAppRegistered)
            {
                if (!InternetConnection.IsOnline)
                    throw new Exception("Debe tener conexión de internet para registrar la aplicación por primera y única vez.");

                App.CurrentSUPContext.RegisterApp(UserRegistration.Username, UserRegistration.Password, UserRegistration.ActivationCode);
                SaveActivationCode(UserRegistration);
            }
            else
            {
                RestoreActivationCode(UserRegistration);
            }
            return true;
        }
Example #2
0
 public static void RestoreActivationCode(UserRegistrationModel UserRegistration)
 {
     UserRegistration.ActivationCode = EncryptionHelper.Decrypt(App.AppSettings.ActivationCode);
 }
Example #3
0
 private static void SaveActivationCode(UserRegistrationModel UserRegistration)
 {
     // Saves the Activation code for the next time
     App.AppSettings.ActivationCode = EncryptionHelper.Encrypt(UserRegistration.ActivationCode);
     App.AppSettings.Save();
 }
Example #4
0
        private static void checkAgainstSavedCredentials(UserRegistrationModel UserRegistration)
        {
            string username = EncryptionHelper.Decrypt(App.AppSettings.Username);
            string password = EncryptionHelper.Decrypt(App.AppSettings.Password);

            if (username != UserRegistration.Username || password != UserRegistration.Password)
            {
                 throw new Exception("No se pudo iniciar sesión sin conexión. Verifique su usuario y/o contraseña.");
            }
        }
Example #5
0
 private static void SaveCredentials(UserRegistrationModel UserRegistration)
 {
     App.AppSettings.Username = EncryptionHelper.Encrypt(UserRegistration.Username);
     App.AppSettings.Password = EncryptionHelper.Encrypt(UserRegistration.Password);
     App.AppSettings.Save();
 }