Giter VIP home page Giter VIP logo

confide's Introduction

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

confide's People

Contributors

afzalive avatar alairock avatar andrew13 avatar andrewelkins avatar beesofts avatar bio avatar byordereurope avatar chaseconey avatar craighooghiem avatar flambe avatar freezy-sk avatar gabrielalmeida avatar grahamcampbell avatar hotmeteor avatar irazasyed avatar jeroen-g avatar kamahl19 avatar kennedytedesco avatar kz avatar lomotech avatar marceloandrader avatar mikedfunk avatar mitttens avatar nicholasturner avatar pcr-coding avatar quentin-from-mars avatar rgriss avatar sheco avatar thylo avatar zizaco 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  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

confide's Issues

User::create($array) not working

Using normal Eloquent create static method not working (or at least for me.)

I cloned andrew13 / Laravel-4-Bootstrap-Starter-Site to test upon it after finding that it's not working on my latest laravel 4 installation.

For example in app/routes.php I added the following for demonstration purposes:

Route::get('1', function(){
    if( $user = User::create(array(
            'username'      => 'jonathan',
            'email'         => '[email protected]',
            'password'      => 'admin',
        ))) {
        return $user;
    }else {
        return 'error';
    }
});

Returns confirmation code in a json object, Checking the database nothing is created there.

{"confirmation_code":"fbe3877b06094207a292cf0c71b7feab"}

While the find method is working normally:

User::find(1);

Thank You :)

Password reset is broken

Password-reset currently fails because of unique:users validation rules on email.

The fix for #72 is incomplete because resetPassword() still use the old save. I think it should be changed to use the new amend method.

Sign up Process Improvements

Hi, Thanks for confide, glad there's something to start with and not have to code from scratch.

Sign up Process could do with a couple of Improvements

Validation checks
Validation Error Messages displayed on signup.blade.php

I'd like to know if there is a way to offer my updates to your code, not sure how. Guess; do I fork it, then update my side, then push to my fork of this project? Is that right process?

Conditional logic on generating routes returning error

Not sure if this is due to a L4 update but there are several places (such as action destinations for forms) in Confide that look for specific routes in the UserController class and if they don't exist I think the idea is that they default to a restful version of the route.

This may have originally returned false if the UserController function didn't exist so therefore implemented the alternative resftul controller but now L4 is returning an exceptions if you call URL::Action('[methodname]') on a methodname that doesn't exist.

Example:

{{{ (URL::action('UserController@reset_password', array($token))) ? : URL::to('user/reset/'.$token)  }}}

if 'reset_password()' doesn't exist in UserController, an exception is thrown, rather then default to the other route in the conditional expression.

Ardent url update

Hello Zizaco:
Ardent has it's own github page now. The gihub page is using the latest version of the documentation. (I'll update the README file soon)
It'd be nice if you could update these links in your documentation:
http://laravelbook.github.com/ardent
http://laravelbook.github.com/ardent/#validation

Keep up the good work!

Notice and Error messages don't show up

I've reproduced this bug with the most basic settings: newly cloned lastest laravel 4 and only Confide installed. The view doesn't show notice message after successful sign up, or error messages if the inputs are incorrect. It's like Session doesn't work, but I'm not sure.

