Created
March 27, 2013 01:24
-
-
Save msurguy/5250811 to your computer and use it in GitHub Desktop.
Reset user's password in Laravel 3 through artisan command .
Put this file into application/tasks Usage from command line :
php artisan resetpass 1 nEwP@SSwOrd Where 1 is user's id and "nEwP@SSwOrd" is the new password
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
class Resetpass_Task { | |
public function run($arguments) | |
{ | |
$userid = $arguments[0]; | |
$newpass = $arguments[1]; | |
$user = User::find($arguments[0]); | |
if($user){ | |
$user->password = Hash::make($newpass); | |
if ($user->save()){ | |
echo (' User '.$user->username.' updated'); | |
} else { | |
echo (' User '.$user->username.' NOT updated'); | |
} | |
} else { | |
echo (' User does not exist'); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment