-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Delta-97 > Adjustments needed for login (#10)
- Added support for args in $t filter - Added jwt plugin - Adjusted google api plugin Approved by: - @cedricabuso <[email protected]> - @wilbertverayin <[email protected]>
- Loading branch information
Ferriel Melarpis
authored
Feb 6, 2018
1 parent
95f61de
commit 5c54c12
Showing
14 changed files
with
227 additions
and
110 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,5 +4,9 @@ export default { | |
scope: [ | ||
'email', | ||
'profile', | ||
], | ||
].join(' '), | ||
libraries: [ | ||
'client', | ||
'auth2' | ||
].join(':'), | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,7 @@ | ||
export default { | ||
server: { | ||
baseURL: '', | ||
} | ||
}, | ||
|
||
ACCESS_TOKEN_KEY: '', | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
import jwt from 'jsonwebtoken'; | ||
import { LocalStorage } from 'quasar'; | ||
|
||
|
||
export default class JWT { | ||
|
||
constructor(key) { | ||
this.key = key; | ||
} | ||
|
||
hasToken() { | ||
return LocalStorage.has(this.key); | ||
} | ||
|
||
getToken() { | ||
return LocalStorage.get.item(this.key); | ||
} | ||
|
||
setToken(token) { | ||
LocalStorage.set(this.key, token); | ||
return this; | ||
} | ||
|
||
removeToken() { | ||
LocalStorage.remove(this.key); | ||
return this; | ||
} | ||
|
||
decode() { | ||
return jwt.decode(this.getToken(), { | ||
complete: true, | ||
force: true | ||
}); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
import JWT from 'src/helpers/jwt'; | ||
|
||
import config from 'config'; | ||
|
||
/** | ||
* Plugin for injecting axios globally as default $http resource | ||
* @example | ||
* import JWTPlugin from 'src/plugins/jwt'; | ||
* ... | ||
* Vue.use(JWTPlugin); | ||
* @example | ||
* // In a component you can use it like: | ||
* this.$jwt.decode(...); | ||
* Vue.jwt.decode(...); | ||
*/ | ||
const JWTPlugin = { | ||
install(Vue) { | ||
|
||
const jwt = new JWT(config.ACCESS_TOKEN_KEY); | ||
|
||
Vue.jwt = jwt; | ||
|
||
Object.defineProperties(Vue.prototype, { | ||
$jwt: { | ||
get() { | ||
return jwt; | ||
} | ||
} | ||
}); | ||
} | ||
}; | ||
|
||
if (typeof window !== 'undefined' && window.Vue) { | ||
window.Vue.use(JWTPlugin); | ||
} | ||
|
||
export default JWTPlugin; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.