Confide is a authentication solution for Laravel 4

Overview

Confide (A Laravel4 Package)

Confide Poster

Build Status Coverage Status Scrutinizer Code Quality ProjectStatus Latest Stable Version Total Downloads License

SensioLabsInsight

Confide is an authentication solution for Laravel made to cut repetitive work involving the management of users. A DRY approach on features like account creation, login, logout, confirmation by e-mail, password reset, etc.

Confide aims to be simple to use, quick to configure and flexible.

Note: If you are using MongoDB check Confide Mongo.

Features

Current:

  • Account confirmation (through confirmation link).
  • Password reset (sending email with a change password link).
  • Easily render forms for login, signup and password reset.
  • Generate routes for login, signup, password reset, confirmation, etc.
  • Generate a customizable controller that handles the basic user account actions.
  • Contains a set of methods to help with basic user features.
  • Integrated with the Laravel Auth and Reminders component/configs.
  • User validation.
  • Login throttling.
  • Redirecting to previous route after authentication.
  • Checks for unique email and username in signup

If you are looking for user roles and permissions see Entrust

For MongoDB support see Confide Mongo

Warning: By default a confirmation email is sent and users are required to confirm the email address. It is easy to change this in the confide config file. Change signup_email and signup_confirm to false if you do not want to send them an email and they do not need to be confirmed to be able to login to the website.

Quick start

Required setup

In the require key of composer.json file add the following

"zizaco/confide": "~4.3@dev"

Run the Composer update comand

$ composer update

In your config/app.php add 'Zizaco\Confide\ServiceProvider' to the end of the providers array

'providers' => array(

    'Illuminate\Foundation\Providers\ArtisanServiceProvider',
    'Illuminate\Auth\AuthServiceProvider',
    ...
    'Zizaco\Confide\ServiceProvider',

),

At the end of config/app.php add 'Confide' => 'Zizaco\Confide\Facade' to the aliases array

'aliases' => array(

    'App'        => 'Illuminate\Support\Facades\App',
    'Artisan'    => 'Illuminate\Support\Facades\Artisan',
    ...
    'Confide'    => 'Zizaco\Confide\Facade',

),

Configuration

Set the properly values to the config/auth.php. This values will be used by confide to generate the database migration and to generate controllers and routes.

Set the address and name from the from array in config/mail.php. Those will be used to send account confirmation and password reset emails to the users.

User model

Now generate the Confide migration and the reminder password table migration:

$ php artisan confide:migration

It will generate the <timestamp>_confide_setup_users_table.php migration. You may now run it with the artisan migrate command:

$ php artisan migrate

It will setup a table containing email, password, remember_token, confirmation_code and confirmed columns, which are the default fields needed for Confide use. Feel free to add more columns to the table later.

Change your User model in app/models/User.php to:

<?php

use Zizaco\Confide\ConfideUser;
use Zizaco\Confide\ConfideUserInterface;

class User extends Eloquent implements ConfideUserInterface
{
    use ConfideUser;
}

ConfideUser trait will take care of some behaviors of the user model.

Dump the default accessors

Lastly, you can dump a default controller, repository and the default routes for Confide.

$ php artisan confide:controller
$ php artisan confide:routes

Don't forget to dump composer autoload

$ composer dump-autoload

And you are ready to go. Access http://yourapp/users/create to create your first user. Check the app/routes.php to see the available routes. You may need to confirm a newly created user (by "reaching" its confirm() method), otherwise you can disable the confirmation as a requirement to login in in the config file (see bellow).

Usage in detail

Basic setup:

  1. Database connection in config/database.php running properly.
  2. Correct model and table names in config/auth.php. They will be used by Confide all the time (specially when generating migrations and controllers).
  3. from configuration in config/mail.php.

Configuration:

  1. 'Zizaco\Confide\ServiceProvider' and 'Confide' => 'Zizaco\Confide\Facade' entry in config/app.php 'providers' and 'aliases' respectively.
  2. User model (with the same name as in config/auth.php) should implement Zizaco\Confide\ConfideUserInterface interface. This will cause to methods like forgotPassword() and confirm() to be available.

