Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updating own password error #5

Open
dazza76 opened this issue Mar 5, 2014 · 1 comment
Open

Updating own password error #5

dazza76 opened this issue Mar 5, 2014 · 1 comment

Comments

@dazza76
Copy link

dazza76 commented Mar 5, 2014

when updating own password via /user
it submits to /user/1/update gives ErrorException - Trying to get property of non-object

User object does not appear to exist at this point ,

Editing users through admin works

@mikeloether
Copy link

I was running into the same issue. Looks like the $user variable is being used as a model even though it is just the user ID being passed by the route. The following snippet instantiates a user object and that is used for the rest of the logic.

    public function update($user)
    {
        // Create User Object based on user ID passed via route
        $user = User::find($user);

        if ($user->id != Auth::user()->id) {
            return Redirect::to('/')
                ->with( 'error', 'access forbidden' );
        }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants