Enhance JWT Token Management and Authentication Flow (#720)
- Implement extended token lifetime for "Remember Me" functionality - Add token expiration details to authentication responses - Update client-side token handling to support dynamic expiration - Modify authentication middleware to handle token initialization more robustly - Configure JWT configuration to support longer token lifetimes
This commit is contained in:
@@ -141,10 +141,10 @@ export default {
|
||||
// Submit the form.
|
||||
this.loading = true
|
||||
this.form
|
||||
.post("login")
|
||||
.post("login", { data: { remember: this.remember } })
|
||||
.then(async (data) => {
|
||||
// Save the token.
|
||||
this.authStore.setToken(data.token)
|
||||
// Save the token with its expiration time
|
||||
this.authStore.setToken(data.token, data.expires_in)
|
||||
|
||||
const [userDataResponse, workspacesResponse] = await Promise.all([
|
||||
opnFetch("user"),
|
||||
|
||||
@@ -244,10 +244,10 @@ export default {
|
||||
}
|
||||
|
||||
// Log in the user.
|
||||
const tokenData = await this.form.post("/login")
|
||||
const tokenData = await this.form.post("/login", { data: { remember: true } })
|
||||
|
||||
// Save the token.
|
||||
this.authStore.setToken(tokenData.token)
|
||||
// Save the token with its expiration time.
|
||||
this.authStore.setToken(tokenData.token, tokenData.expires_in)
|
||||
|
||||
const userData = await opnFetch("user")
|
||||
this.authStore.setUser(userData)
|
||||
|
||||
Reference in New Issue
Block a user