Giter VIP home page Giter VIP logo

sanctum-tokens's People

Contributors

alancolant avatar anibalsanchez avatar chrisbjr avatar craftyshaun avatar dependabot[bot] avatar jeffbeltran avatar mn-martin avatar ryanmitchell avatar semantic-release-bot avatar theofanisv avatar tpetry avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

sanctum-tokens's Issues

Optional/Default Abilities Field

Hello Jeff,
Your package is great.
I would like to ask you if you can make the Abilities field on the creation form hidden and maybe with default value.
Thank you for your work,
Theofanis

Tokens list not displayed

Hi! thanks in advance for this cool package and for the hard work.

I've trying to use it but seems like its having some issues:

Once i'm on the User resource and after inserting
SanctumTokens::make()

When i'm on the detail page and after creating a token, nothing gets displayed while i get a js error on the console:
TypeError: Cannot read properties of undefined (reading 'length') even when the token has been successfully created.

I'm on Laravel 8, Laravel Nova 4 and latest sanctum-tokens.

Looking forward to hear from you! Thanks again.

image

Translation files location

With Laravel 9, translation files are now by default located outside of the resources directory, directly under the project root folder.

If we move the published translation file to that location, then the strings do not appear translated.

Additionally, it would be nice to publish the translation file there instead of resources/lang.

Incompatible with Nova 3.22

Hi,

Thanks for the package.
I get TypeError: Cannot read property 'options' of undefined when I click on Create token in Nova.

I also use Eminiarts/Tabs if that can help.

Please advise. Thanks

Empty Token Name

Hi,

The token name is required, but the dialogue allows to enter the empty name.

When you enter the empty value:

Argument 1 passed to ...Models\\User::createToken() must be of the type string, null given, called in /app/vendor/jeffbeltran/sanctum-tokens/src/Http/SanctumController.php on line 27

A simple workaround is re-defining the createToken as:

    /**
     * Create a new personal access token for the user.
     *
     * @param  string  $name
     * @param  array  $abilities
     * @return \Laravel\Sanctum\NewAccessToken
     */
    public function createToken_d(?string $name = null, array $abilities = ['*'])
    {
        if (!$name) {
            $name = '- Empty Name -';
        }

        $token = $this->tokens()->create([
            'name' => $name,
            'token' => hash('sha256', $plainTextToken = Str::random(40)),
            'abilities' => $abilities,
        ]);

        return new NewAccessToken($token, $token->getKey().'|'.$plainTextToken);
    }

Configuration for changing the User model

Currently the package assumes App\User is the user entity, breaking when we customize such class or namespace.

Would be great to be able to customize this through configuration.

Currently there is a "hacky" workaround though, in case it helps someone:

image

No Policy or Gate for authorizing who can create/revoke tokens?

Hi this seems a cool little package and could be just what I need, but I am concerned that there seems to be no authorisation in place to control who can create (or indeed revoke) a token.

It looks like with a bit of messing around with the HTTP request in Nova any user could create or revoke a token for any other user.

Have I got this wrong?

Fixed list of authorisations

It would be great to have an option to only allow the ui to tick from a fixed list of authorisations/privileges rathe than a free type field.

it could be an optional method so the default behaviour stays as is.

would you be interested in this?

Edit Abilities

Is it possible to edit abilities after creating a token?

Adding suggestion to abilities

Hey
It will be nice to have a the nova suggestion option on the tool.
This will be handy when you have a lot of abilities to choose from. The suggestion() method leverage the native html datalist element to provide a recommended options available to choose.
Thanks for your help here and for the great package.

Hide logintoken

On Laravel Nova user resource we also see login tonkes that are generated on user login.

Is there a way to hide that? We would only like user to see tokens manually added by him.

Add internationalization

Hi Jeff!

I'm Enrique and currently I'm using your package and it's very useful, thanks!. However it's necessary to be able to change language of all texts. There are some components that has hardcoded text:

hardcoded-text

So I would like to know if you can make a feature to add the internationalization?.

Thanks for your help!. I'll be waiting for your answer.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.