@@ -18,22 +18,22 @@ class UserController extends Controller
18
18
// Every function in this controller requires auth
19
19
public function __construct ()
20
20
{
21
- $ this ->middleware ('auth ' );
21
+ // $this->middleware('auth');
22
22
}
23
23
24
24
public function dashboard (){
25
- return view ('paste/dashboard ' , ['userPastes ' => Auth:: user ()->pastes ()->get ()]);
25
+ return view ('paste/dashboard ' , ['userPastes ' => User:: getCurrentUser ()->pastes ()->get ()]);
26
26
}
27
27
public function delete ($ link ){
28
28
if (!cas ()->isAuthenticated ()) return redirect ('/ ' );
29
29
$ userPaste = Paste::where ('link ' , $ link )->firstOrFail ();
30
- if ($ userPaste ->userId != Auth:: user ()->id ) return redirect ('/login ' );
30
+ if ($ userPaste ->userId != User:: getCurrentUser ()->id ) return redirect ('/login ' );
31
31
$ userPaste ->forceDelete ();
32
32
return redirect ('/users/dashboard ' );
33
33
}
34
34
public function account (){
35
35
if (!cas ()->isAuthenticated ()) return redirect ('/login ' );
36
- $ user = User::where ('id ' , Auth:: user ()->id )->first ();
36
+ $ user = User::where ('id ' , User:: getCurrentUser ()->id )->first ();
37
37
return view ('paste.account ' , ['user ' => $ user ]);
38
38
}
39
39
public function editAccount (Request $ request ){
@@ -53,9 +53,9 @@ public function editAccount(Request $request){
53
53
'email ' => 'required|email ' ,
54
54
]);
55
55
}
56
- $ user = User::where ('id ' , Auth:: user ()->id )->first ();
56
+ $ user = User::where ('id ' , User:: getCurrentUser ()->id )->first ();
57
57
$ checkEmail = User::where ('email ' , Input::get ('email ' ))->first ();
58
- if (!is_null ($ checkEmail ) && $ checkEmail ->id != Auth:: user ()->id ) return Redirect::back ()->withErrors (['Specified e-mail address already exists ' ]);
58
+ if (!is_null ($ checkEmail ) && $ checkEmail ->id != User:: getCurrentUser ()->id ) return Redirect::back ()->withErrors (['Specified e-mail address already exists ' ]);
59
59
$ user ->name = Input::get ('name ' );
60
60
$ user ->email = Input::get ('email ' );
61
61
if (Input::get ('password ' ) != "" ) {
0 commit comments