| Conditions | 2 |
| Paths | 2 |
| Total Lines | 19 |
| Code Lines | 10 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 35 | public function enterQuizPin(Request $request) |
||
| 36 | { |
||
| 37 | // @TODO - PIN max length needs to be dynamic with trait |
||
| 38 | // will sort out soon - Matt. |
||
| 39 | $validatedData = $request->validate([ |
||
|
|
|||
| 40 | 'pin' => 'required|string' |
||
| 41 | ]); |
||
| 42 | |||
| 43 | // FIX XSS HERE ALSO |
||
| 44 | $quiz = Quiz::where('quiz_pin', $request->get('pin')) |
||
| 45 | ->where('active', 1) |
||
| 46 | ->first(); |
||
| 47 | |||
| 48 | if (!$quiz->exists()) { |
||
| 49 | return back()->with('pin_error', 'Either the quiz doesn\'t exist, or it hasn\'t been activated'); |
||
| 50 | } else { |
||
| 51 | //Add user to the socket.io stuff! |
||
| 52 | event(new \App\Events\addUser($request->get('username'))); //Adds the user to the socket stuff |
||
| 53 | return redirect()->route('quiz_user.showSplash')->with('quizData', $quiz); |
||
| 54 | } |
||
| 57 |