Also, Confide::user() returns null after navigate away from the first view returned after successful login, not sure if this is related to the above issue. (If I call Auth::login(Confide::user(), true) explicitly in login action, then it still works in the second view. I also put Auth::logout() in logout action of Confide's UserController.)

Bug in #34 still there

After upgrading (via composer & manualy) +-5 min ago, the username bug is still there.

ErrorException

I get this error:
"ErrorException: Runtime Notice: Non-static method Zizaco\Confide\Confide::logAttempt() should not be called statically",
when running this in my Controller (just testing it at the moment).

$input = array('email'=>'[email protected]', 'password'=>'1234');
if(Confide::logAttempt($input)){
echo "Enter user!";
}
Is there something i've missed, in setting-up?
Thanks.

Auth filter (Part 1 of the $_GET['r'] redirect)

Hey Zizaco, This is what I came up for part 1 of the $_GET['r'] redirect, if it's something you wanted to add to Confide's docs:

Route::filter('auth', function()
{
    if (Auth::guest())
    {
        $uri = strip_tags($_SERVER['REQUEST_URI']);

        $uri = ltrim($uri, '/');

        return Redirect::to('login?r='.urlencode($uri));
    }
});

The ltrim() is necessary because Laravel's Redirect::to() doesn't currently allow the path parameter to begin with a leading slash, though I've submitted a pull request laravel/framework#395 that would fix that. If it's merged in, then the ltrim() could be removed from here.

I actually like to clean up the path a little too when I use this. Just so the URL just looks a bit friendlier to users.

Route::filter('auth', function()
{
    if (Auth::guest())
    {
        $uri = strip_tags($_SERVER['REQUEST_URI']);

        $uri = ltrim($uri, '/');

        // Clean up the path (replaces encoded slashes with slashes)
        $uri = str_replace('%2F', '/', $uri);

        return Redirect::to('login?r='.$uri);
    }
});

URL's should not be hardcoded

The current system uses user/* by default for all its actions. In some cases (like mine) the "/user/..." URL is already reserved for the user's profile. In order for Confide to work on a different URL, manual changes have to be done to the controller.

Perhaps this can be optimized some more?

[Proposal] If a $_GET['r'] parameter exists on the login URL, redirect to this URL upon successful login (instead of to the default destination URL)

If a user attempts to access a URL that requires authentication (e.g. /account/settings) when they are not logged in, we currently redirect them to the login page (/user/login). But we could redirect to them to the login page and add a GET parameter containing the URL they were trying to access (/user/login?r=/account/settings). Then if this parameter exists on the login page, Confide can send them straight to the URL that they were originally trying to access after they log in. This improves usability.

(There are two parts to this. 1.) To have Laravel's auth filter redirect to login?r=/path/to/desired/url (this part I'll be taking a look at, but anyone else can take a stab at it too) and 2.) The Confide portion which actually uses the $_GET['r'] parameter, if it exists, to override the default destination URL that we send them to upon successful login. (This is the part that this ticket is about.)

[Proposal] Add a config option for the destination URL upon successful login

For many sites, developers will want to redirect the user to a certain URL by default upon successful login--e.g. to /account, /member, etc.

I know I can change this easily within the controller, but given that Confide has a configuration file, maybe it would make sense to add this as a configuration option. I think pretty much every developer will need to set this. I wonder if it'd be easier to maintain or update Confide while maintaining the unique changes if this were in a config option. What do you think?

[Proposal] If user who is already logged in visits the login form, automatically redirect them

If a user visits the login form while already authenticated, redirect them to the destination URL (i.e. wherever we normally redirect them upon successful login.) This is the same behavior Github uses on their login page, as an example.

(p.s. I'm evaluating and implementing Confide. I think it's Laravel's best contender as a 'canonical' base login package. So I will probably have a number of suggestions. Feel free to shoot any down. :)

Confide not rendering

I have just installed Laravel 4 with confide. None of the confide portions are rendering. All the html is escaped. For example
{{ Confide::makeLoginForm()->render() }}

produced this (snippet) in the view:

Screen Shot 2013-02-14 at 8 33 02 AM

Password reset token check and removal.

I am thinking you should not even get to the reset form with an invalid token, check for valid token and just redirect to login with expired/invalid link messaging. Also it would be nice if the password reset action removed the 'password_reminders' records or at least zero out the token value so the link is no longer valid after one use.

Error: Using $this when not in object context

From Laravel forum:

Nate: "I get this error when I try to register a new user:
FatalErrorException: Error: Using $this when not in object context in /Users/nate/Sites/rtp.local/vendor/zizaco/confide/src/Zizaco/Confide/ConfideUser.php line 264
The registration works ( I can see the user in the DB ) but the confirmation e-mail doesn't dispatch."

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

Redirect back to login while credentials are correct

After successful login it redirects back to the login page, while credentials are correct and var_dump show my user data.

I tried to look for the problem but I can't seem to find it, I guess the session does not get set?? I'm currently investigating further~

Below the snippets:

//Routes.php
Route::get( 'backend/login', 'Backend\\UserController@login');
Route::post('backend/login', 'Backend\\UserController@postLogin');

Route::group(array('prefix' => 'backend', 'before' => 'auth'), function()
{
    Route::resource('taxonomy', 'Backend\\TaxonomyController');
}

//Filter.php
Route::filter('auth', function()
{
    if (Auth::guest())
    {   
        Session::put('loginRedirect', Request::url());
    return Redirect::to('backend/login');
    }
});

//UserController.php re-generated using php artisan confide:controller
public function postLogin()
    {
        $input = array(
            'email'    => Input::get( 'email' ), // May be the username too
            'username' => Input::get( 'email' ), // so we have to pass both
            'password' => Input::get( 'password' ),
            'remember' => Input::get( 'remember' ),
        );

        // If you wish to only allow login from confirmed users, call logAttempt
        // with the second parameter as true.
        // logAttempt will check if the 'email' perhaps is the username.
    var_dump(Confide::user()); // This is null, as expected

        if ( Confide::logAttempt( $input ) ) 
        {
            // If the session 'loginRedirect' is set, then redirect
            // to that route. Otherwise redirect to '/'
            $r = Session::get('loginRedirect');
            if (!empty($r))
            {
                Session::forget('loginRedirect');
                return Redirect::to($r);
            }
            var_dump(Confide::user()); //Contains my user data, as expected
       die();
            return Redirect::to('/backend/taxonomy'); // change it to '/admin', '/dashboard' or something
        }
        else
        {
            // Check if there was too many login attempts
            if( Confide::isThrottled( $input ) )
            {
                $err_msg = Lang::get('confide::confide.alerts.too_many_attempts');
            }
            else
            {
                $err_msg = Lang::get('confide::confide.alerts.wrong_credentials');
            }

                        return Redirect::action('UserController@login')
                            ->withInput(Input::except('password'))
                ->with( 'error', $err_msg );
        }
    }

Bug: Error upon submitting the /user/create form: "Unknown column 'password_confirmation"

Upon submitting the form to create a new user (/user/create), the following fatal error is returned:

    Exception: SQLSTATE[42S22]: Column not found: 1054 Unknown column 'password_confirmation' in 'field list' (SQL: insert into `users` (`username`, `email`, `password`, `password_confirmation`, `updated_at`, `created_at`) values (?, ?, ?, ?, ?, ?))

and no new user is added to the database.

$this->be($user) in unit tests not working correctly with Confide's user

Setting user in unit test doesn't work properly. It's kind of work as it can make Laravel redirect to another route if the user's logged in. But if there's any logic concerning User model inside the controller's action, it is like the user's not logged in at all. Also, var_dump($user->username) in the test method returns null.

I tried using the Laravel's original User model, and var_dump($user->username) works fine, so it must be Confide's or Ardent's bug.

"requested URL /user was not found" on create

Just did a fresh install of laravel4 and confide, and set it up using restful controller.
When i try to create a new user i just get a "The requested URL /user was not found on this server.". The url it redirected to was "http://localhost/user" instead of "http://localhost/l4/user" as it should be.

Pretty new to both laravel4 and confide, so not sure where to look into this problem xD

Edit:
Found this file: "/vendor/zizaco/confide/src/views/signup.blade.php",and changed '/user' to URL::to('user'). Not sure if that's the way to fix it, but now it works for me at least :)

Package config modification?

I am newer to composer so forgive this question but how can I modify src/config/config.php without losing changes when updating. What is the proper method of managing these files when you gitignore the vendor directory?

Help

Installed with composer

php artisan confide:migration

PHP Parse error: syntax error, unexpected '[', expecting ')' in /home/dsl/vendor/zizaco/confide/src/commands/ControllerCommand.php on line 86

Closure type hint should have \ prefix?

I'm thinking the Closure type hints in ConfideUser.php should have a \ preceeding to make it load the php closure class?

I'm getting this error because of this:

ReflectionException: Class Zizaco\Confide\Closure does not exist

I think this is because you use a namespace in ConfideUser.php and it's trying to load Closure from that namespace

Few issues

Hi Guys i'm having an issue with confide first when i click on forgot password it sends an email correctly, but when i click on the link and try to reset the password the page errors and tells me that the user/reset/ is missing the token. I fixed that, but it says that i need to try again that i have an incorrect password even though i'm trying to reset it. Also in the password_reminders table there is no index column is that supposed to be like that?

Thanks!

Can't login anymore

I removed username on line 108 in confide.php to be able to login again.
But when trying to login it just sends me back to the login page with no message.

Before upgrading everything worked perfect (I also removed username according issue #34).

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.

"php": ">=5.3.0",

There are errors with php 5.3.0 support even if it says it will work with php 5.3.0.
Like Array dereference in line 19 signup.blade.php

sorry im new to github and im not sure im doing this the right way.

thank you.

Proposal: MongoDB fork

Hi Zizaco,
Love your packages Confide and Entrust.
I see you've been using navruzm/lmongo.
Is it possible to make a fork of Confide and Entrust that would inherit from LMongo and be usable in projects using LMongo connection to DB?

Rendering forms results in infinite loop

Since I have some requirements on styling/integrating the forms I am using Confide slightly different.

Controller:

public function getRegister()
    {
        $this->layout->nest('content', 'auth.register');
    }

Blade template:

@include('shared.notifications')
@section('content')
<!-- Lots of custom stuff here -->
{{{ Confide::makeSignupForm()->render() }}}
<!-- Lots of custom stuff here -->
@stop

Executing this takes ages for the browser to complete and at one point it stops execution complaining it exceeded 30s.

It renders everything up and to the makeSignupForm bit. If I take it out, the page loads fine. Something in Confide appears to be causing an infinite loop.

Remove Ardent's auto-hashing of the password

Ardent's autohashing of password really screws things up if you later add a form to update aspects of a user's profile.

For example, let's say we create a form to let a user update their profile: name, company name, & email. To do this with Eloquent/Ardent, we first get the current user object (e.g. $user = User::find(Auth::user()->id);) then we set the fields that we're updating and that have been POSTed (e.g. $user->company = Input::get('company'); plus their name and email fields), then we save (e.g. $user->save();). The new fields will be saved...

But the problem here is that the Ardent also autohashes the already-hashed password and will update its value as well (because what Eloquent is really doing with an update is getting all the column values and then saving all the values again when it does an update), the result being that a user's password is rehashed, even though we didn't alter it, and users can't log in.

To fix this, we can remove these couple lines of code: https://github.com/j20/confide/compare/master And then we need to add Hash::make() where necessary within ConfideUser.php. I don't have time to do the second part today, but can take a look at it soon.

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

Error upon submitting the /user/create form: "Unknown column 'password_confirmation"

Fresh Laravel 4 install, cloned repository from develop 30 minutes ago. Followed all installation steps. composer update and other processes executed. Receiving the following error after completing the installation process and attempting to submit form on /user/create:

SQLSTATE[42S22]: Column not found: 1054 Unknown column 'password_confirmation' in 'field list' (SQL: insert into `users` (`username`, `email`, `password`, `password_confirmation`, `updated_at`, `created_at`) values (?, ?, ?, ?, ?, ?))

I see this has happened before: #10 . As stated though, I'm using a brand new Laravel install (I made a new install specifically to test this error and verify it is not on my side).

php -v PHP 5.4.7

[Proposal] New confirmed() method for Confide class

When a user tries to login to an account that has not yet been confirmed, there currently isn't a way to display to the user that they still need to confirm the account.

Propose there is a confirmed() method for the Confide class so when checking why login failed, you can tell if it's because the account is yet to be confirmed.

Typo in Confide.php

In Zizaco/Confide/Confide.php in line 5 there is:

use ObjectProvier;

should be

use ObjectProvider;

Bug: File opens with &lt;?php

The UserController.php file opens with &lt;?php which causes an error: "Whoops. Looks like something went wrong... ReflectionException: Class UserController does not exist". By manually changing this to <?php the page loads properly.

Similarly, the migration file also opens with &lt;?php, but that seems to work fine as the table is created. The downside though is that syntax highlighting in Sublime doesn't work when a file is opened this way b/c Sublime doesn't think it's in a PHP block. So here it doesn't cause an error, but would still probably be preferable to output <?php, if possible.

The password field should be configurable

I'm using a custom User table and there's no way to change the name of the password column (my legacy table uses passwd)

Right now I had to change Zizaco\Confide\Confide.php line 104 to use

$user->passwd instead of $user->password

There should be a configuration entry somewhere so the developers can change the name of the password field.

Users without username

It would be great if we could use only email for registration and login. Username is redundant for many applications using unique emails.

Fatal Error in Create

FatalErrorException: Error: Using $this when not in object context in vendor/zizaco/confide/src/Zizaco/Confide/ConfideUser.php line 268

I have followed the installation guide, changed the templates in the config.php to use my own templates, which simply call extends on a layout, and then in a section call include for confide::signup

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.