Access direct URL after compiled

Asked

Viewed 14 times

-1

Often there is a need to access a direct URL on a system, for example, www.site.com/registration, www.site.com/forgot password, those things

In the meantime, I’m using Vue.js with the Vuetify framework.

What I want is to make the system access the initial url only with token I sent to the user email

inserir a descrição da imagem aqui

By clicking the button Click Here i send to the source host where the request came from (http://localhost:8080, http://localhost (after compiled), or www.site.com.br)

Getting kind of like this:

http://localhost:8080/eyJpZFVzdWFyaW8iOjUsIm5vbWUiOiJD....

When accessing the url I go to this screen

inserir a descrição da imagem aqui

I did this by checking the initial route file

const routes = [
  

    {
        path: '/',
            name: 'login',
            component: Login,
            meta: {
                allowAnonymous: true
            }
      },

I used these functions in the archive Login. within the methods:

    verificarParametro(){
                    
      const {token} = this.$route.params
      if( token ){
                        
            if( token != 'config-senha' ){
                if( this.tokenEhValido(token) ){
                    localStorage.setItem('tokenUpdateSenha',token )                         
                    this.irPara('config-senha')
                }else{
                    this.irPara(token)
                            }
                }else{
                            
                   const tokenSaldo = localStorage.getItem('tokenUpdateSenha')
                   if( !this.tokenEhValido(tokenSaldo) ){
                        this.irPara(token)
                   }else{
                                
                }
           }
    }
  },
  irPara(rota){
        this.$router.push({name: rota})
   },
  tokenEhValido(token){
    const tokenLocal = token
    try {
        const tokenB64 = Buffer.from(tokenLocal, 'base64').toString()
        JSON.parse( tokenB64 )
        return true
    } catch (error) {
       return false
     }
},

The route of what I have configuring for this token is this

{
    path: '/:token',
        name: 'login-param',
        component: Login,
        meta: {
            allowAnonymous: true
        }
  },

But after compiled the project and tested

I have the following problem when trying to access the URL to change the password

inserir a descrição da imagem aqui

Where can I be missing?

My . htaccess is like this

<IfModule mod_rewrite.c>
  RewriteEngine On
  RewriteBase /
  RewriteRule ^index\.html$ - [L]
  RewriteCond %{REQUEST_FILENAME} !-f
  RewriteCond %{REQUEST_FILENAME} !-d
  RewriteRule . /index.html [L]
</IfModule>
No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.