Comments (5)
Where is that "authenticated" parameter coming from?
On Sat, Aug 20, 2016 at 2:10 PM, FerchoCarcho [email protected]
wrote:
Hello! @websanova https://github.com/websanova Thank you for the Plugin.
I know it is asking too much, but your plugin is so good, it would be very
helpfull If you could make a demo page for making it work !
I landed to your github account because Im having an Issue with my
authenticated user trying to reach the /register page or /login page when
he/she is already In. The strange situation is
the this.$root.authenticated tell me false even it is set to True look at
this image.
[image: untitled-1]
https://cloud.githubusercontent.com/assets/11180135/17832972/9d8d18ac-66df-11e6-9859-4551d406e05c.jpg—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
#12, or mute the thread
https://github.com/notifications/unsubscribe-auth/ABkcyz81uVQmULF-3_oNXFLIZTRJuIh-ks5qh0MTgaJpZM4JpIVU
.
from vue-auth.
Hello @websanova It is comming from :
Every route which will be transitioned to auth:true is verified with
router.beforeEach(function (transition) {
var token = localStorage.getItem('jwt-token')
if (transition.to.auth) {
if (!token || token === null) {
console.log('redirecting to Login');
transition.redirect('/login')
}
}
transition.next()
});
When the user reaches login, sets its credentials, then
ready: function () {
var token = localStorage.getItem('jwt-token')
if (token !== null && token !== 'undefined') {
var that = this
client({ path: 'try/users/me' }).then(
function (response) {
that.setLogin(response.entity);
that.$broadcast('data-loaded')
},
} )
},
a this.authenticated Variable is set at the root component to let know the user is already login saying that logged in wants to go to /register or /login this variable will be checked to redirect to other place.
methods: {
setLogin: function (user) {
this.user = user;
this.authenticated = true;
this.token = localStorage.getItem('jwt-token')
},
from vue-auth.
at the register.vue child component I have the following to verify the this.$root.authenticated variable
but it is giving me False even when at the vue devtools or $data |json
shows it is set to true.
module.exports = {
route: {
activate: function (transition) {
console.log(this.$root.authenticated,'$root.authenticated');
console.log(this.$root.$data.authenticated,'$root.$data.authenticated')
as the image above states
from vue-auth.
That variable is stored in the user object. You can just use
$auth.check()
in your code. Bad idea to use variables directly, could
easily change in future versions.
On Aug 20, 2016 14:42, "FerchoCarcho" [email protected] wrote:
at the register.vue child component I have the following to verify the
this.$root.authenticated variable
but it is giving me False even when at the vue devtools or $data |jsonshows
it is set to true.module.exports = {
route: {
activate: function (transition) {
console.log(this.$root.authenticated,'$root.authenticated');
console.log(this.$root.$data.authenticated,'$root.$data.authenticated')—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
#12 (comment),
or mute the thread
https://github.com/notifications/unsubscribe-auth/ABkcy1bOd6EB0xWSDgRCVKeYJweqHrRFks5qh0qYgaJpZM4JpIVU
.
from vue-auth.
I'm willing to refactor my code with your plugin, because as I saw yours is the logic I would like to have on my website.
Because of that I was asking for a Demo. It would be very useful to other users too.
from vue-auth.
Related Issues (20)
- Built in cookie store broken in latest version? HOT 4
- Vue 3 Typescript not working, types missing HOT 1
- Integrate vue-auth with Keycloak HOT 1
- [Question] Authenticating users from external apps HOT 2
- How to set token expiration as refreshData interval HOT 1
- Vue3 Demo - Could not resolve dependency vue@"^3.2.0" from [email protected] HOT 2
- Handling MFA HOT 1
- Support pinia for vue 3 HOT 8
- How to extend Auth using v3 createAuth HOT 4
- This package is not working on VUE 3 + Vite
- token doesn't persist, suggested behavior vs Oauth 2.0 RFC spec? HOT 2
- Vue-Auth and Pinia HOT 10
- Vue 3 rolesKey option not supporting dot notation HOT 3
- redirect to page if i get 503 error HOT 2
- Storing multiple user credentials HOT 1
- Handling multiple roles from different keys HOT 2
- Redirect : Erreur 401 on apache server and not a local wamp HOT 4
- Package not working with Vue.js 3.3 and Vite HOT 1
- Missing Typescript definition for named route params
- Logout request executes after auth reset
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from vue-auth.