Optional steps:

  1. Optionally you can use the trait Zizaco\Confide\ConfideUser in your user model. This will save a lot of time and will use "confide's default" implementation for the user. If you wish more customization you can write your own code.
  2. Use Confide facade to dump login and signup forms easly with makeLoginForm() and makeSignupForm(). You can render the forms within your views by doing {{ Confide::makeLoginForm()->render() }}.
  3. Generate a controller and a repository with the template contained in Confide throught the artisan command $ php artisan confide:controller. If a controller with the same name exists it will NOT be overwritten.
  4. Generate routes matching the controller template throught the artisan command $ php artisan confide:routes. Don't worry, your routes.php will NOT be overwritten.

Advanced

The UserRepository class

You may have noticed that when generating the controller a UserRepository class has also been created. This class contains some code that doesn't belong to the "controller" purpose and will make your users controller a cleaner and more testable class. If you still have no idea why that class exists I recommend you to google "Creating flexible Controllers in Laravel 4 using Repositories". (wink)

Using custom class, table or model name

You can change the model name that will be considered the user in the config/auth.php file. Confide uses the values present in that configuration file.

To change the controller name when dumping the default controller template you can use the --name option.

$ php artisan confide:controller --name=Employee

Will result in EmployeeController

Then, when dumping the routes, you should use the --controller option to match the existing controller.

$ php artisan confide:routes --controller=Employee

You can also generate controllers with namespace

$ php artisan confide:controller --name=MyProject\\Auth\\User

Warning: In bash, you will need to use double '\\' backslashes. This will result in MyProject\Auth\UserController. Also the generated file will be inside a directory equivalent to the namespace. (wink)

Using custom form or emails

First, publish the config files:

$ php artisan config:publish zizaco/confide

Then edit the view names in app/config/packages/zizaco/confide/config.php.

Seeding

To seed your users table you should fill also the password_confirmation and confirmation_code fields. For example:

class UsersTableSeeder extends Seeder {

    public function run()
    {
        $user = new User;
        $user->email = '[email protected]';
        $user->password = 'foo_bar_1234';
        $user->password_confirmation = 'foo_bar_1234';
        $user->confirmation_code = md5(uniqid(mt_rand(), true));
        $user->confirmed = 1;

        if(! $user->save()) {
            Log::info('Unable to create user '.$user->email, (array)$user->errors());
        } else {
            Log::info('Created user '.$user->email);
        }
    }
}

Custom user validation

You can implement your own validator by creating a class that implements the UserValidatorInterface and registering that class as "confide.user_validator".

For example, create your custom validator class:

// app/models/MyOwnValidator.php
class MyOwnValidator implements UserValidatorInterface
{

    public function validate(ConfideUserInterface $user)
    {
        unset($user->password_confirmation);
        return true; // If the user valid
    }
}

Then register it in IoC container as "confide.user_validator"

// app/start/global.php
//...
App::bind('confide.user_validator', 'MyOwnValidator');

Also, don't forget that your validator should unset the 'password_confirmation' attribute of the user before saving it.

Passing additional information to the "make" methods

If you want to pass additional parameters to the forms being rendered, you can use an alternate syntax to achieve this.

Instead of using the make method:

Confide::makeResetPasswordForm($token):

You would use:

View::make(Config::get('confide::reset_password_form'))
    ->with('token', $token);

It produces the same output, but you would be able to add more inputs using 'with' just like any other view.

RESTful controller

If you want to generate a RESTful controller you can use the aditional --restful or -r option.

$ php artisan confide:controller --restful

Will result in a RESTful controller

Then, when dumping the routes, you should use the --restful option to match the existing controller.

$ php artisan confide:routes --restful

User roles and permissions

In order not to bloat Confide with not related features, the role and permission was developed as another package: Entrust. Enstrust couples very well with Confide.

See Entrust

Redirecting to previous route after login

When defining your filter you should use the Redirect::guest('users/login') within your auth filter. For example:

// filters.php

Route::filter('auth', function () {
    // If the user is not logged in
    if (Auth::guest()) {
        return Redirect::guest('users/login');
    }
});

// Only authenticated users will be able to access routes that begins with
// 'admin'. Ex: 'admin/posts', 'admin/categories'.
Route::when('admin*', 'auth');

or, if you are using Entrust ;)

// filters.php

Entrust::routeNeedsRole('admin*', 'Admin', function () {
    return Redirect::guest('users/login');
});

Finally, it'll auto redirect if your controller's users/login function uses Redirect:intended('a/default/url/here') after a successful login. The generated controller does exactly this.

