1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace Pratiksh\Adminetic\Mixins; |
4
|
|
|
|
5
|
|
|
class AdmineticAuthMixins |
6
|
|
|
{ |
7
|
|
|
public function admineticAuth() |
8
|
|
|
{ |
9
|
|
|
/** |
10
|
|
|
* Register the typical authentication routes for an application. |
11
|
|
|
* |
12
|
|
|
* @param array $options |
13
|
|
|
* @return callable |
14
|
|
|
*/ |
15
|
|
|
|
16
|
|
|
return function ($options = []) { |
17
|
|
|
$namespace = "Pratiksh\Adminetic\Http\Controllers"; |
18
|
|
|
|
19
|
|
|
$this->group(['namespace' => $namespace], function () use ($options) { |
|
|
|
|
20
|
|
|
if ($options['home'] ?? true) { |
21
|
|
|
$this->view('/', 'adminetic::welcome'); |
|
|
|
|
22
|
|
|
} |
23
|
|
|
// Login Routes... |
24
|
|
|
if ($options['login'] ?? true) { |
25
|
|
|
$this->get('login', 'Auth\LoginController@showLoginForm')->name('login'); |
|
|
|
|
26
|
|
|
$this->post('login', 'Auth\LoginController@login'); |
|
|
|
|
27
|
|
|
} |
28
|
|
|
|
29
|
|
|
// Logout Routes... |
30
|
|
|
if ($options['logout'] ?? true) { |
31
|
|
|
$this->post('logout', 'Auth\LoginController@logout')->name('logout'); |
32
|
|
|
} |
33
|
|
|
|
34
|
|
|
// Registration Routes... |
35
|
|
|
if ($options['register'] ?? true) { |
36
|
|
|
$this->get('register', 'Auth\RegisterController@showRegistrationForm')->name('register'); |
37
|
|
|
$this->post('register', 'Auth\RegisterController@register'); |
38
|
|
|
} |
39
|
|
|
|
40
|
|
|
// Password Reset Routes... |
41
|
|
|
if ($options['reset'] ?? true) { |
42
|
|
|
$this->resetPassword(); |
43
|
|
|
} |
44
|
|
|
|
45
|
|
|
// Password Confirmation Routes... |
46
|
|
|
if ( |
47
|
|
|
$options['confirm'] ?? |
48
|
|
|
class_exists($this->prependGroupNamespace('Auth\ConfirmPasswordController')) |
|
|
|
|
49
|
|
|
) { |
50
|
|
|
$this->confirmPassword(); |
51
|
|
|
} |
52
|
|
|
|
53
|
|
|
// Email Verification Routes... |
54
|
|
|
if ($options['verify'] ?? false) { |
55
|
|
|
$this->emailVerification(); |
56
|
|
|
} |
57
|
|
|
|
58
|
|
|
// Socialite Login |
59
|
|
|
|
60
|
|
|
/* OAuth Routes */ |
61
|
|
|
if (config('adminetic.enable_socialite', false)) { |
62
|
|
|
if (config('adminetic.github_socialite', true)) { |
63
|
|
|
$this->get('sign-in/github', 'Admin\SocialiteController@github')->name('sign_in_github'); |
64
|
|
|
$this->get('sign-in/github/redirect', 'Admin\SocialiteController@githubRedirect')->name('sign_in_github_redirect'); |
65
|
|
|
} |
66
|
|
|
|
67
|
|
|
if (config('adminetic.facebook_socialite', true)) { |
68
|
|
|
$this->get('sign-in/facebook', 'Admin\SocialiteController@facebook')->name('sign_in_facebook'); |
69
|
|
|
$this->get('sign-in/facebook/redirect', 'Admin\SocialiteController@facebookRedirect')->name('sign_in_facebook_redirect'); |
70
|
|
|
} |
71
|
|
|
|
72
|
|
|
if (config('adminetic.google_socialite', true)) { |
73
|
|
|
$this->get('sign-in/google', 'Admin\SocialiteController@google')->name('sign_in_google'); |
74
|
|
|
$this->get('sign-in/google/redirect', 'Admin\SocialiteController@googleRedirect')->name('sign_in_google_redirect'); |
75
|
|
|
} |
76
|
|
|
} |
77
|
|
|
}); |
78
|
|
|
}; |
79
|
|
|
} |
80
|
|
|
|
81
|
|
|
/** |
82
|
|
|
* Register the typical reset password routes for an application. |
83
|
|
|
* |
84
|
|
|
* @return callable |
85
|
|
|
*/ |
86
|
|
|
public function resetPassword() |
87
|
|
|
{ |
88
|
|
|
return function () { |
89
|
|
|
$this->get('password/reset', 'Auth\ForgotPasswordController@showLinkRequestForm')->name('password.request'); |
90
|
|
|
$this->post('password/email', 'Auth\ForgotPasswordController@sendResetLinkEmail')->name('password.email'); |
91
|
|
|
$this->get('password/reset/{token}', 'Auth\ResetPasswordController@showResetForm')->name('password.reset'); |
92
|
|
|
$this->post('password/reset', 'Auth\ResetPasswordController@reset')->name('password.update'); |
93
|
|
|
}; |
94
|
|
|
} |
95
|
|
|
|
96
|
|
|
/** |
97
|
|
|
* Register the typical confirm password routes for an application. |
98
|
|
|
* |
99
|
|
|
* @return callable |
100
|
|
|
*/ |
101
|
|
|
public function confirmPassword() |
102
|
|
|
{ |
103
|
|
|
return function () { |
104
|
|
|
$this->get('password/confirm', 'Auth\ConfirmPasswordController@showConfirmForm')->name('password.confirm'); |
105
|
|
|
$this->post('password/confirm', 'Auth\ConfirmPasswordController@confirm'); |
106
|
|
|
}; |
107
|
|
|
} |
108
|
|
|
|
109
|
|
|
/** |
110
|
|
|
* Register the typical email verification routes for an application. |
111
|
|
|
* |
112
|
|
|
* @return callable |
113
|
|
|
*/ |
114
|
|
|
public function emailVerification() |
115
|
|
|
{ |
116
|
|
|
return function () { |
117
|
|
|
$this->get('email/verify', 'Auth\VerificationController@show')->name('verification.notice'); |
118
|
|
|
$this->get('email/verify/{id}/{hash}', 'Auth\VerificationController@verify')->name('verification.verify'); |
119
|
|
|
$this->post('email/resend', 'Auth\VerificationController@resend')->name('verification.resend'); |
120
|
|
|
}; |
121
|
|
|
} |
122
|
|
|
} |
123
|
|
|
|
This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.
This is most likely a typographical error or the method has been renamed.