Skip to content
This repository was archived by the owner on Oct 8, 2024. It is now read-only.

Commit 7fe7a40

Browse files
committed
👽 updated auth config
1 parent 1409921 commit 7fe7a40

1 file changed

Lines changed: 38 additions & 31 deletions

File tree

config/auth.php

Lines changed: 38 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,27 @@
33
use Leaf\Helpers\Password;
44

55
return [
6+
/*
7+
|--------------------------------------------------------------------------
8+
| Database table
9+
|--------------------------------------------------------------------------
10+
|
11+
| This is the table that leaf auth will perform authentication
12+
| checks on and edit/retrieve users from.
13+
|
14+
*/
15+
'DB_TABLE' => 'users',
16+
17+
/*
18+
|--------------------------------------------------------------------------
19+
| Use session
20+
|--------------------------------------------------------------------------
21+
|
22+
| Use session based authentication instead of the default JWT based auth.
23+
|
24+
*/
25+
'USE_SESSION' => false,
26+
627
/*
728
|--------------------------------------------------------------------------
829
| Generate timestamps
@@ -12,7 +33,7 @@
1233
| and update methods
1334
|
1435
*/
15-
"USE_TIMESTAMPS" => true,
36+
'USE_TIMESTAMPS' => true,
1637

1738
/*
1839
|--------------------------------------------------------------------------
@@ -26,7 +47,7 @@
2647
| You can set your own implementation instead of Password::hash
2748
|
2849
*/
29-
"PASSWORD_ENCODE" => function ($password) {
50+
'PASSWORD_ENCODE' => function ($password) {
3051
return Password::hash($password);
3152
},
3253

@@ -41,7 +62,7 @@
4162
| You can add your own implementation instead of Password::verify
4263
|
4364
*/
44-
"PASSWORD_VERIFY" => function ($password, $hashedPassword) {
65+
'PASSWORD_VERIFY' => function ($password, $hashedPassword) {
4566
return Password::verify($password, $hashedPassword);
4667
},
4768

@@ -54,7 +75,7 @@
5475
| in your database.
5576
|
5677
*/
57-
"PASSWORD_KEY" => "password",
78+
'PASSWORD_KEY' => 'password',
5879

5980
/*
6081
|--------------------------------------------------------------------------
@@ -64,7 +85,7 @@
6485
| Hide id field from user object returned in login, register and update
6586
|
6687
*/
67-
"HIDE_ID" => true,
88+
'HIDE_ID' => true,
6889

6990
/*
7091
|--------------------------------------------------------------------------
@@ -74,7 +95,7 @@
7495
| Hide password from user object returned in login, register and update
7596
|
7697
*/
77-
"HIDE_PASSWORD" => true,
98+
'HIDE_PASSWORD' => true,
7899

79100
/*
80101
|--------------------------------------------------------------------------
@@ -84,7 +105,7 @@
84105
| Error to show when the login params aren't found in db
85106
|
86107
*/
87-
"LOGIN_PARAMS_ERROR" => "Username not registered!",
108+
'LOGIN_PARAMS_ERROR' => 'Username not registered!',
88109

89110
/*
90111
|--------------------------------------------------------------------------
@@ -94,21 +115,7 @@
94115
| Error to show when the login password is wrong
95116
|
96117
*/
97-
"LOGIN_PASSWORD_ERROR" => "Password is incorrect!",
98-
99-
/*
100-
|--------------------------------------------------------------------------
101-
| Use session [EXPERIMENTAL]
102-
|--------------------------------------------------------------------------
103-
|
104-
| Use session based authentication instead of the default JWT based auth.
105-
|
106-
| If you encounter any problems using any new auth session features,
107-
| revert to the default auth and manage sessions manually.
108-
| Don't forget to open an issue.
109-
|
110-
*/
111-
"USE_SESSION" => false,
118+
'LOGIN_PASSWORD_ERROR' => 'Password is incorrect!',
112119

113120
/*
114121
|--------------------------------------------------------------------------
@@ -119,42 +126,42 @@
119126
| you it'll be created on login rather.
120127
|
121128
*/
122-
"SESSION_ON_REGISTER" => false,
129+
'SESSION_ON_REGISTER' => false,
123130

124131
/*
125132
|--------------------------------------------------------------------------
126133
| Login page route
127134
|--------------------------------------------------------------------------
128135
*/
129-
"GUARD_LOGIN" => "/auth/login",
136+
'GUARD_LOGIN' => '/auth/login',
130137

131138
/*
132139
|--------------------------------------------------------------------------
133140
| Register page route
134141
|--------------------------------------------------------------------------
135142
*/
136-
"GUARD_REGISTER" => "/auth/register",
143+
'GUARD_REGISTER' => '/auth/register',
137144

138145
/*
139146
|--------------------------------------------------------------------------
140147
| Logout route
141148
|--------------------------------------------------------------------------
142149
*/
143-
"GUARD_HOME" => "/home",
150+
'GUARD_HOME' => '/home',
144151

145152
/*
146153
|--------------------------------------------------------------------------
147154
| Logout route
148155
|--------------------------------------------------------------------------
149156
*/
150-
"GUARD_LOGOUT" => "/auth/logout",
157+
'GUARD_LOGOUT' => '/auth/logout',
151158

152159
/*
153160
|--------------------------------------------------------------------------
154161
| Home page route
155162
|--------------------------------------------------------------------------
156163
*/
157-
"GUARD_HOME" => "/home",
164+
'GUARD_HOME' => '/home',
158165

159166
/*
160167
|--------------------------------------------------------------------------
@@ -164,7 +171,7 @@
164171
| Add an auth token to the auth session?
165172
|
166173
*/
167-
"SAVE_SESSION_JWT" => false,
174+
'SAVE_SESSION_JWT' => false,
168175

169176
/*
170177
|--------------------------------------------------------------------------
@@ -174,7 +181,7 @@
174181
| Secret string to encode JWT
175182
|
176183
*/
177-
"TOKEN_SECRET" => "@_leaf$0Secret!",
184+
'TOKEN_SECRET' => '@_leaf$0Secret!',
178185

179186
/*
180187
|--------------------------------------------------------------------------
@@ -184,5 +191,5 @@
184191
| How long should JWT be valid for?
185192
|
186193
*/
187-
"TOKEN_LIFETIME" => 60 * 60 * 24 * 365
194+
'TOKEN_LIFETIME' => 60 * 60 * 24 * 365
188195
];

0 commit comments

Comments
 (0)