GithubHelp home page GithubHelp logo

clarkeash / doorman Goto Github PK

View Code? Open in Web Editor NEW
1.0K 17.0 45.0 276 KB

Limit access to your Laravel applications by using invite codes

Home Page: https://packagist.org/packages/clarkeash/doorman

License: MIT License

PHP 100.00%
php laravel laravel-package doorman invite

doorman's Introduction

Hi there ๐Ÿ‘‹

  • ๐Ÿ’ผ Iโ€™m currently working at Intergral
  • ๐ŸŒฑ Iโ€™m currently learning Tailwind CSS
  • ๐Ÿ’ฌ Ask me about PHP & Laravel
  • ๐Ÿ“ซ How to reach me: [email protected] or on twitter
  • ๐Ÿ˜„ Pronouns: He/Him
  • โšก Fun fact: My favourite fruit is pineapple ๐Ÿ

doorman's People

Contributors

amphetkid avatar clarkeash avatar consoletvs avatar dependabot[bot] avatar dhassanali avatar lucasdcrk avatar m1guelpf avatar mikemand avatar samuelnitsche avatar scrutinizer-auto-fixer avatar vmiguellima 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  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  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

doorman's Issues

Bounced Email

Is there a way to show the email bounced via Doorman? Or would I need to load this data from our third party email provider Sendgrid? Two, I removed the invite and re-added it again with same email address once the email address was actually added and working. But then no email was sent at all. How to solve that issue?

is it possible to create non invite login alongside Doorman?

is it possible to create non invite login alongside Doorman?
basically i'm using doorman and user can only register to site using invite code supplied but i want user to be able to register without code also if they have no invite to use other features available on site is this possible with Doorman

Invite codes for models

Hi,
Instead of requiring invite codes to register on my website, I'm wanting to allow users to invite users to "access" a particular model.

For example, I have User 1, who "owns" a group model on the site.
User 1 wants some members in their group, so they send an invite to [email protected], so that user can then use the invite to join the group.

Would this library work with the idea of having an invite linked to an eloquent model, rather than the site registration form? I'm not expecting it to add them to the group, just the validation side of things to ensure that the invite is valid for the group.

Helping?

Hi!
I'd like to help, but I can't find any open issues...
What needs to be done?
I've opened two pull requests (#6) and (#7) and an issue (#8).

Laravel 6.0 compatibility

I can't install the packge on Laravel 6.0:

Your requirements could not be resolved to an installable set of packages.

  Problem 1
    - Conclusion: remove clarkeash/doorman v3.0.0
    - Conclusion: don't install laravel/framework v6.0.0
    - Installation request for clarkeash/doorman ^3.0 -> satisfiable by clarkeash/doorman[v3.0.0].
    - Conclusion: don't install laravel/framework 6.x-dev
    - clarkeash/doorman v3.0.0 requires laravel/framework ^5.6 -> satisfiable by laravel/framework[5.6.x-dev, 5.7.x-dev, 5.8.x-dev].
    - Can only install one of: laravel/framework[6.0.x-dev, 5.6.x-dev].
    - Can only install one of: laravel/framework[6.0.x-dev, 5.7.x-dev].
    - Can only install one of: laravel/framework[6.0.x-dev, 5.8.x-dev].
    - Installation request for laravel/framework ^6.0 -> satisfiable by laravel/framework[6.0.x-dev, 6.x-dev, v6.0.0].

Validation rule

It'd be cool to have a Laravel validation rule to check invites.

check invite code without email

I have generated an invite code for an email. Now I just want that if a givven invite code is available( is not expired, is not used yet, etc.) without passing the associated email.
Is there any method for doing so?
The purpose behind this is that I email invite codes generated for that email so asking for email is redundant.
Also, I want to find associated email instead of asking them.
The question is how to validate invite codes without passing email address?

Cleanup Command

Add an artisan command to remove expired invites from the database. I can do it if you want.

better code creation

Right now the code generator just uses Str::random(5) so there is a big chance of duplication

A lot of threads around the web about randomness also this one for laravel laravel/ideas#161

I think a good compromise would be to extract the code generator process into its own class, and give the user an option to override code generator, so if someone is looking for some more secure way can easily use something like uniqueid or some uuid library and add some more options like checking for existence (there is no simple way of generating random string in multiple machines and to make sure there is no duplication without checking the db first)

Non-static Method on generate()

I'm using Laravel 5.8, and have installed Doorman 3.0 as per the documentation.

When I attempt to generate an invite code using Doorman::generate()->for($request->email)->make();
I get an error stating Non-static method Clarkeash\Doorman\Doorman::generate() should not be called statically. Upon checking the class, the generate method is indeed not static.

Are there any suggestions on a fix for this?

Redeem and return redeemed invite

I have implemented my own Driver and Invite class which are working well.

In my use case I would like to get the Invite instance after Doorman::redeem. Is there an easy way to get this working without me implementing my own Doorman class as well?

Case sensitivity problem

My invite codes are always returning as invalid, I think this is due to when the code is being generated, it is mixed case and when it is check it is forced to be uppercase.

Generation
Saving
Validation

All I'm using is the built in form validation and the basic driver from doorman.

Reedem without exceptions

It would be cool to have a reedem-like exception, but that returns true or false instead of throwing exceptions. I've had a look at the code, and it'd be easy to implement, but I couldn't come up with a namefor the function ๐Ÿคฃ

publish prefixes

What's the reason for not prefixing the assets?

doorman-config would be much clearer.

