internal void validateAUsersEmailUsingAValidationEmaill(string username, string token) { //http string string http = ProtocolModel.http.ToString(); //use what internet protocol for validating the token string protocol = http; string subject = "Please, verifiëer uw email"; //link to verify email to change the is_email_verified boolean record RestApiModel server = DataModel.getConfigModel().server; string https = ProtocolModel.https.ToString(); //https string if (server.UseHttps) { protocol = https; } //construct url to api string body = protocol + "://" + server.hostName + ":" + server.portNumber + "/api/User/validateToken?token=" + token; //make a copy of the field string toEmailAddress = email; //send an validation email mailUtilities.sendEmailToAdressWithABodyAndSubjectUsingCredentialsInDataModel(toEmailAddress, username, subject, body); }
/// <summary> /// Carga los nodos de contexto /// </summary> private void LoadContextNodes() { RestApiModel restApi = GetRestParent(); // Carga los nodos if (restApi != null) { foreach (ContextModel context in restApi.Contexts) { Children.Add(new NodeRestViewModel(TreeViewModel as TreeRestApiViewModel, this, context.Name, TreeRestApiViewModel.NodeType.Context, context, false)); } } }
/// <summary> /// Carga los nodos de métods /// </summary> private void LoadMethodNodes() { RestApiModel restApi = GetRestParent(); // Carga los nodos if (restApi != null) { foreach (MethodModel method in restApi.Methods) { Children.Add(new NodeRestViewModel(TreeViewModel as TreeRestApiViewModel, this, method.Name, TreeRestApiViewModel.NodeType.Method, method, false)); } } }
public RestApiViewModel(RestStudioViewModel mainViewModel, RestApiModel rest) { // Inicializa las propiedades MainViewModel = mainViewModel; if (rest == null) { Rest = new RestApiModel(); } else { Rest = rest; } // Inicializa el ViewModel InitViewModel(); }
/** * @author Anthony Scheeres */ private void validateAUsersEmailUsingAValidationEmaill(string toEmailAddress, string username, string token) { MailUtilities mailUtilities = new MailUtilities(); string protocol = ProtocolModel.http.ToString(); string subject = "Please, verifiëer uw email"; //link to verify email to change the is_email_verified boolean record RestApiModel server = DataModel.getConfigModel().server; if (server.UseHttps) { protocol = ProtocolModel.https.ToString(); } string body = "http://" + server.hostName + ":" + server.portNumber + "/api/User/validateToken?token=" + token; mailUtilities.sendEmailToAdressWithABodyAndSubjectUsingCredentialsInDataModel(toEmailAddress, username, subject, body); }
/// <summary> /// Modifica un nodo de método /// </summary> private void UpdateMethod(NodeRestViewModel node) { RestApiModel restApi = node?.GetRestParent(); if (restApi == null) { MainViewModel.RestStudioController.HostController.SystemController.ShowMessage("Seleccione un nodo de API para añadirle un método"); } else { Solution.MethodViewModel viewModel = null; bool isNew = true; // Obtiene el modelo if (node != null && node.Tag is MethodModel method) { viewModel = new Solution.MethodViewModel(MainViewModel, method); isNew = false; } else { viewModel = new Solution.MethodViewModel(MainViewModel, null); } // Abre la ventana if (MainViewModel.RestStudioController.OpenDialog(viewModel) == BauMvvm.ViewModels.Controllers.SystemControllerEnums.ResultType.Yes) { // Si es nuevo, se añade a la colección if (isNew) { restApi.Methods.Add(viewModel.Method); } // Graba y actualiza Save(); } } }
/// <summary> /// Carga los datos de una solución /// </summary> internal RestSolutionModel Load(string fileName) { RestSolutionModel solution = new RestSolutionModel(); MLFile fileML = new LibMarkupLanguage.Services.XML.XMLParser().Load(fileName); // Carga los datos if (fileML != null) { foreach (MLNode rootML in fileML.Nodes) { if (rootML.Name == TagRoot) { foreach (MLNode nodeML in rootML.Nodes) { if (nodeML.Name == TagApi) { RestApiModel restApi = new RestApiModel(); // Asigna las propiedades restApi.Name = nodeML.Nodes[TagName].Value.TrimIgnoreNull(); restApi.Description = nodeML.Nodes[TagDescription].Value.TrimIgnoreNull(); // Añade las cabeceras predeterminadas LoadHeaders(nodeML, TagDefaultHeaders, restApi.DefaultHeaders); // Carga los contextos y métodos restApi.Contexts.AddRange(LoadContexts(nodeML)); restApi.Methods.AddRange(LoadMethods(nodeML)); // Añade la api a la colección solution.RestApis.Add(restApi); } } } } } // Devuelve la solución return(solution); }