Jump to content

Petzy

Members
  • Posts

    34
  • Joined

  • Last visited

  • Days Won

    1

Everything posted by Petzy

  1. Can we have 2 MainForm's and just use one based on some user settings? For example: I use a UniLoginForm to authenticate the user. On clicking the LoginButton present on UniLoginForm an sql query fires up logging him (UniLoginForm modalresult mrOk) in based on database details - typical Login system. Invariably that pops up the MainForm already present in the Project/at project creation. I was thinking, could I possibly add a new UniForm and use that as the MainForm based on an existing condition? For example in the database the username has a field called admin, the field can contain yes or no. On the previously mentioned LoginButton present on UniLoginForm1 I can add a check for that field value and if it returns no for that user then the existing MainForm should be used, as a MainForm. If on the other hand the field value returns yes for that user then it should use the other MainForm. Reason I want to do this is because I'm trying to separate regular users from admin users - subsequently providing different functionality, design, components and so on, on their respective MainForm's. Is this doable? If not, could you recommend any other method to achieve this? I'd appreciate some input on the matter. I'm currently in the process of re-reading the unigui devmanual and component manual to determine if this is achievable. Thanks!
  2. Hi, First issue I'm having: Deleted the following line from the project .dpr file: {$define UNIGUI_VCL} // Comment out this line to turn this project into an ISAPI module The .dpr now looks like this: {$ifndef UNIGUI_VCL} library {$else} program {$endif} COPSI; uses uniGUIISAPI, Forms, ServerModule in 'ServerModule.pas' {UniServerModule: TUniGUIServerModule}, MainModule in 'MainModule.pas' {UniMainModule: TUniGUIMainModule}, u_main in 'u_main.pas' {MainForm: TUniForm}, u_login in 'u_login.pas' {UniLoginForm1: TUniLoginForm}, u_map in 'u_map.pas' {MapForm: TUniForm}, u_pdf in 'u_pdf.pas' {pdfForm: TUniForm}, u_feedback in 'u_feedback.pas' {feedbackForm: TUniForm}, {$R *.res} {$ifndef UNIGUI_VCL} exports GetExtensionVersion, HttpExtensionProc, TerminateExtension; {$endif} begin {$ifdef UNIGUI_VCL} ReportMemoryLeaksOnShutdown := True; Application.Initialize; TUniServerModule.Create(Application); Application.Run; {$endif} end. In Rad Studio I've set Build Configurations to Release in the Project Manager I compile then go to the \Release folder in my Project folder and there is no copsi.dll file - just copsi.exe So it's not compiling and releasing as a .dll as dev manual says it should once I uncomment/delete that first line from the .dpr And yes, I did select Standalone / ISAPI when initially creating the project from the wizzard. What's going on? My second problem: Installed XAMPP, configured httpd.conf with all thats needed. In httpd.conf: LoadModule isapi_module modules/mod_isapi.so is uncommented (no #) in front. AddHandler isapi-handler .dll - added to httpd.conf Added this to httpd.conf as per development manual instructions: Renamed copsi.exe (read 1st problem) to copsi.dll - figured maybe it's just a bug and it spits it out with a different name but as a dll Copied the file to C:\webapps I start apache - opening up localhost in browser takes me to the apache dashboard (xampp/htdocs) Opening localhost/webapps/ says not found Opening localhost/webapps/copsi.dll says not found Thats with the paths left set to default as they were (extjs and the rest) I even copied all the folders (extjs and the rest) to C:\webapps and set the paths in ServerModule to .\[extjs] and so forth (all the rest) Still same thing happens. What am I doing wrong so far? I'd like to deploy it as ISAPI and run it with XAMPP just to see it/how it works out of Standalone. Let me know if I forgot to mention any info. Thanks!
  3. Pro, latest. Dang it, that's too bad. Any plans of adding it in the future? Feature request
  4. Hello, I can't seem to find any demo or component that would allow me to open an existing PDF in a new form, edit the fields of the pdf and input the various information then save it as a separate PDF on the server. An example of an existing pdf that would require editing/filling in required information and which would then require to be saved separately on the server: [pic removed so data won't be public anymore] The pdf already exists in the files folder on the server, I'd open it in a new form (I know how to do that) - I would then proceed to edit/fill in information in their respective fields (I don't know how to do this) and then save it on the server in a separate folder inside the files folder (I know how to do that too) Any tutorials/demos on that? I'd appreciate any code/links regarding this thanks!
  5. Found the problem. Forgot to paste the necessary modifications made in ServerModule (mention the google api url and other css and so forth) Apologies for opening the topic without checking absolutely everything first.
  6. Hey there, I've come across the Google Maps demo provided, it works flawlessly. I'm trying to add the Main.pas (and dfm) from the google maps demo to my application directory and adding them to the project. The problem is when I fire it up in my application and open the form, I get this error. The code in the imagine O16B=new Ext.window.Window({id:"O16B_id",retfalse:{},onEsc:Ext.emptyFn,layout:"fit",title:"Google Maps",maximizable:true,minimizable:true,resizable:true,icon:"/cache/copsi_exe/zeRFRPi2XW10151101A/favicon.ico",uniFMask:{beforeclose:true},width:888,height:612,x:239,y:16});O16B.nm="O16B";_cdo_("MForm");MForm.ajxS=AjaxSuccess;MForm.ajxF=AjaxFailure;O16B.rootObj=true;MForm.appRoot="/";_cdo_(null,O16B,"window",MForm); O173=new Ext.form.Panel({id:"O173_id",border:false,tabItems:new Ext.util.MixedCollection(),layout:"absolute"});O173.nm="O173";_cdo_(null,O173,"form",MForm);O16B.add(O173); O17B= (function(P0){return Ext.Ajax.request({url:"/HandleEvent",params:"Ajax=1&IsEvent=1&Obj=O16B&Evt=beforeclose&this="+P0.nm+""+_gv_(O173),success:AjaxSuccess,failure:AjaxFailure,obj:O16B,e:"beforeclose"});});O17B.nm="O17B";O16B.on("beforeclose",O17B); O17C= (function(P0){_saf_(P0);return Ext.Ajax.request({url:"/HandleEvent",params:"Ajax=1&IsEvent=1&Obj=O16B&Evt=activate&this="+P0.nm+""+_gv_(O173),success:AjaxSuccess,failure:AjaxFailure,obj:O16B,e:"activate"});});O17C.nm="O17C";O16B.on("activate",O17C); O17D= (function(P0){return Ext.Ajax.request({url:"/HandleEvent",params:"Ajax=1&IsEvent=1&Obj=O16B&Evt=deactivate&this="+P0.nm+""+_gv_(O173),success:AjaxSuccess,failure:AjaxFailure,obj:O16B,e:"deactivate"});});O17D.nm="O17D";O16B.on("deactivate",O17D);O16B.on("deactivate",function(f){_sdf_(f)}); O17E=new Ext.panel.HTML({id:"O17E_id",border:false,bodyBorder:false,bodyCls:"x-panel-white",header:false,border:false,bodyBorder:false,layout:"absolute",style:"border:none;",width:608,height:543,x:8,y:8});O17E.nm="O17E";_cdo_("UniHTMLFrame1",O17E,null,MForm);_coe_(MForm,"UniHTMLFrame1",null,"afterupdatehtml",function(sender) { var latlng = new google.maps.LatLng(0.0, 0.0); var myOptions = { zoom: 1, center: latlng, mapTypeId: google.maps.MapTypeId.ROADMAP }; var umap = document.getElementById("uni_map_canvas"); var map = new google.maps.Map(umap, myOptions); googleMap = map; google.maps.event.addListener(map, 'zoom_changed', function() { MainForm.UniTrackBar1.setValue(this.getZoom()); } ); google.maps.event.addListener(map, 'click', function(e) { ajaxRequest(MainForm.UniHTMLFrame1, 'mapClick', ['lat='+e.latLng.lat(), 'lng='+e.latLng.lng()]); } ); });_coe_(MForm,"UniHTMLFrame1",null,"afterrender",function(sender, eOpts) { sender.hide(); sender.show(); });_coe_(MForm,"UniHTMLFrame1",null,"resize",function(sender, width, height, oldWidth, oldHeight, eOpts) { if (typeof googleMap != 'undefined') { google.maps.event.trigger(googleMap, 'resize'); } });O173.add(O17E); O186=new Ext.panel.Panel({id:"O186_id",bodyBorder:false,html:"",header:false,layout:"absolute",width:252,height:562,x:622,y:8});O186.nm="O186";_cdo_("UniPanel1",O186,null,MForm);O173.add(O186); O18E=new Ext.button.Button({id:"O18E_id",tabIndex:267,icon:"/cache/copsi_exe/res/__5847FDD3413048D799788864.png",iconCls:"x-uni-btn-icon-notext",width:25,height:25,x:16,y:64});O18E.nm="O18E";_cdo_("UniBitBtn1",O18E,null,MForm);_coe_(MForm,"UniBitBtn1",null,"click",function(sender, e) { googleMap.panBy(-25, 0); });O186.add(O18E); O192=new Ext.button.Button({id:"O192_id",tabIndex:268,icon:"/cache/copsi_exe/res/__38EAFBB8608D4AF399788864.png",iconCls:"x-uni-btn-icon-notext",width:25,height:25,x:112,y:64});O192.nm="O192";_cdo_("UniBitBtn2",O192,null,MForm);_coe_(MForm,"UniBitBtn2",null,"click",function(sender, e) { googleMap.panBy(25, 0); });O186.add(O192); O196=new Ext.button.Button({id:"O196_id",tabIndex:269,icon:"/cache/copsi_exe/res/__270AFDFA726D48B09978894A.png",iconCls:"x-uni-btn-icon-notext",width:25,height:25,x:64,y:16});O196.nm="O196";_cdo_("UniBitBtn3",O196,null,MForm);_coe_(MForm,"UniBitBtn3",null,"click",function(sender, e) { googleMap.panBy(0, -25); });O186.add(O196); O19A=new Ext.button.Button({id:"O19A_id",tabIndex:270,icon:"/cache/copsi_exe/res/__270AFDFA726D48B09978889A.png",iconCls:"x-uni-btn-icon-notext",width:25,height:25,x:64,y:112});O19A.nm="O19A";_cdo_("UniBitBtn4",O19A,null,MForm);_coe_(MForm,"UniBitBtn4",null,"click",function(sender, e) { googleMap.panBy(0, 25); });O186.add(O19A); O19E=new Ext.slider.Single({id:"O19E_id",increment:1,animate:false,maxValue:10,maxValue:14,vertical:true,value:1,name:"O19E",enableKeyEvents:true,tabIndex:271,height:158,x:172,y:3});O19E.nm="O19E";_cdo_("UniTrackBar1",O19E,null,MForm);_coe_(MForm,"UniTrackBar1",null,"change",function(slider, newValue, thumb) { googleMap.setZoom(newValue); MainForm.UniSpinEdit1.setValue(newValue); });O186.add(O19E); O1A2=new Ext.form.field.Number({id:"O1A2_id",value:"1",name:"O1A2",enableKeyEvents:true,tabIndex:272,minValue:0,maxValue:14,width:57,height:22,x:152,y:179});O1A2.nm="O1A2";_cdo_("UniSpinEdit1",O1A2,null,MForm);_coe_(MForm,"UniSpinEdit1",null,"spin",function(sender, direction, eOpts) { });_coe_(MForm,"UniSpinEdit1",null,"change",function(sender, newValue, oldValue, eOpts) { MainForm.UniTrackBar1.setValue(newValue); });O186.add(O1A2); O1A6=new Ext.button.Button({id:"O1A6_id",text:"Hybrid",enableToggle:true,allowDepress:false,toggleGroup:"O16B_1",tabIndex:273,width:54,height:40,x:6,y:216});O1A6.nm="O1A6";_cdo_("UniSpeedButton1",O1A6,null,MForm);_coe_(MForm,"UniSpeedButton1",null,"click",function(sender, e) { googleMap.setOptions({ mapTypeId: google.maps.MapTypeId.HYBRID }); });O186.add(O1A6); O1AA=new Ext.button.Button({id:"O1AA_id",text:"Roadmap",enableToggle:true,allowDepress:false,toggleGroup:"O16B_1",pressed:true,tabIndex:274,width:54,height:40,x:59,y:216});O1AA.nm="O1AA";_cdo_("UniSpeedButton2",O1AA,null,MForm);_coe_(MForm,"UniSpeedButton2",null,"click",function(sender, e) { googleMap.setOptions({ mapTypeId: google.maps.MapTypeId.ROADMAP }); });O186.add(O1AA); O1AE=new Ext.button.Button({id:"O1AE_id",text:"Satellite",enableToggle:true,allowDepress:false,toggleGroup:"O16B_1",tabIndex:275,width:54,height:40,x:112,y:216});O1AE.nm="O1AE";_cdo_("UniSpeedButton3",O1AE,null,MForm);_coe_(MForm,"UniSpeedButton3",null,"click",function(sender, e) { googleMap.setOptions({ mapTypeId: google.maps.MapTypeId.SATELLITE }); });O186.add(O1AE); O1B2=new Ext.button.Button({id:"O1B2_id",text:"Terrain",enableToggle:true,allowDepress:false,toggleGroup:"O16B_1",tabIndex:276,width:54,height:40,x:165,y:216});O1B2.nm="O1B2";_cdo_("UniSpeedButton4",O1B2,null,MForm);_coe_(MForm,"UniSpeedButton4",null,"click",function(sender, e) { googleMap.setOptions({ mapTypeId: google.maps.MapTypeId.TERRAIN }); });O186.add(O1B2); O1BA=new Ext.data.Store({fields:[],storeId:"O1BA_id",remoteSort:true,remoteGroup:true,proxy:{type:"ajax",url:"/HandleEvent?IsEvent=1&Obj=O1B6&Evt=data&"+_S_ID,reader:{type:"json"},timeout:30000}}); O1C2=new Ext.selection.RowModel({mode:"SINGLE"}); O1DF=new Object({}); O1B6=new Ext.grid.Panel({id:"O1B6_id",store:O1BA,columns:[],columnLines:true,bodyBorder:true,border:true,tabIndex:277,selModel:O1C2,loadDataMask:O1DF,enableColumnMove:false,viewConfig:{preserveScrollOnRefresh:true,markDirty:false,loadMask:false},plugins:[Ext.create("Ext.grid.plugin.CellEditing",{pluginId:"uniGridEditor",clicksToEdit:2})],width:242,height:297,x:4,y:262});O1B6.nm="O1B6";_cdo_("UniDBGrid1",O1B6,null,MForm);O1BA.nm="O1BA";_cdo_("UniDBGrid1",O1BA,"store",MForm);O1BA.grid=O1B6;O1BA.dbgrid=true; O1BB= (function(P0){return Ext.Ajax.request({url:"/HandleEvent",params:"Ajax=1&IsEvent=1&Obj=O1BA&Evt=load&this="+P0.nm+""+_gv_(O173),success:AjaxSuccess,failure:AjaxFailure,obj:O1BA,e:"load"});});O1BB.nm="O1BB";O1BA.on("load",O1BB); O1BC= (function(P0){return Ext.Ajax.request({url:"/HandleEvent",params:"Ajax=1&IsEvent=1&Obj=O1BA&Evt=prefetch&this="+P0.nm+""+_gv_(O173),success:AjaxSuccess,failure:AjaxFailure,obj:O1BA,e:"prefetch"});});O1BC.nm="O1BC";O1BA.on("prefetch",O1BC); O1BD=new Ext.form.field.Hidden({name:"O1BD",enableKeyEvents:true});O1BD.nm="O1BD"; O1C1=new Ext.selection.CellModel({});O1C1.nm="O1C1";_cdo_("UniDBGrid1",O1C1,"cellModel",MForm);O1C2.nm="O1C2";_cdo_("UniDBGrid1",O1C2,"rowModel",MForm); O1C3=new Ext.selection.CheckboxModel({mode:"SINGLE",injectCheckbox:0});O1C3.nm="O1C3";_cdo_("UniDBGrid1",O1C3,"checkboxModel",MForm);O1C1.grid=O1B6;O1C2.grid=O1B6;O1BD.grid=O1B6;O1B6.hidField=O1BD; O1C4= (function(P0,P1){_src_(O1BD,xlatRow(P1),P1.column.dataIndex,null,P1.record,true);_ae_(P1);return Ext.Ajax.request({url:"/HandleEvent",params:"Ajax=1&IsEvent=1&Obj=O1B6&Evt=edit&VR="+_o2s_(P1.newValues, P1.originalValues)+"&V="+_xl_(P1.value)+"&O="+_xl_(P1.originalValue)+"&R="+xlatRow(P1)+"&C="+P1.column.dataIndex+"&RN="+_getrno_(P1.record)+""+_gv_(O173),success:AjaxSuccess,failure:AjaxFailure,obj:O1B6,e:"edit"});});O1C4.nm="O1C4";O1B6.on("edit",O1C4); O1C5= (function(P0,P1){return Ext.Ajax.request({url:"/HandleEvent",params:"Ajax=1&IsEvent=1&Obj=O1B6&Evt=canceledit&R="+P1.rowIdx+"&C="+P1.column.dataIndex+""+_gv_(O173),success:AjaxSuccess,failure:AjaxFailure,obj:O1B6,e:"canceledit"});});O1C5.nm="O1C5";O1B6.on("canceledit",O1C5); O1C6= (function(P0,P1){if(!_ce_(P1))return(false);if(!_src_(O1BD,xlatRow(P1),P1.column.dataIndex,null,P1.record,true))return(false);return Ext.Ajax.request({url:"/HandleEvent",params:"Ajax=1&IsEvent=1&Obj=O1B6&Evt=beforeedit&V="+_xl_(P1.value)+"&O="+_xl_(P1.originalValue)+"&R="+xlatRow(P1)+"&C="+P1.column.dataIndex+"&RN="+_getrno_(P1.record)+""+_gv_(O173),success:AjaxSuccess,failure:AjaxFailure,obj:O1B6,e:"beforeedit"});});O1C6.nm="O1C6";O1B6.on("beforeedit",O1C6,O1B6,{delay:1}); O1C7= (function(P0,P1,P2,P3){_cge_(P0);_src_(O1BD,xlatRecRow(P2,P1),_gcdi_(P0,P3),null,P1);if(_ccell_(P0))return;return Ext.Ajax.request({url:"/HandleEvent",params:"Ajax=1&IsEvent=1&Obj=O1C1&Evt=select&This="+P0.nm+"&rr="+xlatRecRow(P2,P1)+"&cc="+P3+""+_gv_(O173),success:AjaxSuccess,failure:AjaxFailure,obj:O1C1,e:"select"});});O1C7.nm="O1C7";O1C1.on("select",O1C7); O1C8= (function(P0,P1){_src_(O1BD,null,null,false,P1);return Ext.Ajax.request({url:"/HandleEvent",params:"Ajax=1&IsEvent=1&Obj=O1C2&Evt=selectionchange&This="+P0.nm+"&sels="+P1.length+""+_gv_(O173),success:AjaxSuccess,failure:AjaxFailure,obj:O1C2,e:"selectionchange"});});O1C8.nm="O1C8";O1C2.on("selectionchange",O1C8); O1C9= (function(P0,P1){_src_(O1BD,null,null,false,P1);return Ext.Ajax.request({url:"/HandleEvent",params:"Ajax=1&IsEvent=1&Obj=O1C3&Evt=selectionchange&This="+P0.nm+"&sels="+P1.length+""+_gv_(O173),success:AjaxSuccess,failure:AjaxFailure,obj:O1C3,e:"selectionchange"});});O1C9.nm="O1C9";O1C3.on("selectionchange",O1C9);O1B6.on("columnresize",function(ct,c,w){if(c.fedit)c.fedit.setWidth(w-10)}); O1CA= (function(P0,P1,P2,P3){return Ext.Ajax.request({url:"/HandleEvent",params:"Ajax=1&IsEvent=1&Obj=O1B6&Evt=columnmove&OldIndex="+P2+"&NewIndex="+P3+""+_gv_(O173),success:AjaxSuccess,failure:AjaxFailure,obj:O1B6,e:"columnmove"});});O1CA.nm="O1CA";O1B6.on("columnmove",O1CA); O1CB= (function(P0,P1){return Ext.Ajax.request({url:"/HandleEvent",params:"Ajax=1&IsEvent=1&Obj=O1B6&Evt=columnhide&col="+P1.dataIndex+""+_gv_(O173),success:AjaxSuccess,failure:AjaxFailure,obj:O1B6,e:"columnhide"});});O1CB.nm="O1CB";O1B6.on("columnhide",O1CB); O1CC= (function(P0,P1){return Ext.Ajax.request({url:"/HandleEvent",params:"Ajax=1&IsEvent=1&Obj=O1B6&Evt=columnshow&col="+P1.dataIndex+""+_gv_(O173),success:AjaxSuccess,failure:AjaxFailure,obj:O1B6,e:"columnshow"});});O1CC.nm="O1CC";O1B6.on("columnshow",O1CC); O1CD=new Ext.toolbar.Paging({id:"O1CD_id"});O1CD.nm="O1CD";_cdo_("UniDBGrid1",O1CD,"pagingBar",MForm);O186.add(O1B6);O186.add(O1BD); O1D1=new Ext.form.Label({id:"O1D1_id",cls:"x-unilabel",text:"Click on map!",style:"font:bold 11px Tahoma;color:#000080",x:10,y:555});O1D1.nm="O1D1";_cdo_("UniLabel1",O1D1,null,MForm);O173.add(O1D1); O1D5= (function(P0,P1,P2){return Ext.Ajax.request({url:"/HandleEvent",params:"Ajax=1&IsEvent=1&Obj=O16B&Evt=resize&this="+P0.nm+"&w="+P1+"&h="+P2+""+_gv_(O173),success:AjaxSuccess,failure:AjaxFailure,obj:O16B,e:"resize"});});O1D5.nm="O1D5";O16B.on("resize",O1D5); O1D6= (function(P0,P1,P2){return Ext.Ajax.request({url:"/HandleEvent",params:"Ajax=1&IsEvent=1&Obj=O16B&Evt=move&this="+P0.nm+"&x="+P1+"&y="+P2+""+_gv_(O173),success:AjaxSuccess,failure:AjaxFailure,obj:O16B,e:"move"});});O1D6.nm="O1D6";O16B.on("move",O1D6); O1D7= (function(P0){return Ext.Ajax.request({url:"/HandleEvent",params:"Ajax=1&IsEvent=1&Obj=O16B&Evt=maximize&this="+P0.nm+""+_gv_(O173),success:AjaxSuccess,failure:AjaxFailure,obj:O16B,e:"maximize"});});O1D7.nm="O1D7";O16B.on("maximize",O1D7); O1D8= (function(P0){return Ext.Ajax.request({url:"/HandleEvent",params:"Ajax=1&IsEvent=1&Obj=O16B&Evt=minimize&this="+P0.nm+""+_gv_(O173),success:AjaxSuccess,failure:AjaxFailure,obj:O16B,e:"minimize"});});O1D8.nm="O1D8";O16B.on("minimize",O1D8); O1D9= (function(P0){return Ext.Ajax.request({url:"/HandleEvent",params:"Ajax=1&IsEvent=1&Obj=O16B&Evt=restore&this="+P0.nm+""+_gv_(O173),success:AjaxSuccess,failure:AjaxFailure,obj:O16B,e:"restore"});});O1D9.nm="O1D9";O16B.on("restore",O1D9);O16B.show("");O16B.retfalse.beforeclose=1;_axy_(O16B);O16B.uniMask={ldMask:false,maskWaitData:false,maskUseMsg:true};O16B.uniMask.targetObj=null;O18E.addToTab(2670);O192.addToTab(2680);O196.addToTab(2690);O19A.addToTab(2700);O19E.addToTab(2710);O1A2.addToTab(2720); O1DA= (function(P0,P1){return Ext.Ajax.request({url:"/HandleEvent",params:"Ajax=1&IsEvent=1&Obj=O1A6&Evt=toggle&this="+P0.nm+"&pressed="+P1+""+_gv_(O173),success:AjaxSuccess,failure:AjaxFailure,obj:O1A6,e:"toggle"});});O1DA.nm="O1DA";O1A6.on("toggle",O1DA);O1A6.addToTab(2730); O1DB= (function(P0,P1){return Ext.Ajax.request({url:"/HandleEvent",params:"Ajax=1&IsEvent=1&Obj=O1AA&Evt=toggle&this="+P0.nm+"&pressed="+P1+""+_gv_(O173),success:AjaxSuccess,failure:AjaxFailure,obj:O1AA,e:"toggle"});});O1DB.nm="O1DB";O1AA.on("toggle",O1DB);O1AA.addToTab(2740); O1DC= (function(P0,P1){return Ext.Ajax.request({url:"/HandleEvent",params:"Ajax=1&IsEvent=1&Obj=O1AE&Evt=toggle&this="+P0.nm+"&pressed="+P1+""+_gv_(O173),success:AjaxSuccess,failure:AjaxFailure,obj:O1AE,e:"toggle"});});O1DC.nm="O1DC";O1AE.on("toggle",O1DC);O1AE.addToTab(2750); O1DD= (function(P0,P1){return Ext.Ajax.request({url:"/HandleEvent",params:"Ajax=1&IsEvent=1&Obj=O1B2&Evt=toggle&this="+P0.nm+"&pressed="+P1+""+_gv_(O173),success:AjaxSuccess,failure:AjaxFailure,obj:O1B2,e:"toggle"});});O1DD.nm="O1DD";O1B2.on("toggle",O1DD);O1B2.addToTab(2760);O1B6.addToTab(2770);_fixmultis_(O1B6); O1DE= (function(P0,P1,P2){return Ext.Ajax.request({url:"/HandleEvent",params:"Ajax=1&IsEvent=1&Obj=O1B6&Evt=columnresize&ColumnIndex="+P1.dataIndex+"&NewSize="+P2+""+_gv_(O173),success:AjaxSuccess,failure:AjaxFailure,obj:O1B6,e:"columnresize"});});O1DE.nm="O1DE";O1B6.on("columnresize",O1DE);O1DF.nm="O1DF";O1DF.uniMask={ldMask:true,maskMsg:"Loading data...",maskWaitData:false,maskUseMsg:true,maskAttribs:{color:"#FFFFFF",opacity:0.5}};O1DF.uniMask.targetObj=O1B6; O1E0=new Ext.grid.column.Column({ogrid:O1B6,sortable:false,dataIndex:"0",renderer:_rndcll_,rdonly:true,text:"City",width:79,unEditable:true});O1E0.nm="O1E0"; O1E1=new Ext.grid.column.Column({ogrid:O1B6,sortable:false,dataIndex:"1",renderer:_rndcll_,rdonly:true,text:"Longitude",align:"right",cf:"#.#######",ct:"float",width:60,unEditable:true});O1E1.nm="O1E1"; O1E2=new Ext.grid.column.Column({ogrid:O1B6,sortable:false,dataIndex:"2",renderer:_rndcll_,rdonly:true,text:"Latitude",align:"right",cf:"#.#######",ct:"float",width:76,unEditable:true});O1E2.nm="O1E2";var O1B6_Cols=[O1E0,O1E1,O1E2];O1B6.reconfigure(null,O1B6_Cols);O1B6.uniConfigColumns();O1E1.setElProp({"text-align":"left"},null,0,null,null,"titleEl");O1E2.setElProp({"text-align":"left"},null,0,null,null,"titleEl");O1BA.load({params:{options:1}});O17E.update(" <div id=\"uni_map_canvas\" style=\"width: 100%; height: 100%\">\n </div>\n",true); I've made sure this isnt a main form so it doesn't interfere with my application's already existent mainform. What am I doing wrong? Can't seem to figure it out at all.
  7. Hey there, thanks for your reply. I'm really new at this but If I understand you correctly that would imply me having a SSL certificate on the server/website I'm deploying to, right? If yes, then I'll hold off on this suggestion and as I don't know when/if I'll have SSL on that (planning on it though - it will just be a while). I'd appreciate if you have a simple working demo doing what you suggested, or a tutorial / reading I could take a look at until I actually take it on. Thanks, nonetheless! Sheesh, exactly what I was looking for. Never having the need to do a login system with hash passwords saved in the database, until now, I didn't have the faintest clue what to search for / what it's called. I eventually found this http://docwiki.embarcadero.com/Libraries/Tokyo/en/System.Hash.THashSHA2 after reading your comment and searching for System.Hash Your example line was obviously instantly helpful, but guess what, after I've been reading on my own for the past several days (prior to your answer) I've somehow mistaken hashing with encrypt / decrypt - and you could imagine how off course I was at that point, I kept searching how the hell do you decrypt it now. Eventually stumbled upon another tutorial which between the several hundred lines of text had one in particular that made me throw rocks at my head, namely: Generate a hash for a password and compare it during sign in process. And after finding that I just noticed you said the exact same thing. lol! Pretty funny how not reading thoroughly makes you waste a couple of days. Lesson learned! So, after all that, I eventually came up with this code for the login procedure: procedure TUniLoginForm1.UniButton1Click(Sender: TObject); var hash: string; begin UniMainModule.loginQuery.SQL.Text := 'SELECT username, password FROM membri WHERE username=:username'; UniMainModule.loginQuery.Params.ParamByName('username').Value := UniEdit1.Text; try UniMainModule.loginQuery.Open; if UniMainModule.loginQuery.IsEmpty then // No record found for user ShowMessage('Utilizator inexistent') // Handle error else begin hash := THashSHA2.GetHashString(UniEdit2.Text,THashSHA2.TSHA2Version.SHA256); if UniMainModule.loginQuery.FieldByName('password').Value <> hash then begin ShowMessage('Parola gresita'); // Handle password mismatch; end else begin UniMainModule.LoggedUser := UniEdit1.Text; if UniCheckBox1.Checked then begin UniApplication.Cookies.SetCookie('_loginname', UniEdit1.Text, Date + 7.0); // Expires 7 days from now UniApplication.Cookies.SetCookie('_pwd', UniEdit2.Text, Date + 7.0); end; ModalResult := mrOK; end; end; finally UniMainModule.loginQuery.Close; end; end; It works perfectly, in the sense that it's searching for the username 1st, if it doesn't find the username it raises a Message, if it does find it then it hashes the password and compares the hash to the hash saved in the database, for that username. If they don't differ, voila, logged in. If they do differ, it raises another Message and no login. So far that's perfect. Trying now to figure out how to change this part of the code related to cookies so it works with my new setup: procedure TUniMainModule.UniGUIMainModuleBeforeLogin(Sender: TObject; var Handled: Boolean); var S1, S2 : string; begin S1 := (Sender as TUniGUISession).UniApplication.Cookies.Values['_loginname']; S2 := (Sender as TUniGUISession).UniApplication.Cookies.Values['_pwd']; Handled := SameText(S1, 'demo') and SameText(S2, 'demo'); if Handled then LoggedUser := S1; end; How would that look? Also thinking on the salt part, how do I use a salt with the current setup? And If I do, I'm assuming I'll have to adjust the cookies code again, right? Thanks again!
  8. I did notice those yes, they're ideal, just having trouble finding an example on how to do the checks and implement that with encrypted passwords. Still reading on that. I'm using user and passwords saved in a table, they're plaintext at the moment but I'd like to use the password as encrypted somehow, not to save it plaintext.
  9. Hello, New to the forum, loving uniGUI so far. Does anyone have a demo/code sample on how to make a login system in uniGUI? I've done it simple with a predetermined user and pass, also learned to setup cookies and so forth I just can't seem to find a demo that shows how to check for the user and password in the database (mysql), preferably the password being encrypted in the database and the application able to handle that. Any help? I'd appreciate it, thanks.
×
×
  • Create New...