Tricky workflow from public page to restricted page with specific conditions - ajax

I have a public page with a data-request = onClaim button.
A user can use this button whether he is logged or not
When the user "claims" this page, if certain conditions are fulfilled, the database must be updated and then a specific restricted access page have to be displayed with the new updated datas.
If conditions are not met, user stay on the public page with warning message.
To know if these conditions are met, the user must be logged in (using his account or creating new one)
note:
When the restricted page is displayed by any other way than this button. No specific data is updated
hard to explain, do my best !
Please, How to implement this workflow elegantly (or not)?
development environment:
october 419
rainlab User plugin
debugbar 1.0.8 plugin
sweet alert 1.1.0 plugin
i tried some tricks but according to the xy problem, i prefer don't talk about

Related

How do I get the Router navigate extra "replaceUrl" to work correctly?

I have a contact addition form that can be navigated to from multiple screens in our application.
Once the form is submitted, I then take the user to a screen to view the contact that was added.
When the user then makes use of the back button it should take them back to the screen that they originated from.
This might be the Android back button or one that calls the RouterExtensions back function.
I have made use of the navigate extra replaceUrl when navigating away from the form to the view page.
I have also tried using the skipLocationChange extra when navigating to the form but this creates more issues.
I have created a simple playground page flow that creates not quite the same issue but does throw an error that I don't know what to do with either:
https://play.nativescript.org/?template=play-ng&id=BfVcGZ&v=2
In our app, by making use of the replaceUrl extra, the back button does take the user to the correct page.
However, there is a brief moment where they see the form again. This isn't an ideal user experience.
In the linked Playground I do get an error:
Cannot reattach ActivatedRouteSnapshot created from a different route.
This seems to tell me that replaceUrl is indeed removing the page from the route table.
However, the page isn't destroyed yet and so the app is trying to show a page that it shouldn't.
replaceUrl is not yet supported by Page Router Outlet, there is an open feature request, you might want to register your vote on the feature and follow up there for further updates.

Is it possible to skip confirmation page in SagePay custom templates

I'm setting up a set of custom templates for a SagePay server integration (iFrame), and I'm wondering if anyone knows if it's possible to prevent the confirmation page (card_confirmation.xslt) being presented to the user.
It mostly duplicates information presents to customers earlier on in the checkout process and so is largely redundant.
So it's a bit of a long shot but can we by modifying some form value in one of the other templates or by any other method tell the system to skip that page?
Thanks.
You won't get this confirmation page if you pass Profile=LOW with the original transaction registration post. In fact, if you are not sending this and displaying the Sage Pay screens in an iframe, you are going to have problems with some browsers.

Does Moodle cache User Profile Field for activity restriction?

I am trying to restrict access to Moodle course activities based on a user profile field. The profile field tracks eligibility based on other criteria such as whether they have filled in certain important information about their business.
The field is required, locked and set to a default value, although setting it to unlocked made no difference. It is hidden from view in the user profile and signup screen using CSS (because Moodle user profile fields that aren't displayed in the sign up screen don't get a mdl_user_info_data row created when the user is created - but that's another issue). The relevant row in mdl_user_info_data is updated when the user submits a form that I've created. This part works absolutely fine, except that the user still needs to log out and back in again in order for the change to trickle down to the course page (i.e. for them to be able to access the course activities).
It appears that the user profile fields are being cached when the user logs in, and are not being updated. Does anyone know if this is so? And the obvious follow up questions would be - Can I force this cache to be updated and, if I can, how would I go about triggering this?
I'm using Moodle 2.7.3.
The data is cached in the $USER global object (which is, itself, cached on the session data), in the $USER->profile field. You should be able to update the value there or call a function to reload it (I can't remember the function off the top of my head, but it will be in user/profile/lib.php).

Joomla! alternative registration form switches back to default form

I am following the "Joomla! Programming" book by Mark Dexter and Louis Landry.
I came up to the point where we create a plugin to check whether both terms of service agreement and age above 18 is checked in the alternative registration form layout which we create earlier (approval.php).
When testing this plugin, I checked only one of the checkboxes and showed the "Registration Failed" error as expected. But on the error page, the registration form is the default one and not the alternative one which we created earlier (approval.php)
Why is this?

What is the purpose of isFirstPageAfterLogin method in admin/session model?

I see where this method is being used, but I'm wondering who has an authoritative answer on the matter?
I know you said you know where, but I'm going to mention it here for completeness since you didn't... hope you don't mind! :)
The flag that isFirstPageAfterLogin() checks is set in the login() method that's called during the admin login process.
It is used in the following places:
Mage_Adminhtml_IndexController to store the value in the admin session so that it's still available on the first page load after the login form is submitted.
Mage_Adminhtml_Block_Notification_Window to determine whether or not to show the notices "window" that often shows after login.
A few actions on Mage_Adminhtml_Report_StatisticsController in order to redirect the user to the page they should be if their login routes them to one of the report refresh actions.
Mage_Core_Controller_Front_Action uses it to redirect a user back to the dashboard if their login routes them to an action that would send a download response, which frequently can rely on filter data that may or may not be available to the controller if it come from the login.
So to recap, it's a very important flag that is used to control some behind the scenes behavior. The most important being redirecting to the correct login page and allowing for one-time notices to show upon login.
This value is used in Mage_Adminhtml_IndexController, specifically the indexAction(), and redirects the admin user to the start up page defined in System > Configuration > Advanced > Admin > Startup Page.

Resources