Screen Shot 2019-04-22 at 11 50 59 AM

post-autoload-dump event returned with error code 1

Hi guys, i have this problem when i execute composer require clarkeash/doorman and when use php artisan clear :/, how fix this problem? my version of laravel is 7.13.0

composer require clarkeash/doorman       
Using version ^5.0 for clarkeash/doorman
./composer.json has been updated
Loading composer repositories with package information
Updating dependencies (including require-dev)
Package operations: 1 install, 0 updates, 0 removals
  - Installing clarkeash/doorman (v5.0.1): Downloading (100%)
Writing lock file
Generating optimized autoload files
> Illuminate\Foundation\ComposerScripts::postAutoloadDump
> @php artisan package:discover --ansi

   Error

  Class name must be a valid object or a string

  at C:\xampp\htdocs\giknomina\vendor\clarkeash\doorman\src\Providers\DoormanServiceProvider.php:46
    42|             'doorman'
    43|         );
    44|
    45|         $this->app->bind(BaseInvite::class, function($app) {
  > 46|             return new $app['config']['doorman.invite_model'];
    47|         });
    48|
    49|         $this->app->bind('doorman', Doorman::class);
    50|         $this->app->singleton(Doorman::class, Doorman::class);

  1   C:\xampp\htdocs\giknomina\vendor\laravel\framework\src\Illuminate\Container\Container.php:801
      Clarkeash\Doorman\Providers\DoormanServiceProvider::Clarkeash\Doorman\Providers\{closure}(Object(Illuminate\Foundation\Application), [])

  2   C:\xampp\htdocs\giknomina\vendor\laravel\framework\src\Illuminate\Container\Container.php:687
      Illuminate\Container\Container::build(Object(Closure))
Script @php artisan package:discover --ansi handling the post-autoload-dump event returned with error code 1

Installation failed, reverting ./composer.json to its original content.


Composer json
```js

 "require": {
        "php": "^7.2.5",
        "fideloper/proxy": "^4.2",
        "fruitcake/laravel-cors": "^2.0",
        "guzzlehttp/guzzle": "^6.3",
        "laravel/framework": "^7.0",
        "laravel/socialite": "^4.3",
        "laravel/tinker": "^2.0",
        "laravel/ui": "^2.0",
        "ramsey/uuid": "^3 || ^4"
    },
    "require-dev": {
        "facade/ignition": "^2.0",
        "fzaninotto/faker": "^1.9.1",
        "mockery/mockery": "^1.3.1",
        "nunomaduro/collision": "^4.1",
        "phpunit/phpunit": "^8.5"
    },
    "config": {
        "optimize-autoloader": true,
        "preferred-install": "dist",
        "sort-packages": true
    },
    "extra": {
        "laravel": {
            "dont-discover": []
        }
    },
    "autoload": {
        "psr-4": {
            "App\\": "app/"
        },
        "classmap": [
            "database/seeds",
            "database/factories"
        ]
    },
    "autoload-dev": {
        "psr-4": {
            "Tests\\": "tests/"
        }
    },
    "minimum-stability": "dev",
    "prefer-stable": true,
    "scripts": {
        "post-autoload-dump": [
            "Illuminate\\Foundation\\ComposerScripts::postAutoloadDump",
            "@php artisan package:discover --ansi"
        ],
        "post-root-package-install": [
            "@php -r \"file_exists('.env') || copy('.env.example', '.env');\""
        ],
        "post-create-project-cmd": [
            "@php artisan key:generate --ansi"
        ]
    }

How to send invite via Laravel Notifications

Hi,

I really like that packages, but I need some help.

When I generate a new invite code like so.

Doorman::generate()->for($request->email)->expiresIn(3)->make();

How can I send that code to the invited person ($request->email) via laravels notifications by mai?

Invite url clicked from email hits privacy error

For the first time in like error an invite link

http://url5220.site.com/ls/click?upn=kvKv-2FX7KJRO-2BuIGglPGWwYFfpq-2FfmWSsrf0-.......................

opened from webmail loads a Chrome error page:

Your connection is not private
Attackers might be trying to steal your information from url5220.site.com (for example, passwords, messages, or credit cards). [Learn more](chrome-error://chromewebdata/#)
NET::ERR_CERT_COMMON_NAME_INVALID

Screen Shot 2022-02-14 at 10 31 09 AM

checking the certificate I see it loads the SendGrid wildcard url and not our domain wildcard url under which this "temporary" subdomain is loading.

So either the subdomain should load under SendGrid or the subdomain link is fine but it is trying to grab the wrong SSL certificate.

This could very well be an issue in our setup. Just odd it pops up now after like 2 years and wondering if anyone else has dealt with this issue.

Can this work on one view?

Im looking to restrict registration to only users with invite codes is it possible to achieve this with Doorman? or is this really to restrict whole application?

make() not to return a collection for 1 code

Howdy,

Would you consider having make() not return a collection when only 1 code is created?

IE: It would be nice to be able to use ...->make()->code directly, instead of having to go ->make()->first()->code especially when only code will be made (for an email address for example).

PHP8 and composer V2

Good day sir and thank you very much for this nice package!

Today i was trying to upgrade a project to PHP8.

Composer (V2) complains:

clarkeash/doorman v6.0.0 requires php ^7.3 -> your php version (8.0.0) does not satisfy that requirement.

What can i do?

Thanks in advance!

Remove Invitations

We are using Doorman and it has been great. Only issue is that we sometimes want to remove the invitation and email address attached so we can re-use that email address. How could we do this the best way?

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.