laravel authentication :exact location of AuthController - php

I am new to the laravel framework,and i setup the laravel basic authentication it simple and awesome.
I need a clarification in following things
1.when i list the all routes using route list command i can see the many routes including the functionalities for login and register ,but the routes not registerd in in route.php file ,how its worked?
2.I want to add some more fields in registration for that i am looking for this function AuthController#register ,but there is no function named register in it,so where it is actually located.??
EDIT
1.I need to find the login functions also,because I want to show custom error message to the user is(password not found,invalid email,account blocked )
2.want to change the route after logout

Related

Laravel 7 filters

I have successfully created a logging and registration system!
I get to the part where I need to do the sign out option.
My course I bought at Udemy is a bit old so I don't have a file called filters.php
I searched on the internet to find a file called filters.php and found one post saying Middleware was used instead of filter.php
How to create a Sign out option now using Middleware?
Web.php
Route::group(array('before' => 'auth'), function()){
}
You don't need to create the sign out option, which it already included in Laravel Authentication.
You can get more information about how to setup it at the link below:-
https://laravel.com/docs/5.7/authentication
Otherwise, Laravel Authentication almost cover all authentication functions such as login, reset password and logout.
When you complete the setup. It will generate the middleware and controller for the Authentication feature. You just need to add some code at your route file.
Auth::routes(); //This line help to declare the route used by Laravel Authentication
Route::group(['middleware'=>['admin']],function(){
//Declare Your Route that only allowed access by the logged in user here
});

Access the Laravel session in my Vue Component

For the context, I send an email for the verification of the account of my user.
By clicking on a button, it triggers a /verify-user route on my laravel routes.
At the end of my activation action into my controller, I make a return redirect('/')->with('message', 'Your account has been activated');.
According to the documentation this line put my message into the session.
But now I want to access this session into my .vue component when the component is mounted.
I tried to use the vue-session package, but that returns me always "undefined" when I try to access the this.$session.get('message').
My '/' component is composed with an app.blade.php where I have a router-view component who render the component based on my vue routes.
I am quite sure I am not the first person who want to do something like this, but I don't find any clue on the internet how to do that.
I tried with the props but in vain :(
Thanks

How to make two different login systems in yii

I am new to yii. I just need two login page. One for Super-Admin and another for Sub-Admin. I created Super-Admin login page and it is successful. My Super-Admin path is 127.0.0.1/ticketing/adminLogin. My Sub-Admin path is 127.0.0.1/ticketing/login. I had created crud app for adminLogin page. Now i am using default login page for Sub-Admin. But i gave all the proper model name and actions. But my Sub-Admin login page is checking values from Super-Admin table and not from Sub-Admin table. Please help to fix this issue.
Hi as you said you have created a complete new crud for admin and sub admin then you can also create a new SubadminUserIdentity in components which extend CUserIdentity and in login model of sub admin use SubadminUserIdentityin authenticate and login function
Hi thanks for your reply. I got an answer. I made a silly mistake. I called the same authenticate function for Super-Admin and Sub-Admin. Now i make two authenticate functions and it works.

Laravel 5.2 built-in authorization customization

SO community!
I have a project, that I've built on Laravel 5.2. As its authorization I am using the built in one, that can be generated by running
php artisan make:auth
It serves well, but the system's users will be mostly invited by the administrator, whose account is created by the built-in auth action under the route /register. There will be multiple instances of my project hosted separately.
Once the system is set up I do need the route to create the administrator account, but after that I would like the route to be not be accessible.
The customization I need is as follows:
I am thinking about an "if" that would check how many administrator accounts there currently are. If there is at least one, the /register route would redirect to /login.
Something like this:
$administrators = User::where( 'role', User::ROLE_ADMIN )->get();
if ( count( $administrators ) != 0 ) return redirect( url('/login') );
It is a simple piece of code, but I do not know where to put it.
First possible solution:
At first I was thinking that I would need to customize the register action by adding the check to it, but the AuthController does not have register action and I do not understand how the AuthController works.
Second possible solution:
I was thinking of creating a middleware with the admin count check for the /register route, but in the routes file the built-in authorization routes are somehow condensed and added with this piece of code:
Route::auth();
Is there some way of extracting the /register route out of that, so I bind the middleware on to it?
Or maybe there is a better way of adding the check.
Any help will be much appreciated!

Laravel User Registration

I'm looking for a way for users that are logged in to register new users. I don't want unregistered users creating new users. The problem that I'm coming up against is that Laravel does a lot of rerouting when you use their registration controllers so that it auto reroutes you away from the registration page if you are already logged in. Is there a way that I can get around this functionality without having to rewrite all of the registration logic?
I've tried simply adding auth middleware to the registration route but it immediately reroutes to the home page of the app before you hit the registration view. If I create a route that redirects to the registration view like this-
Route::get('register', function(){
return view('auth.register');
});
It will give me the registration page but silently fail to add any users to the database. I think it may be because the RegistersUsers class has use RedirectsUsers as its first statement. Short of rewriting the code there is there another way to accomplish what I'm trying to do?
I'm using Laravel 5.2 with the make:auth standard views

Categories