How to grant access to a page?
Hi guys,
here is my situation: i'm using a web interface (tpd3 and saveas html feature...no tp), i have an "home page" with two buttons which redirects the user to other two pages. I'd like to grant acces to these target pages just to authorized users.
I'm thinking of creating a popup page, to be shown on the homepgae button click, with a keypad to insert the password, if the password is correct i close the popup and show the target page. How can i do it?
Thanks
here is my situation: i'm using a web interface (tpd3 and saveas html feature...no tp), i have an "home page" with two buttons which redirects the user to other two pages. I'd like to grant acces to these target pages just to authorized users.
I'm thinking of creating a popup page, to be shown on the homepgae button click, with a keypad to insert the password, if the password is correct i close the popup and show the target page. How can i do it?
Thanks
0
Comments
you defined your webpanel in your DEFINE_DEVICE section right? Did you combine the two? this isnt necesarry, but it's just handy...
in your touchpanel design, you can make a button a "keypad button". If you do this, and the user presses that button, a keypad pops up. When a user enters a code, and presses enter, a string is sent back to your netlinx frame. Do it like this:
DATA_EVENT[dvWebpanel] { STRING: { IF(FIND_STRING(DATA.TEXT,'KEYP-',1)) { REMOVE_STRING(DATA.TEXT,'KEYP-',1) (* this is now the code the user entered *) cCode = DATA.TEXT } } }then you can test that code against your own code, and when it matches, make the page flip, otherwise, send a text back to the touchpanel telling the user he isnt granted...Hope this helps you out, i can give you some better example if you want
DATA_EVENT [dvAC_TPArray] { STRING: { if (length_string(data.text)) { stack_var nAC_Datadev for (nAC_Datadev = 1; nAC_Datadev <= length_array(dvAC_TPArray); nAC_Datadev ++) { if (data.device == dvAC_TPArray[nAC_Datadev]) { nAC_ActiveRoom = nAC_Datadev } } Select { Active (find_string(data.text, 'KPD=',1)): { remove_string (DATA.TEXT, 'KPD=', 1) cancel_wait 'ValidateWait' wait 40 'ValidateWait' { cAC_Pword = '' cAC_FakePword = '' send_command dvAC_TPArray[nAC_ActiveRoom],"'@TXT',120 ,cAC_FakePword" } select { ACTIVE (DATA.TEXT >= '0' && DATA.TEXT <= '9'): { cAC_Pword = "cAC_Pword, DATA.TEXT" cAC_FakePword = "cAC_FakePword, '*'" send_command dvAC_TPArray[nAC_ActiveRoom],"'@TXT',120 ,cAC_FakePword" } } } Active (find_string(data.text, 'KPT=',1)): { remove_string (DATA.TEXT, 'KPT=', 1) Select { ACTIVE (DATA.TEXT == 'Back'): { IF (cAC_Pword > '') { SET_LENGTH_STRING (cAC_Pword, LENGTH_STRING (cAC_Pword) - 1) SET_LENGTH_STRING (cAC_FakePword, LENGTH_STRING (cAC_FakePword) - 1) SEND_COMMAND dvAC_TPArray[nAC_ActiveRoom],"'@TXT',120 ,cAC_FakePword" } } ACTIVE (DATA.TEXT == 'Done'): { stack_var integer i local_var integer nPinUser cancel_wait 'ValidateWait' if (length_string (cAC_Pword) == 4) { for (i = 1; i <= length_array(cAC_SecPwordsArray); i ++) { if (cAC_Pword == cAC_SecPwordsArray[i]) { nPinUser = i i = length_array(cAC_SecPwordsArray)+ 1 } else { nPinUser = 0 } } if (nPinUser) { if (nAC_KProuter == 1) { AC_Room[nAC_ACtiveTP].AC_Secur = AC_Room[nAC_ActiveRoom].AC_Secur AC_Room[nAC_ACtiveTP].AC_Secur.AC_SecPword = cAC_Pword AC_Room[nAC_ACtiveTP].AC_Secur.AC_SecValidPword = 1 send_command dvAC_TPArray[nAC_ActiveRoom],"'@TXT',118,cAC_SecArmDisplayArray[AC_Room[nAC_ACtiveTP].AC_Secur.AC_SecState]" send_command dvAC_TPArray[nAC_ActiveRoom],"'@TXT',119,itoa(AC_Room[nAC_ACtiveTP].AC_Secur.AC_SecPartition)" call 'AC_SecurTimeSend' send_command dvAC_TPArray[nAC_ActiveRoom],"'@TXT',45,cAlarmRepeat_Array [AC_Room[nAC_ACtiveTP].AC_Secur.AC_Repeat]" if (timeline_active(TL_FB_Blink)) { timeline_kill(TL_FB_Blink) } off [dvAC_TPArray[nAC_ActiveRoom], 113] on [dvAC_TPArray[nAC_ActiveRoom], 119] send_command dvAC_TPArray[nAC_ActiveRoom],"'@TXT',117,''" send_command dvAC_TPArray[nAC_ActiveRoom],"'@TXT',116 ,'PIN verification successful ',cPIN_NamesArray[nPinUser],' !'" nAC_KProuter = 0 cAC_Pword = '' cAC_FakePword = '' wait 20 { send_command dvAC_TPArray[nAC_ActiveRoom],"'@TXT',116 ,''" send_command dvAC_TPArray[nAC_ActiveRoom],"'PPOF-_ACkeypad'" send_command dvAC_TPArray[nAC_ActiveRoom],"'PPOF-AC_ClosePage'" send_command dvAC_TPArray[nAC_ActiveRoom],"'PPOF-_ACkeypaddisplay'" send_command dvAC_TPArray[nAC_ActiveRoom],"'PPON-AC_SecurSelect'" if (!AC_Room[nAC_ActiveRoom].AC_Secur.AC_Set) { timeline_create (TL_AC_Response,TL_AC_ResponseRuntime,4,timeline_relative,timeline_once) } else { send_command dvAC_TPArray[nAC_ActiveRoom],"'@TXT',117,''" send_command dvAC_TPArray[nAC_ActiveRoom],"'@TXT',116 ,'Welcome back ',cPIN_NamesArray[nPinUser],' !'" wait 40 { send_command dvAC_TPArray[nAC_ActiveRoom],"'@TXT',116 ,''" } } } } else { AC_Room[nAC_ACtiveTP].AC_Secur.AC_SecValidPword = 1 AC_Room[nAC_ACtiveTP].AC_Secur.AC_SecPword = cAC_Pword send_command dvAC_TPArray[nAC_ActiveRoom],"'PPOF-_ACkeypad'" if (timeline_active(TL_FB_Blink)) { timeline_kill(TL_FB_Blink) } off [dvAC_TPArray[nAC_ActiveRoom], 113] on [dvAC_TPArray[nAC_ActiveRoom], 119] send_command dvAC_TPArray[nAC_ActiveRoom],"'@TXT',117,''" send_command dvAC_TPArray[nAC_ActiveRoom],"'@TXT',116,'PIN verification successful ',cPIN_NamesArray[nPinUser],' !'" cAC_Pword = '' cAC_FakePword = '' wait 40 { send_command dvAC_TPArray[nAC_ActiveRoom],"'@TXT',116,''" } } } else { send_command dvAC_TPArray[nAC_ActiveRoom],"'@TXT',116,''" send_command dvAC_TPArray[nAC_ActiveRoom],"'@TXT',117,'Invalid Password !'" if (!timeline_active(TL_FB_Blink)) { timeline_create(TL_FB_Blink,TL_FB_BlinkRuntime,1,timeline_absolute,timeline_repeat) } send_command dvAC_TPArray[nAC_ActiveRoom],"'@TXT',120 ,''" AC_Room[nAC_ACtiveTP].AC_Secur.AC_SecValidPword = 0 AC_Room[nAC_ACtiveTP].AC_Secur.AC_SecPword = '' cAC_Pword = '' cAC_FakePword = '' } } else { AC_Room[nAC_ACtiveTP].AC_Secur.AC_SecValidPword = 0 send_command dvAC_TPArray[nAC_ActiveRoom],"'@TXT',116,''" send_command dvAC_TPArray[nAC_ActiveRoom],"'@TXT',117,'PIN requires 4 digits!'" if (!timeline_active(TL_FB_Blink)) { timeline_create(TL_FB_Blink,TL_FB_BlinkRuntime,1,timeline_absolute,timeline_repeat) } send_command dvAC_TPArray[nAC_ActiveRoom],"'@TXT',120 ,''" cAC_Pword = '' cAC_FakePword = '' } } ACTIVE (DATA.TEXT == 'Clear'): { cAC_Pword = '' cAC_FakePword = '' AC_Room[nAC_ACtiveTP].AC_Secur.AC_SecValidPword = 0 AC_Room[nAC_ACtiveTP].AC_Secur.AC_SecPword = '0' send_command dvAC_TPArray[nAC_ActiveRoom],"'@TXT',120 ,cAC_FakePword" } ACTIVE (DATA.TEXT == 'Abort'): { cAC_Pword = '' cAC_FakePword = '' off[dvAC_TPArray[nAC_ActiveRoom], 119] on [dvAC_TPArray[nAC_ActiveRoom], 113] AC_Room[nAC_ACtiveTP].AC_Secur.AC_SecValidPword = 0 AC_Room[nAC_ACtiveTP].AC_Secur.AC_SecPword = '0' send_command dvAC_TPArray[nAC_ActiveRoom],"'@TXT',120 ,cAC_FakePword" send_command dvAC_TPArray[nAC_ActiveRoom],"'PPOF-_ACkeypad'" send_command dvAC_TPArray[nAC_ActiveRoom],"'PPOF-_ACkeypaddisplay'" send_command dvAC_TPArray[nAC_ActiveRoom],"'PPON-AC_ClosePage'" send_command dvAC_TPArray[nAC_ActiveRoom],"'@TXT',116,''" send_command dvAC_TPArray[nAC_ActiveRoom],"'@TXT',117 ,'Enter PIN aborted!'" if (!timeline_active(TL_FB_Blink)) { timeline_create(TL_FB_Blink,TL_FB_BlinkRuntime,1,timeline_absolute,timeline_repeat) } wait 40 'PauseToBlank' { send_command dvAC_TPArray[nAC_ActiveRoom],"'@TXT',117 ,''" } } } } } } } }