File tree Expand file tree Collapse file tree 4 files changed +16
-18
lines changed
resources/themes/pterodactyl/auth/passwords Expand file tree Collapse file tree 4 files changed +16
-18
lines changed Original file line number Diff line number Diff line change 2525namespace Pterodactyl \Observers ;
2626
2727use DB ;
28+ use Hash ;
29+ use Carbon ;
2830use Pterodactyl \Events ;
2931use Pterodactyl \Models \User ;
3032use Pterodactyl \Notifications \AccountCreated ;
@@ -52,12 +54,20 @@ public function created(User $user)
5254 {
5355 event (new Events \User \Created ($ user ));
5456
55- $ token = DB ::table ('password_resets ' )->where ('email ' , $ user ->email )->orderBy ('created_at ' , 'desc ' )->first ();
56- $ user ->notify ((new AccountCreated ([
57+ if ($ user ->password === 'unset ' ) {
58+ $ token = hash_hmac ('sha256 ' , str_random (40 ), config ('app.key ' ));
59+ DB ::table ('password_resets ' )->insert ([
60+ 'email ' => $ user ->email ,
61+ 'token ' => Hash::make ($ token ),
62+ 'created_at ' => Carbon::now ()->toDateTimeString (),
63+ ]);
64+ }
65+
66+ $ user ->notify (new AccountCreated ([
5767 'name ' => $ user ->name_first ,
5868 'username ' => $ user ->username ,
59- 'token ' => (! is_null ($ token )) ? $ token -> token : null ,
60- ]))) ;
69+ 'token ' => (isset ($ token )) ? $ token : null ,
70+ ]));
6171 }
6272
6373 /**
Original file line number Diff line number Diff line change @@ -83,23 +83,12 @@ public function create(array $data)
8383 'username ' => $ data ['username ' ],
8484 'name_first ' => $ data ['name_first ' ],
8585 'name_last ' => $ data ['name_last ' ],
86- 'password ' => Hash:: make (( empty ($ data ['password ' ])) ? str_random ( 30 ) : $ data ['password ' ]),
86+ 'password ' => ( empty ($ data ['password ' ])) ? ' unset ' : Hash:: make ( $ data ['password ' ]),
8787 'root_admin ' => $ data ['root_admin ' ],
8888 'language ' => Settings::get ('default_language ' , 'en ' ),
8989 ]);
9090 $ user ->save ();
9191
92- // Setup a Password Reset to use when they set a password.
93- // Only used if no password is provided.
94- if (empty ($ data ['password ' ])) {
95- $ token = str_random (32 );
96- DB ::table ('password_resets ' )->insert ([
97- 'email ' => $ user ->email ,
98- 'token ' => $ token ,
99- 'created_at ' => Carbon::now ()->toDateTimeString (),
100- ]);
101- }
102-
10392 DB ::commit ();
10493
10594 return $ user ;
Original file line number Diff line number Diff line change 9393 'passwords ' => [
9494 'users ' => [
9595 'provider ' => 'users ' ,
96- 'email ' => 'emails.password ' ,
9796 'table ' => 'password_resets ' ,
9897 'expire ' => 60 ,
9998 ],
Original file line number Diff line number Diff line change 7676 <div class =" col-xs-12" >
7777 {!! csrf_field () ! !}
7878 <input type =" hidden" name =" token" value =" {{ $token } }" >
79- <button type =" submit" class =" btn btn-primary btn-block btn-flat" >@lang (' auth.reset_password' )</button >
79+ <button type =" submit" class =" btn btn-primary btn-block btn-flat g-recaptcha " @if ( config ( ' recaptcha.enabled ' ) ) data-sitekey = " {{ config ( ' recaptcha.website_key ' ) } } " data-callback = ' onSubmit ' @endif >@lang (' auth.reset_password' )</button >
8080 </div >
8181 </div >
8282 </form >
You can’t perform that action at this time.
0 commit comments