Jump to content

CastleSoft

uniGUI Subscriber
  • Posts

    169
  • Joined

  • Last visited

  • Days Won

    11

Everything posted by CastleSoft

  1. In a LOGIN form I have a button which builds a URL (for OpenID Connect) Microsoft authentication. And redirects to the OpenID for authentication, the URL contains the UniSession.SessionID. Using: UniSession.UrlRedirect(loginRequest); Microsoft authenticates ok, and the URL (callback used in the loginRequest) is called. This triggers: UniGUIServerModuleHTTPCommand if ARequestInfo.URI.Contains('/auth') then I extract the TOKEN and the SessionID I sent to Microsoft (it comes back) I store the SessionID in a Dictionary<string,string> so I have SessionID,Token Then set Handled := true; AResponseInfo.Redirect('/?_S_ID='+sID); (ie.. The original session id sent to Microsoft, returned etc). This returns back to the LOGIN form on the ORIGINAL Session_ID. On the FORM_SHOW I check if the Current Session_ID is in the Server Dictionary and if approved. set the LOGIN to mrOK. All seems to be great..!!!! EXCEPT.. Strange Javascript errors appear when I do anything on the main form ??? Any ideas ? If you have been redirected like: LOGIN -> HTTPCommand -> /?_S_ID=xxxxx. Is there anything else you need to keep the session valid ? Thanks Andrew
  2. The link below has a BASIC implementation of SAML for ASP.NET. (323 lines of c# code), a Delphi/uniGUI version would be nice. This would assist in Education / Business sites who use SAML for single-sign-on to take up uniGUI as an option. https://github.com/jitbit/AspNetSaml How SAML works? SAML workflow has 2 steps: User is redirected to the SAML provider (where he authenticates) User is redirected back to your app, where you validate the payload Here's how you do it (this example is for ASP.NET MVC: 1. Redirecting the user to the saml provider: //this example is an ASP.NET MVC action method public ActionResult Login() { //TODO: specify the SAML provider url here, aka "Endpoint" var samlEndpoint = "http://saml-provider-that-we-use.com/login/"; var request = new AuthRequest( "http://www.myapp.com", //TODO: put your app's "entity ID" here "http://www.myapp.com/SamlConsume" //TODO: put Assertion Consumer URL (where the provider should redirect users after authenticating) ); //redirect the user to the SAML provider return Redirect(request.GetRedirectUrl(samlEndpoint)); } 2. User has been redirected back User is sent back to your app - you need to validate the SAML response ("assertion") that you recieved via POST. Here's an example of how you do it in ASP.NET MVC //ASP.NET MVC action method... But you can easily modify the code for Web-forms etc. public ActionResult SamlConsume() { // 1. TODO: specify the certificate that your SAML provider gave you string samlCertificate = @"-----BEGIN CERTIFICATE----- BLAHBLAHBLAHBLAHBLAHBLAHBLAHBLAHBLAHBLAHBLAHBLAH123543== -----END CERTIFICATE-----"; // 2. Let's read the data - SAML providers usually POST it into the "SAMLResponse" var Saml.Response samlResponse = new Response(samlCertificate, Request.Form["SAMLResponse"]); // 3. We're done! if (samlResponse.IsValid()) username = samlResponse.GetNameID(); } Reading more attributes from the provider SAML providers usually send more data with their response: username, first/last names etc. Here's how to get it: if (samlResponse.IsValid()) { //WOOHOO!!! user is logged in //Some more optional stuff for you //let's extract username/firstname etc string username, email, firstname, lastname; try { username = samlResponse.GetNameID(); email = samlResponse.GetEmail(); firstname = samlResponse.GetFirstName(); lastname = samlResponse.GetLastName(); } catch(Exception ex) { //insert error handling code //no, really, please do return null; } //user has been authenticated, put your code here, like set a cookie or something... //or call FormsAuthentication.SetAuthCookie() or something }
  3. > www.unigui.com ;; Got SERVFAIL reply from 8.8.8.8, trying next server Server: 8.8.4.4 Address: 8.8.4.4#53 ** server can't find www.unigui.com: SERVFAIL forums.unigui.com ;; Got SERVFAIL reply from 8.8.8.8, trying next server Server: 8.8.4.4 Address: 8.8.4.4#53 ** server can't find forums.unigui.com: SERVFAIL > forums.unigui.com Server: 139.130.4.4 Address: 139.130.4.4#53 Non-authoritative answer: Name: forums.unigui.com Address: 82.113.145.191 Google DNS servers 8.8.8.8 and 8.8.4.4 having problems with your domain. Telstra 139.130.4.4 appears to resolve ok.
  4. No problem Farshad.... All good, understood. :-)
  5. Hi, I'm sure the last time I check the renewal was $350USD for Complete Professional ? Today when I logged in and checked it appears to have changed to $550USD ? Is this a recent change ? My last renewal was $350USD also ?? Thanks Andrew Tierney CastleSoft
  6. https://community.idera.com/developer-tools/b/blog/posts/announcing-fmx-linux-bundling-with-delphi-and-rad-studio Starting today, Delphi and RAD Studio customers, with active subscription to the Enterprise or Architect editions can download, install, and start using FmxLinux for building FireMonkey applications targeting the Linux 64-bit platform. uniGUI for Linux now has a possible Standalone GUI option :-)
  7. Would it be possible to add support for V3 (or make an additional) reCaptcha control ? V3 doesn't require the 'checkbox - I'm not a robot' question. It just displays a 'hovering' logo right bottom side of the page. No user interaction is required with v3, which is nice. The sample howto for php is below: The basic JS code <script src="https://www.google.com/recaptcha/api.js?render=your reCAPTCHA site key here"></script> <script> grecaptcha.ready(function() { // do request for recaptcha token // response is promise with passed token grecaptcha.execute('your reCAPTCHA site key here', {action:'validate_captcha'}) .then(function(token) { // add token value to form document.getElementById('g-recaptcha-response').value = token; }); }); </script> The basic HTML code <form id="form_id" method="post" action="your_action.php"> <input type="hidden" id="g-recaptcha-response" name="g-recaptcha-response"> <input type="hidden" name="action" value="validate_captcha"> .... your fields </form> The basic PHP code if(isset($_POST['g-recaptcha-response'])){ $captcha=$_POST['g-recaptcha-response']; } else $captcha = false; if(!$captcha){ //Do something with error } else{ $secret = 'Your secret key here'; $response=file_get_contents("https://www.google.com/recaptcha/api/siteverify?secret= .$secret.&response=".$captcha."&remoteip=".$_SERVER['REMOTE_ADDR']); if($response.success==false) { //Do something with error } } ... The Captcha is valid you can continue with the rest of your code
  8. A repeater panel like on ASP.NET would be nice. Basically create the layout you want in a row, the row repeats. Image, HTML, Text, etc A flexible grid style..
  9. Code is now available via Github: https://github.com/CastleSoft/uiXtra Contains the latest source code (v1.07 - RIO release, uniGUI 1.5 (latest release) - Forum patches/updates in this thread ** Thank you all ** ) MIT lic.. Feel free to FORK / hack / etc. Sorry. I don't have much time these days to monitor the forums. Enjoy.. PS.. v1.06 is the original release for pre RIO / pre 1.5 / pre patches - if anyone needs it.
  10. I have a custom control based on TUniCustomHTMLFrame which works with a <canvas> element. I have a Javascript function called resizeCanv() which is as follows: function resizeCanv(){ var canvas = $( "canvas#'+JSName+'" )[0]; canvas.width = canvas.parentElement.clientWidth; canvas.height = canvas.parentElement.clientHeight; } In my TUniFAKECanvas controls .create the HTML.Text is set to <canvas id="'+JSName+'"></canvas> and the resizeCanv() is called. It all works great. I then added the Align to allow me to use 'client' for sizing. When the form is resized, the HTMLFrame resizes ok, but I need to call my resizeCanv() javascript function. Inside the custom control, what should I hook / trap and whats the recommended way inside a custom control to trap a forms align=client so the child controls can be resized/moved etc ? Thanks
  11. Thanks.. Looks good. I'll give it a try.
  12. Any plans for reactive or multi-layout mobile support in the gui ?
  13. A few minor tweaks and another another freebie. iTyped - https://github.com/luisvinicius167/ityped Simply add the uniTyped control (resize to your size). var s: TStrings; begin s := TStringList.Create; s.Add('Welcome to the jungle'); s.Add('Restarting soo...'); UniTyped1.text := s; UniTyped1.PlayTyped; s.Free; end; or Just set the properties in the control and do a UniTyped.PlayTyped. Source code and Example below (includes the sweetalert/jquerytoast/iTyped). https://goo.gl/bnU2Ab
  14. A few more fixes. - Z-Index for jToast fixed - buttonsStyling (typo / spelling incorrect in SweetAlert2) New css file added to jToast. (re-grab the files/jtoast and files/sweetalert folders in any code you use for the updated). Added 'custom' to jToast.. when 'Pos: custom' the Left and Top are used for positioning. *** If you are using an older version you may need to ignore the buttonStyling missing error and toggle the 'buttonsStyling' and save to fix. *** If you have Z-Index issues.. Clear your browser cache and try again. Enjoy. uniExtensions-V5.zip
  15. Updated SweetAlert2 control (REST) removed, fix Z-Order issue when the alert appears behind the form. Added TEST / DEMO Added a new control wrapper for jToast https://github.com/kamranahmedse/jquery-toast-plugin (uniJToast currently has properties, a simple ShowMessage and events for Before/After Show/Hide.) Enjoy. uniExtensions.zip
  16. To fix the Floating behind the Login form you could add the following to the ServerModule.CustomCSS .swal2-container { z-index:20000; } OR.. The next post has an updated version (new files/sweetalert with the extra css). + a new jQuery Toast control + DEMO / Test (c:\tmp was the original folder containing the files).
  17. Add RTTI To the uses clause.. Will fix the problem..
  18. Add RTTI To the uses clause.. Will fix the problem..
  19. RESTComponents can be removed. Originally I planned on using the TJSon.OjectToJson method.. But removed the code and went simple strings instead. So it shouldn't be needed.
  20. Attached is a simple wrapper for the SweetAlert2 library. (QUICK HACK.. No unit testing, no tidy up etc..) ** No warranty - Use at your own risk ** FREE for commercial use, etc.. (just don't remove the copyright header). 1) Compile the Package/Install 2) Make sure your path includes the control folder 3) Copy the files/sweetalert folder into your project 4) Drag/Drop the uniSweetAlert control onto your form. Simple usage like: procedure TMainForm.UniButton1Click(Sender: TObject); begin UniSweetAlert1.ShowMessage; // or like UniSweetAlert1.Error('Oops','Something went wrong'); // or like UniSweetAlert1.Error('Oops','Error again','FixMe',3000); // or like UniSweetAlert1.Question('Is this true','Please click one of the options below:','YES','NO',3000); // or like UniSweetAlert1.title := 'Hello'; UniSweetAlert1.text := 'Testing'; UniSweetAlert1.alertType := TAlertType.success; UniSweetAlert1.ShowMessage; end; // Events for Confirm or Cancel/Dismiss procedure TMainForm.UniSweetAlert1Dismiss(Sender: TObject); begin UniButton1.Caption := 'DIS'; uniMemo1.Lines.Add('Dis'); end; procedure TMainForm.UniSweetAlert1Success(Sender: TObject); begin UniButton1.Caption := 'CLICKED'; uniMemo1.Lines.Add('Clicked'); end; Either (1) set properties and call .ShowMessage; Or call the Error, Info, etc methods. Enjoy.. Regards Andrew 2017-07-29-uniSweetAlert V3.zip
  21. Is it possible to change the default DOCTYPE in a uniGUI application from the default: <!DOCTYPE html public> To the following: <!DOCTYPE html> The "public" is causing issues when I try and use a few Syncfusion components in a uniGUI application. Also it appears that Chrome isn't very happy with the PUBLIC tag either, for example if I use the following (non UniGUI test case) in Chrome all is good. <!DOCTYPE html> <html> <head> <link rel="stylesheet" type="text/css" href="./Syncfusion/content/ej/web/default-theme/ej.web.all.min.css"> <script src="./Syncfusion/scripts/jquery-2.1.4.min.js"></script> <script src="./Syncfusion/scripts/jsrender.min.js"></script> <script src="./Syncfusion/scripts/jquery.validate.min.js"></script> <script src="./Syncfusion/scripts/jquery.validate.unobtrusive.min.js"></script> <script src="./Syncfusion/scripts/ej/web/ej.web.all.min.js"></script> <script language="javascript" type="text/javascript"> $(function () { $("#Spreadsheet").ejSpreadsheet({ loadComplete: "loadComplete" }); }); function loadComplete(args) { // ajaxRequest({URL_CALLBACK}, 'loadComplete', ['param=value']); this.XLSelection.selectRange("A1:C3"); this.XLDragFill.positionAutoFillElement(); } </script> </head> <body> <div id="Spreadsheet" style="width:100%; height:100%"></div> </body> </html> If I change the <!DOCTYPE> to include the word "Public" chrome hangs. In uniGUI if I wish to embed the Spreadsheet control (above) I do the following: 1) ServerModule - CustomFiles /Syncfusion/content/ej/web/default-theme/ej.web.all.min.css /Syncfusion/scripts/jquery-2.1.4.min.js /Syncfusion/scripts/jsrender.min.js /Syncfusion/scripts/jquery.validate.min.js /Syncfusion/scripts/jquery.validate.unobtrusive.min.js /Syncfusion/scripts/ej/web/ej.web.all.min.js 2) Drop a uniHTMLFrame onto the MainForm 3) Add the following to the AfterScript properties: $(function () { $("#Spreadsheet").ejSpreadsheet({ loadComplete: "loadComplete" }); }); function loadComplete(args) { this.XLSelection.selectRange("A1:C3"); this.XLDragFill.positionAutoFillElement(); } 4) Set the HTML to the following: <div id="Spreadsheet" style="width:100%; height:100%"></div> And uniGUI has the embedded SpreadSheet in a mainform showing. (see attached) ** Minus the range selection and it appears the AjaxRequest isn't working. (not shown in the example). Also Chrome freezes (like the standalone) test case, due to the <!DOCTYPE html public> text. Sample - UNIGUI project and testing.html file http://goo.gl/vh8yNX ** NOTE ** Includes Syncfusion COMMUNITY Edition javascript files (not for redistribution, you must have either a paid or community lic..)
  22. Thanks.. A quick question regarding behaviour of the CustomControl3 example. If I place 10x uniCustomControl3's onto a form. I'm assuming each controls initialisation will be called, resulting in calling UniAddJSLibrary 10 times ? Does the AddJSLibrary routine check if the library already exists ? And not add duplicates ? Thanks Andrew
  23. Hi All, What would be the best method for a custom UniGUI control which uses additional CSS and JS files ? My initial thought was: 1x UniComponentCore which is dropped onto the ServerModule (adding css/js and initialising as required) 1x UniComponent dropped into a form which requires the UniComponentCore to be work. (Maybe even a dialog box to warn if no ComponentCore is found in the ServerModule). This way any additional CSS/JS is only added once. No need to check/manage css/js. It also free's the new UniComponent to assume configuration is ok (not worrying about CSS/JS) provided the ComponentCore is in the ServerModule. Or is there a cleaner way ? There are a number of additional components I would like to write/wrap with extra css/js and would like the preferred method before I start. Thanks Andrew
  24. https://market.sencha.com/extensions/bootstrap-theme http://getbootstrap.com/getting-started/#download
  25. URL Routing for Forms would be awesome...!!!! Maybe a Routing Control ? Drop it into the ServerModule and map paths to UniForms ? ie. /Forms/Leave -> UniFormLeave /Forms/Order -> UniFormOrder /Forms/Customer -> UniFormCustomer /Forms/Customer?id=123 -> UniFormsCustomer with parameters or /Forms/Customer/123 -> UniFormsCustomer with Parameters
×
×
  • Create New...