Troubleshooting

[2014-07-18 01:13:15] production.ERROR: exception 'Illuminate\Database\QueryException' with message 'SQLSTATE[42S22]: Column not found: 1054 Unknown column 'password_confirmation' in 'field list' (SQL: insert into `users` ...

The password_confirmation attribute should be removed from the object before being sent to the database. Make sure your user model implement the ConfideUserInterface and that it use the ConfideUser trait as described above. Otherwise if you are using a custom validator, you will have to unset password_confirmation before saving the user.

I need my users to have an "username"

Use the --username option when generating the confide migration and the controller.

$ php artisan confide:migration --username
...
$ php artisan confide:controller --username

If you want to make the username a required field you will have to extend the UserValidator and overwrite the $rules attribute making the "username" required.

I receive a "Your account may not be confirmed" when trying to login

You need to confirm a newly created user (by "reaching" its confirm() method), otherwise you can disable the confirmation as a requirement to login in in the config file (see bellow). You can easly confirm an user manually using Laravel's artisan tinker tool.

I'm not able to generate a controller with namespaces

In bash, you will need to use double '\\' backslashes. Also the generated file will be inside a directory equivalent to the namespace:

$ php artisan confide:controller --name=MyProject\\Auth\\User

Users are able to login without confirming account

If you want only confirmed users to login, in your UserController, instead of simply calling logAttempt( $input ), call logAttempt( $input, true ). The second parameter stands for "confirmed_only".

My application is crashing since I ran composer update

Confide 4.0.0 was a huge update where all the codebase has been rewritten. Some classes changed, the generators has been improved in order to match some better practices (like repositories and separated validator classes). See the Release Notes bellow.

If you have a legacy project that uses an older version of Confide, don't worry. You will be always able to specify a previous version in your composer.json file.

For example: "zizaco/confide": "~3.2" will avoid composer download version 4.0 but will be able to download bugfixes of version 3.2.

Release Notes

Version 4.3.0 Beta 1

  • Username is now an optional field. Use --username when generating the migrations and the controllers.
  • General Bugfixes.

Version 4.2.0

  • General Bugfixes.
  • Improved README.md.
  • Improved existing translations and added new ones.

Version 4.0.0 RC

  • General Bugfixes.
  • Improved README.md.
  • Confide can use queues for sending email.
  • Account confirmation tokens are not time-based anymore.

Version 4.0.0 Beta 3

  • Now you can customize how long will take for a password reset request to expire (default to 7 hours).
  • Reordered validations
  • Now all validations are called even if one of them fails. So all validation messages are sent at once.
  • validateIsUnique method now sends key to attachErrorMsg and also check for errors on each $identity field at once

Version 4.0.0 Beta 2

  • UserValidator now adds errors to an existing MessageBag instead of replacing it.
  • Password reset token will expire after 7 days.
  • Added support for custom connections using the $connection attribute of the model.
  • Password reset requests are deleted after being used.

Version 4.0.0 Beta 1

  • Dropped Ardent dependency.
  • Updated to support Laravel 4.2
  • Dropped support for PHP 5.3
  • ConfideUser is going to be a trait+interface from now on.
  • Controller generation now also generates an UserRepository class.
  • Removed deprecated variables, functions and classes.
  • All the codebase has been rewritten.

Upgrade note: A partial update from previous versions is not recommended. In order to upgrade from v3.* to v4.0.0 the best approach is to update the class names in the providers and aliases array, re-generate the user table with the new migration, re-write the "user" class and finally re-generate the controllers. It's very likely any customization made in your codebase will be affected.

Version 3.0.0

Updated to support Laravel 4.1

Version 2.0.0 Beta 4

Removed deprecated variable and functions.

  • $updateRules
  • amend()
  • generateUuid
  • getUpdateRules
  • prepareRules
  • getRules
  • setUpdateRules
  • getUserFromCredsIdentity
  • checkUserExists
  • isConfirmed

