In my Laravel app I have different auth for administrators and users. So I have separete views as well. I have placed auth views folder inside admin folder, so that the view path to my admin auth is now admin.auth.login for example. Where can I change those paths so that I can use them for all the auth functions?
If you take a look at your app\Http\Controllers\Auth\LoginController.php, you will see:
use AuthenticatesUsers;
It's a traits, you can find all the login related method over there in use Illuminate\Foundation\Auth\AuthenticatesUsers.php.
There's a method in the trait which show the view as below:
public function showLoginForm()
{
return view('auth.login');
}
What you want to do is either:
Copy the traits out to your own one and modify the showLoginForm method.
or
Override the method showLoginForm in your LoginController.php. See this
Related
I have build my own Plugin in Shopware 6. I allready have a custom module with custom route. Now I want to add data from my custom database table to my custom routes html.twig.
My Route: http://localhost:8888/admin#/ankauf/module/overview
My Database Table: product_reservation
I have build my own controller but I can't get this controller to listen to my route. Maybe because my route is build from the module? The path in my module is: ankauf.module.overview
Is a controller the right way? And if yes, how can it listen to my path and don't overwrite it with his own route?
Is there a better way to push PHP Code to my custom Backend path?
If you have created an own entity with definition etc (like here or here described) there is an easy to get your data to an admin module. Shopware will automatically register routes for CRUD operations on your entity. So the entity is automatically available via the admin API. On the admin side there are also helper services to read out your API. In your vue.js component you need to inject the
inject: [
'repositoryFactory'
],
With this factory you are able to create a repository which requests your custom entity API route.
{
...
created() {
this.repository = this.repositoryFactory.create('product_reservation');
}
}
The repository has several methods like search, get, create, delete, etc.
With these methods you are able to read out your data in the vue.js component of your plugin and bring it to your module
Read more about an own module here
my means how to write one authorization filter like mvc4/mvc4,
like this scenarioļ¼
I have many controller and many actions ,at once I have two roles; some time ,we need add new user role, and need to change those actions to three roles;
If the filter can authorize by the configure ,I only modify the configure file;
otherwise, I need change the Authorize attribute on every actions;
I think it's terrible.
I have read the document about on this article here . But can't find solution. So who can help me to resolve it.
thank !
So, I've got an Admin Controller that uses the [Authorize] notation with a single admin account (for content management purposes). If the administrator is not logged on, it redirects the user to the login view.
In the Admin controller, I've this ActionResult:
public ActionResult GeneratePDF(int? id) {
return new ActionAsPdf("PrintOrder/" + id) {
FileName = Server.MapPath("~/PDF/test.pdf")
};
}
The above code is currently for testing purposes and will be modified later.
However, when I call the ActionResult from a View (beeing logged on as admin), it only generates a PDF of the Login View as if there is no valid admin session and the user gets redirected. The code works when using the [AllowAnonymous] notation on the PrintOrder ActionResult, but not when a valid user session is required.
Any ideas on how to let the ActionAsPdf method access the required PrintOrder method and still be secured by the [Authorize] notation?
I'm calling the Action from a View as follows:
Get PDF
After doing some lengthly research I've found another post with the same issue.
Why does Rotativa always generate my login page? Why is it slow?
The author suggests that the Rotativa code is placed in the same method that it needs access to as a solution. This seems to work as a workaround to the issue and is sufficient for now. However, while a more robust solution would be desired, this will have to do.
I want to integrate Google's Oauth2 in my symfony-1.4 CRM. I have successfully implemented this, I have extended sfGuardAuth in my own module, and now mysfGuardAuth is being used for siging and signout. Is there where I handle Google's Oauth2 with 2 extra actions:
executeCkeckGoogleAccess();
executeOauth();
The problem is to checkout if Google's token is still a valid one, I have to redirect in each action of everymodule to the action checkGoogleAccess in mysfGuardAuth module.
What I want is to check this in an implicit way in the same place where symfony, or sfGuard or whatever checks for the right perms or credentials before executing or not executing the requested action.
I only want to write the code once.
Thank you.
After some research this is how sfGuard checks everything.
When you make a request to a module action, before the action is executed, a new sfContext is dispached.
The sfContext gets the user that extends sfGuardUser and has some methods that are executed. There is where perms, session status and everithing else is checked
The user must be configured in apps/yourApp/lib
By default is apps/yourApp/lib/myUser which extends sfGuardUser. The most apropiate way to achieve this is to create a new user class like: apps/yourApp/lib/yourAppUser which extends aswell sfGuardUser, and there extend the methods initialize and/or shutdown with the functionality you want.
By this way I have achieved to get Google's Oauth2 working in my app.
I hope this is usefull for more people.
UPDATE
All described above is true, but if you want to check something always before an action execution you must use filters instead of whats described before.
Filters are executed before each action, so there you can checkout whatever you need having access to the current context, and set up new attributes for the user. In my case I wanna check if the requested action needs a google token, if true, then Another filter will check if the user has alraedy a valid token, in that case, nothing happens, otherwise, the user is redirected to the module/action which handles google token requests.
Comunication between diferent filters, actions and requests are handled via user attributes.
the user is an object of the clas myOwnUser which extends sfGuardSecurityUser, there the function signOut is extended in order to delete all attributes saved in "myOwnNamespace"
I need to change the behaviour of the login-page of OpenStack. I am working on an alternatively way to authenticate an user. I use no more name and password. It works on command line but I have to use it also in the graphically part (horizon).
I should change the action performed when I click the LogIn button, but I can not find where is the implementation of that action: which is the function called by Horizon to authenticate an user?
My aim is to call my new keystone functions to get the token, but I can not find which horizon's function calls keystone.
[UPDATED QUESTION]
the *../horizon/views/auth_forms.py* defines how the login page is defined. Where does its class Login is called? I need to modify the code that starts the login page creation
Horizon instantiates an entire class set for keystone interaction.
checkout horizon/openstack_dashboard/api/keystone.py
it mostly uses the python-keystoneclient api set.
You may want to also check out http://docs.openstack.org/developer/horizon/topics/customizing.html
I tried to modify some files like: horizon/openstack_auth/view.py where Login is called.