Understanding Internal path

To make the web application of the certificate process navigate and redirect between pages and application within the whole web page, I referred to one of the project that have been done by Shawn and discover a new structure of the application. Previously I have applied the basic yet tedious way to connect and link between application and application to the server using the feature addEntryPoint() of the WServer. By this method, redirect and hard code the url to the program is used to navigate between application, this is only a temporary solution because the program will only run on the specific port number that was hard coded into the program. So I try to learn the way of setting Internal path for the application. Setting a button to navigate using internal Path are vary easy but to add an application to the specific internal path is hard. It not as straight forward as redirect. I have decided to change the basic structure of all my application to a WContainerWidget and in the container there is void that holds the function. Then, these container widget is declared in a main application. These container is then stacked together using the WStackedWidget. To navigate between these container, internal path are set and a void function in the main application is used to control the navigation between these container using the feature of the stacked widget. with these structure, the navigation between container no longer require hard coding and multiple entry point on the server.

E-mail regular expression for validation

In the process of creating a new certificate, e-mail address is required from the user. The e-mail address entered by the user must be validate carefully before input the information to the certificate. All e-mail addresses have a standard regular expression (regex) which can be obtain from the web. The 1st email regex that i found is in the witty library in the WRegExpValidator class. That regex is   “[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,4}”  . It is a very weak regex that cannot filter e-mail addresses like “[email protected]” but it is able to filter email with invalid character like “k#($aackm@vfmk.$#“. The other reasons that this regex is very week is because it also filters out some valid e-mail addresses. E-mail addresses top-level domain are mostly three letter top-level domain, which will appear valid if validate with this regex, but some sponsored top-level domain which have character more than 4 like “.museum” will be filter out by this regex.  After experimenting on this, I search for the official regex of e-mail addresses and found RFC 5322. RFC5322 describes the syntax that valid email addresses must adhere to, but it is not fool-proved. By Implementing this regex e-mail addresses with top-level domain character more than 4 are not filtered out but it still cant filter “[email protected]“. From here I was able to find a regex that can filter the email with invalid top-level domain which is “[a-z0-9!#$%&'*+/=?^_{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_{|}~-]+)*@(?:a-z0-9?.)+([A-Z]{2}|com|org|net|edu|gov|mil|biz|info|mobi|name|aero|asia|jobs|museum)\b” but this regex needs to be update if a new top-level domain appears. It will be very troublesome to update this regex so I decided to implement the official RFC5322 regex.

adding period option to create certificate and renew certificate 

The previous model of the form to create or renew certificate require user to input the expiry date of the certificate. This is not user friendly because user have to calculate the period valid of the certificate on their own. So we need to add in a period option and at the same time remain the enter expiry date option. To add this to the form, I have decided to use the WComboBox to allow user to select the valid period. So when user select by period option the expiry date option will be hidden and disabled. and when the period combo box index is all 0, the expiry date option is enabled. This prevents the user to input same information in two different place. The calculation part of period option is almost the same as the expiry date option. To switch between two option, I used stacked widget and internal path method that i used in the main application.

 

This week I will be focusing on how to generate an email and sent to that email address.


0 Comments

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.