Adds two config values

  • login_cache_field (#161)
  • throttle_time_period (#162)

Version 2.0.0 Beta 3

Readme Update

Version 2.0.0 Beta 2

Pulls in a few pull requests and also locks to Ardent 2.1.x

  • Properly handles validation messaging (#124)
  • Properly validates in real_save (#110)
  • Auth redirect is handled using Redirect::guest instead of a custom session variable (#145)
  • Bruteforce vulnerability is addressed. (#151)

Version 2.0.0 Beta 2

Locked to Ardent 1.1.x

Version 1.1.0

Contributing

Feel free to fork this project on GitHub

Coding Standards

When contibuting code to confide, you must follow its coding standards. Confide follows the standard defined in the PSR-2 document.

Documentation

  • Add PHPDoc blocks for all classes, methods, and functions
  • Omit the @return tag if the method does not return anything
  • Add a blank line before @param, @return and @throws

License

Confide is free software distributed under the terms of the MIT license

Aditional information

Any questions, feel free to contact me or ask here

Any issues, please report here

Comments
  • Make

    Make "username" truly optional

    After reviewing the functionality for Confide (with Entrust) and Sentry, I have decided to implement Confide in my application. However, I have been having issues getting it working properly.

    I have absolutely no need for the "username" field in my application. Users will log in with their email addresses and first & last name fields will be used for personalization. Thus, I have not included the "username" column in my users table.

    My first issue was encountered while attempting to create a user account. The Zizaco\Confide\UserValidator::validateIsUnique() function is setting the $identity array with BOTH email and username. This was causing an "undefined index : 'username"" error when the Zizaco\Confide\EloquentRepository::getUserByIdentity() function is called.

    I got around this by creating my own custom validation class that extends the UserValidator class and replaces the validateIsUnique() function so that it only sets 'email' in the $identity array (in addition to updating the $rules array to match my fields).

    My next issue ... one that I can't get around ... is the log in functionality.

    In my UserRepository class, my login() function is calling Confide::logAttempt($input, Config::get('confide::signup_confirm')).

    Zizaco\Confide\Confide::logAttempt() eventually calls Zizaco\Confide\EloquentRepository::getUserByEmailOrUsername(), which sets BOTH email and username in the $identity array, and thus causes the "undefined index: 'username'" error again once the Zizaco\Confide\EloquentRepository::getUserByIdentity() function is called.

    Why isn't there an optional parameter on the Zizaco\Confide\Confide::logAttempt() function where you can specify which field is the identity? I've seen mention of a 3rd parameter for this purpose in #32 & #34, but the code doesn't have that. And in #31 (from March 2013), Zizaco agreed with prabhakarbhat that "username" should be optional. So why is it still not optional in September 2014? Am I missing something somewhere?

    The ONLY way that I have been able to continue moving forward with the Confide integration in my app is by adding a "username" column to my users table. I feel like this is a hack and really don't want to add columns just for the sake of utilizing this package. And I REALLY want to use this package.

    Proposal: Accepted 
    opened by beckyresler 37
  • logout and login, makes Confide::user() returns null

    logout and login, makes Confide::user() returns null

    the session is database and the following code returns Confide::user() as null

    Confide::logAttempt(['email' => $user['email'], 'password' => $user['password']]); Confide::logout(); Confide::logAttempt(['email' => $user['email'], 'password' => $user['password']]); Confide::user(); //this returns null

    opened by hyusetiawan 34
  • Security Issue on Update?

    Security Issue on Update?

    Maybe I'm missing something here but removing 'unique' from email and username may be an issue in the updateRules for validation. Shouldn't we just be appending the exception id as noted in the Laravel docs?

    Doesn't this allow anyone to edit their email / username with an existing username or email in the system?

        /**
         * Ardent validation rules
         *
         * @var array
         */
        public static $rules = array(
            'username' => 'required|alpha_dash|unique:users',
            'email' => 'required|email|unique:users',
            'password' => 'required|between:4,11|confirmed',
            'password_confirmation' => 'between:4,11',
        );
    
        /**
         * Rules for when updating a user.
         *
         * @var array
         */
        protected $updateRules = array(
            'username' => 'required|alpha_dash',
            'email' => 'required|email',
            'password' => 'between:4,11|confirmed',
            'password_confirmation' => 'between:4,11',
        );
    
    opened by dolbex 32
  • Proposal: Make Confide rely on Eloquent instead of Ardent

    Proposal: Make Confide rely on Eloquent instead of Ardent

    To help keep Confide (and Entrust) more stable, why not modify it to use Eloquent directly? I know that Confide makes some use of the save hooks and validation, but wouldn't it be more ideal to use the most stable dependencies available?

    opened by travisolbrich 32
  • Confide 4.0

    Confide 4.0

    Confide 4.0

    This will be a huge update where all the codebase are going to be reviewed. Some methods may change, the generators are going to be improved in order to match some best practices out there (like repositories and separated validator classes). The 'laravelbook/ardent' dependency will be dropped.

    If you have a legacy project that uses Confide, don't worry. You will be always able to specify a previous version in your composer.json file ;)

    Improvement 
    opened by Zizaco 24
  • Update package for Laravel 4.1 support

    Update package for Laravel 4.1 support

    I tried to upgrade to Laravel 4.1 today and everything is fine except your package throws an error which says the following:

    Problem 1
        - zizaco/confide dev-master requires laravelbook/ardent 2.1.x -> satisfiable by laravelbook/ardent[v2.1.0].
        - Conclusion: don't install laravel/framework 4.1.x-dev
        - Conclusion: don't install laravel/framework v4.1.3
        - Installation request for zizaco/confide dev-master -> satisfiable by zizaco/confide[dev-master].
        - Conclusion: don't install laravel/framework v4.1.2
        - Conclusion: don't install laravel/framework v4.1.1
        - laravelbook/ardent v2.1.0 requires illuminate/support 4.0.x -> satisfiable by laravel/framework[4.0.x-dev, v4.0.0, v4.0.0-BETA2, v4.0.0-BETA3, v4.0.0-BETA4, v4.0.1, v4.0.10, v4.0.2, v4.0.3, v4.0.4, v4.0.5, v4.0.6, v4.0.7, v4.0.8, v4.0.9], illuminate/support[4.0.x-dev, v4.0.0, v4.0.0-BETA2, v4.0.0-BETA3, v4.0.0-BETA4, v4.0.1, v4.0.10, v4.0.2, v4.0.3, v4.0.4, v4.0.5, v4.0.6, v4.0.7, v4.0.8, v4.0.9].
        - Can only install one of: laravel/framework[v4.1.0, 4.0.x-dev].
        - Can only install one of: laravel/framework[v4.1.0, v4.0.0].
        - Can only install one of: laravel/framework[v4.1.0, v4.0.0-BETA2].
        - Can only install one of: laravel/framework[v4.1.0, v4.0.0-BETA3].
        - Can only install one of: laravel/framework[v4.1.0, v4.0.0-BETA4].
        - Can only install one of: laravel/framework[v4.1.0, v4.0.1].
        - Can only install one of: laravel/framework[v4.1.0, v4.0.10].
        - Can only install one of: laravel/framework[v4.1.0, v4.0.2].
        - Can only install one of: laravel/framework[v4.1.0, v4.0.3].
        - Can only install one of: laravel/framework[v4.1.0, v4.0.4].
        - Can only install one of: laravel/framework[v4.1.0, v4.0.5].
        - Can only install one of: laravel/framework[v4.1.0, v4.0.6].
        - Can only install one of: laravel/framework[v4.1.0, v4.0.7].
        - Can only install one of: laravel/framework[v4.1.0, v4.0.8].
        - Can only install one of: laravel/framework[v4.1.0, v4.0.9].
        - don't install illuminate/support 4.0.x-dev|don't install laravel/framework v4.1.0
        - don't install illuminate/support v4.0.0|don't install laravel/framework v4.1.0
        - don't install illuminate/support v4.0.0-BETA2|don't install laravel/framework v4.1.0
        - don't install illuminate/support v4.0.0-BETA3|don't install laravel/framework v4.1.0
        - don't install illuminate/support v4.0.0-BETA4|don't install laravel/framework v4.1.0
        - don't install illuminate/support v4.0.1|don't install laravel/framework v4.1.0
        - don't install illuminate/support v4.0.10|don't install laravel/framework v4.1.0
        - don't install illuminate/support v4.0.2|don't install laravel/framework v4.1.0
        - don't install illuminate/support v4.0.3|don't install laravel/framework v4.1.0
        - don't install illuminate/support v4.0.4|don't install laravel/framework v4.1.0
        - don't install illuminate/support v4.0.5|don't install laravel/framework v4.1.0
        - don't install illuminate/support v4.0.6|don't install laravel/framework v4.1.0
        - don't install illuminate/support v4.0.7|don't install laravel/framework v4.1.0
        - don't install illuminate/support v4.0.8|don't install laravel/framework v4.1.0
        - don't install illuminate/support v4.0.9|don't install laravel/framework v4.1.0
        - Installation request for laravel/framework 4.1.* -> satisfiable by laravel/framework[4.1.x-dev, v4.1.0, v4.1.1, v4.1.2, v4.1.3].
    

    The problem seems to be with laravelbook/ardent package. I checked with the package source and their dev copy has support for 4.1 however their stable tagged version is still not updated which your package seems to be using.

    Can you please update ?

    opened by irazasyed 22
  • Check for existing username or email

    Check for existing username or email

    It would be great if Confide would check for either an existing username or email so you don't end up with registration containing the same information.

    P.S. We're loving this extension. It's really helped us get up and going.

    Proposal: Accepted 
    opened by mccombs 19
  • Missing argument 1 for Zizaco\Confide\ConfideUser::beforeSave()

    Missing argument 1 for Zizaco\Confide\ConfideUser::beforeSave()

    Hi,

    I got this after a fresh install with custom views; while creating new user (UserController@store action). Gives error in both 5.3/5.4. Any idea?

    Missing argument 1 for Zizaco\Confide\ConfideUser::beforeSave(), called in /.../vendor/laravelbook/ardent/src/LaravelBook/Ardent/Ardent.php on line 228 and defined
    
    24. ErrorException
    …/­vendor/­zizaco/­confide/­src/­Zizaco/­Confide/­ConfideUser.php202
    23. Illuminate\Exception\Handler handleError
    …/­vendor/­zizaco/­confide/­src/­Zizaco/­Confide/­ConfideUser.php202
    22. Zizaco\Confide\ConfideUser beforeSave
    …/­vendor/­laravelbook/­ardent/­src/­LaravelBook/­Ardent/­Ardent.php228
    21. LaravelBook\Ardent\{closure}
    <#unknown>0
    20. call_user_func_array
    …/­bootstrap/­compiled.php5233
    19. Illuminate\Events\Dispatcher fire
    …/­bootstrap/­compiled.php5219
    18. Illuminate\Events\Dispatcher until
    …/­bootstrap/­compiled.php5739
    17. Illuminate\Database\Eloquent\Model fireModelEvent
    …/­bootstrap/­compiled.php5662
    16. Illuminate\Database\Eloquent\Model save
    …/­vendor/­laravelbook/­ardent/­src/­LaravelBook/­Ardent/­Ardent.php701
    15. LaravelBook\Ardent\Ardent performSave
    …/­vendor/­laravelbook/­ardent/­src/­LaravelBook/­Ardent/­Ardent.php575
    14. LaravelBook\Ardent\Ardent internalSave
    …/­vendor/­laravelbook/­ardent/­src/­LaravelBook/­Ardent/­Ardent.php599
    13. LaravelBook\Ardent\Ardent save
    …/­vendor/­zizaco/­confide/­src/­Zizaco/­Confide/­ConfideUser.php283
    12. Zizaco\Confide\ConfideUser real_save
    …/­vendor/­zizaco/­confide/­src/­Zizaco/­Confide/­ConfideUser.php181
    11. Zizaco\Confide\ConfideUser save
    …/­app/­controllers/­UserController.php37
    10. UserController store
    <#unknown>0
    ...
    

    Thanks.

    opened by sonereker 18
  • Password Reset not working

    Password Reset not working

    I'm not sure if this is related to L4 update today (because I didn't try it before today) but when I try and use the Forgot Password link it sends the email just fine but when I use the link that is emailed to me to reset the password there is a problem. It looks like the token isn't making it into the controller. Here is a screenie. screen shot 2013-05-28 at 3 00 45 pm

    Bug: Solved 
    opened by brandtam 16
  • Laravel 5 Compatibiity

    Laravel 5 Compatibiity

    Laravel 5 has a few breaking changes (namely RemindableInterface is replaced by Authenticable interface) and a new interface for the main Application. I've updated tests and code to match these two changes, as well as composer dependencies on just 5.x. I also added the last few tests needed to get full code coverage (though that may be more a byproduct of my futzing with everything else).

    opened by impleri 14
  • Cannot `update` user

    Cannot `update` user

    Having some problems using the "update" method when updating the current user's settings. Here's the code I'm using:

    $User = Auth::user();
    
    // Update our settings, bailing if validation fails.
    if ( ! $User->update(Input::only('first_name', 'last_name', 'contact_number')))
    {
        return Redirect::to('settings')->with('error', $User->errors()->first());
    }
    
    return Redirect::to('settings')->with('notice', Lang::get('settings.updated'));
    

    Each time, I'm getting this error.

    The username has already been taken.

    Only additional user attributes are being updated - the username, email and password are not being changed.

    Using updateUniques instead throws this error;

    The password must be between 4 - 11 characters.

    Regardless, I don't want to update the unique values, so I'm assuming this isn't the correct context to use that method.

    What am I doing wrong?

    opened by MatthewRuddy 14
  • laravel 5.1

    laravel 5.1

    I have been working wit laravel 5.1 and when I try to migrate the table in wamp server this error appears how to solve????? [Symfony\Component\Debug\Exception\FatalErrorException] syntax error, unexpected '.1' (T_DNUMBER), expecting '{'

    opened by Shara96 0
  • Warning: Ambiguous class resolution,

    Warning: Ambiguous class resolution, "ConfideSetupUsersTable"

    Every time I run composer dumpautoload I get the following warning

    Warning: Ambiguous class resolution, "ConfideSetupUsersTable" was found in both "$baseDir . '/app/database/migrations/2014_09_05_121646_confide_setup_users_table.php" and "/Users/giuliotroccoli/www/local.intranet.cityam.com/vendor/zizaco/confide/src/migrations/2013_01_13_172956_confide_setup_users_table.php", the first will be used.

    The first script is the one I generated with php artisan confide:migration. The second is part of the confide package.

    I know it's a warning but it's annoying to have everytime I run composer.

    I'm using zizaco/confide 4.2

    opened by troccoli 0
  • Wrong confirmation code

    Wrong confirmation code

    I have project with confide. At first Thank for this package. But something is wrong. \Confide::confirm($code) always returns false. What's wrong? Please help

    opened by faradoxuz 0
  • Class 'Zizaco\Confide\UserValidator' not found

    Class 'Zizaco\Confide\UserValidator' not found

    I'm using the following as UserValidator.php, but I get the error

    Class 'Zizaco\Confide\UserValidator' not found

    <?php
    
    use Zizaco\Confide\UserValidator as ConfideUserValidator;
    use Zizaco\Confide\UserValidatorInterface;
    
    class UserValidator extends ConfideUserValidator implements UserValidatorInterface
    {
        public $rules = [
            'create' => [
                'username' => 'required',
                'email'    => 'required|email',
                'password' => 'required|min:4',
                'firstname' => 'required|alpha',
                'lastname' => 'required|alpha',
            ],
            'update' => [
                'username' => 'required',
                'email'    => 'required|email',
                'password' => 'required|min:4'
                'firstname' => 'required|alpha',
                'lastname' => 'required|alpha',,
            ]
        ];
    }
    

    Have I missed something?

    Thanks!

    opened by blueskysd 0
  • Adding security

    Adding security

    Bind the login attempts to the IP address. As the blocking is NOT bound to an IP address, it is possible to block legitimate users, automatically trying to log with incorrect credentials every few minutes.

    Limit the usage of "reset password" to prevent spamming the user with known email, it would be efficient in most cases to use it only a few times per day.

    Add throttling to "reset password" functionality for wrong identity to prevent determination of the existence of valid email addresses.

    opened by xbelmondo 0
Releases(4.3.0)
Owner
Zizaco
Zizaco
It's a Laravel 8 authentication markdown that will help you to understand and grasp all the underlying functionality for Session and API Authentication

About Auth Starter It's a Laravel 8 authentication markdown that will help you to understand and grasp all the underlying functionality for Session an

Sami Alateya 10 Aug 3, 2022
Rinvex Authy is a simple wrapper for @Authy TOTP API, the best rated Two-Factor Authentication service for consumers, simplest 2fa Rest API for developers and a strong authentication platform for the enterprise.

Rinvex Authy Rinvex Authy is a simple wrapper for Authy TOTP API, the best rated Two-Factor Authentication service for consumers, simplest 2fa Rest AP

Rinvex 34 Feb 14, 2022
phpCAS is an authentication library that allows PHP applications to easily authenticate users via a Central Authentication Service (CAS) server.

phpCAS is an authentication library that allows PHP applications to easily authenticate users via a Central Authentication Service (CAS) server.

Apereo Foundation 780 Dec 24, 2022
Jasny SSO is a relatively simply and straightforward solution for single sign on (SSO).

Single Sign-On for PHP (Ajax compatible) Jasny SSO is a relatively simply and straightforward solution for single sign on (SSO). With SSO, logging int

Arnold Daniels 1.4k Jan 6, 2023
:octocat: Socialite is an OAuth2 Authentication tool. It is inspired by laravel/socialite, you can easily use it without Laravel.

Socialite Socialite is an OAuth2 Authentication tool. It is inspired by laravel/socialite, You can easily use it in any PHP project. 中文文档 This tool no

安正超 1.2k Dec 22, 2022
A Simple method to create laravel authentication for an existing laravel project.

Laravel Simple Auth A Simple method to create laravel authentication for an existing laravel project. Indroduction Why I created this kind of package?

Dasun Tharanga 10 Dec 14, 2021
Laravel Auth is a Complete Build of Laravel 8 with Email Registration Verification, Social Authentication, User Roles and Permissions, User Profiles, and Admin restricted user management system.

Laravel Auth is a Complete Build of Laravel 8 with Email Registration Verification, Social Authentication, User Roles and Permissions, User Profiles, and Admin restricted user management system. Built on Bootstrap 4.

Jeremy Kenedy 2.8k Dec 31, 2022
🔐 JSON Web Token Authentication for Laravel & Lumen

Documentation Documentation for 1.* here For version 0.5.* See the WIKI for documentation. Supported by Auth0 If you want to easily add secure authent

Sean Tymon 10.7k Dec 31, 2022
LDAP Authentication & Management for Laravel

?? Hey there! Looking for something even easier to use for LDAP integration in your Laravel applications? ?? Introducing LdapRecord ?? LdapRecord is t

null 894 Dec 28, 2022
Library to manage HTTP authentication with PHP. Includes ServiceProviders for easy Laravel integration.

Intervention HttpAuth Library to manage HTTP authentication with PHP. Includes ServiceProviders for easy Laravel integration. Installation You can ins

null 69 Jul 14, 2022
Minimal Laravel authentication scaffolding with Blade and Tailwind.

Introduction Breeze provides a minimal and simple starting point for building a Laravel application with authentication. Styled with Tailwind, Breeze

The Laravel Framework 2.1k Jan 3, 2023
User Authentication Managment With Laravel 8

About Laravel Laravel is a web application framework with expressive, elegant syntax. We believe development must be an enjoyable and creative experie

null 17 Jul 17, 2022
Laravel 5 Active Directory LDAP Authentication driver.

Active Directory LDAP Authentication Laravel 5 Active Directory LDAP Authentication driver. Fork This is a fork of Cody Covey's ldap-auth package. Unf

Manuel Strebel 33 Aug 19, 2019
Simple readonly LDAP authentication with Laravel 5.2

ldap-auth Very basic READ ONLY LDAP authentication driver for Laravel 5.2+ Look HERE for the package for Laravel 5.1. However, only the 5.2 Version wi

Stan 26 Jun 20, 2021
Laravel passport authentication API endpoints

Basic sample code for Laravel/Passport to authenticate users via API

Devdreamsolution 2 Oct 19, 2021
🔐 JSON Web Token Authentication for Laravel & Lumen

Credits This repository it a fork from original tymonsdesigns/jwt-auth, we decided to fork and work independent because the original one was not being

null 490 Dec 27, 2022
Laravel Sanctum provides a featherweight authentication system for SPAs and simple APIs.

Introduction Laravel Sanctum provides a featherweight authentication system for SPAs and simple APIs. Official Documentation Documentation for Sanctum

The Laravel Framework 2.4k Dec 30, 2022
Backend controllers and scaffolding for Laravel authentication.

Introduction Laravel Fortify is a frontend agnostic authentication backend for Laravel. Fortify powers the registration, authentication, and two-facto

The Laravel Framework 1.4k Dec 20, 2022
Social OAuth Authentication for Laravel 5. drivers: facebook, github, google, linkedin, weibo, qq, wechat and douban

Social OAuth Authentication for Laravel 5. drivers: facebook, github, google, linkedin, weibo, qq, wechat and douban

安正超 330 Nov 14, 2022