@@ -48,16 +48,16 @@ |
||
48 | 48 | */ |
49 | 49 | protected function validator(array $data) |
50 | 50 | { |
51 | - $validator = [ |
|
51 | + $validator=[ |
|
52 | 52 | 'name' => ['required', 'string', 'max:16', 'unique:users'], |
53 | 53 | 'email' => ['required', 'string', 'email', 'max:255', 'unique:users', 'allowed_email_domain'], |
54 | 54 | 'password' => ['required', 'string', 'min:8', 'confirmed'], |
55 | 55 | 'agreement' => ['required'], |
56 | 56 | ]; |
57 | - $messages = []; |
|
58 | - if(config('function.password.strong')) { |
|
59 | - $validator['password'][] = 'regex:/^(?![A-Za-z0-9]+$)(?![a-z0-9\\W]+$)(?![A-Za-z\\W]+$)(?![A-Z0-9\\W]+$)[a-zA-Z0-9\\W]{8,}$/'; |
|
60 | - $messages['password.regex'] = __('validation.password.strong'); |
|
57 | + $messages=[]; |
|
58 | + if (config('function.password.strong')) { |
|
59 | + $validator['password'][]='regex:/^(?![A-Za-z0-9]+$)(?![a-z0-9\\W]+$)(?![A-Za-z\\W]+$)(?![A-Z0-9\\W]+$)[a-zA-Z0-9\\W]{8,}$/'; |
|
60 | + $messages['password.regex']=__('validation.password.strong'); |
|
61 | 61 | } |
62 | 62 | return Validator::make($data, $validator, $messages); |
63 | 63 | } |
@@ -179,7 +179,7 @@ discard block |
||
179 | 179 | if ($clearance<1) { |
180 | 180 | return Redirect::route('group.detail', ['gcode' => $gcode]); |
181 | 181 | } |
182 | - $homeworkInfo = GroupHomework::where(['id' => $homework_id, 'group_id' => $basic_info['gid']])->first(); |
|
182 | + $homeworkInfo=GroupHomework::where(['id' => $homework_id, 'group_id' => $basic_info['gid']])->first(); |
|
183 | 183 | if (blank($homeworkInfo)) { |
184 | 184 | return Redirect::route('group.detail', ['gcode' => $gcode]); |
185 | 185 | } |
@@ -195,13 +195,13 @@ discard block |
||
195 | 195 | |
196 | 196 | public function homeworkStatistics($gcode, $homework_id) |
197 | 197 | { |
198 | - $groupModel = new GroupModel(); |
|
199 | - $basic_info = $groupModel->details($gcode); |
|
200 | - $clearance = $groupModel->judgeClearance($basic_info["gid"], Auth::user()->id); |
|
201 | - if ($clearance < 2) { |
|
198 | + $groupModel=new GroupModel(); |
|
199 | + $basic_info=$groupModel->details($gcode); |
|
200 | + $clearance=$groupModel->judgeClearance($basic_info["gid"], Auth::user()->id); |
|
201 | + if ($clearance<2) { |
|
202 | 202 | return Redirect::route('group.detail', ['gcode' => $gcode]); |
203 | 203 | } |
204 | - $homeworkInfo = GroupHomework::where(['id' => $homework_id, 'group_id' => $basic_info['gid']])->first(); |
|
204 | + $homeworkInfo=GroupHomework::where(['id' => $homework_id, 'group_id' => $basic_info['gid']])->first(); |
|
205 | 205 | if (blank($homeworkInfo)) { |
206 | 206 | return Redirect::route('group.detail', ['gcode' => $gcode]); |
207 | 207 | } |
@@ -84,7 +84,7 @@ |
||
84 | 84 | public function problemExists(Request $request) |
85 | 85 | { |
86 | 86 | $request->validate(["pcode" => "required|string|max:100"]); |
87 | - $problem = Problem::where('pcode', $request->pcode)->first(); |
|
87 | + $problem=Problem::where('pcode', $request->pcode)->first(); |
|
88 | 88 | if (filled($problem)) { |
89 | 89 | return ResponseModel::success(200, null, $problem->only(["pcode", "title"])); |
90 | 90 | } else { |
@@ -10,7 +10,7 @@ |
||
10 | 10 | { |
11 | 11 | use HasFactory; |
12 | 12 | |
13 | - protected $with = ['problem']; |
|
13 | + protected $with=['problem']; |
|
14 | 14 | |
15 | 15 | public function homework() |
16 | 16 | { |
@@ -66,21 +66,21 @@ |
||
66 | 66 | |
67 | 67 | // Create Homework Itself |
68 | 68 | |
69 | - $newHomework = new GroupHomework(); |
|
69 | + $newHomework=new GroupHomework(); |
|
70 | 70 | |
71 | - $newHomework->title = $title; |
|
72 | - $newHomework->description = $description; |
|
73 | - $newHomework->ended_at = $endedAt; |
|
74 | - $newHomework->is_simple = 1; |
|
71 | + $newHomework->title=$title; |
|
72 | + $newHomework->description=$description; |
|
73 | + $newHomework->ended_at=$endedAt; |
|
74 | + $newHomework->is_simple=1; |
|
75 | 75 | $this->homework()->save($newHomework); |
76 | 76 | |
77 | 77 | // Created Related Problem List |
78 | 78 | |
79 | - $problemIndex = 1; |
|
79 | + $problemIndex=1; |
|
80 | 80 | foreach ($problems as $problem) { |
81 | - $newProblem = new GroupHomeworkProblem(); |
|
82 | - $newProblem->problem_id = $problem['pid']; |
|
83 | - $newProblem->order_index = $problemIndex++; |
|
81 | + $newProblem=new GroupHomeworkProblem(); |
|
82 | + $newProblem->problem_id=$problem['pid']; |
|
83 | + $newProblem->order_index=$problemIndex++; |
|
84 | 84 | $newHomework->problems()->save($newProblem); |
85 | 85 | } |
86 | 86 |
@@ -12,7 +12,7 @@ discard block |
||
12 | 12 | * |
13 | 13 | * @var array |
14 | 14 | */ |
15 | - protected $dontReport = [ |
|
15 | + protected $dontReport=[ |
|
16 | 16 | // |
17 | 17 | ]; |
18 | 18 | |
@@ -21,7 +21,7 @@ discard block |
||
21 | 21 | * |
22 | 22 | * @var array |
23 | 23 | */ |
24 | - protected $dontFlash = [ |
|
24 | + protected $dontFlash=[ |
|
25 | 25 | 'current_password', |
26 | 26 | 'password', |
27 | 27 | 'password_confirmation', |
@@ -34,7 +34,7 @@ discard block |
||
34 | 34 | */ |
35 | 35 | public function register() |
36 | 36 | { |
37 | - $this->reportable(function (Throwable $e) { |
|
37 | + $this->reportable(function(Throwable $e) { |
|
38 | 38 | // |
39 | 39 | }); |
40 | 40 | } |
@@ -78,10 +78,10 @@ discard block |
||
78 | 78 | $this->initSystemCheck(); |
79 | 79 | return; |
80 | 80 | if ($this->confirm('Do you wish to continue?')) { |
81 | - if(!$this->acceptLicense()){ |
|
81 | + if (!$this->acceptLicense()) { |
|
82 | 82 | return; |
83 | 83 | } |
84 | - if($this->createFrontAdminUser()){ |
|
84 | + if ($this->createFrontAdminUser()) { |
|
85 | 85 | $this->createFrontAdminGroup(); |
86 | 86 | } |
87 | 87 | $this->installBabelExtensionNOJ(); |
@@ -119,19 +119,19 @@ discard block |
||
119 | 119 | protected function createFrontAdminUser() { |
120 | 120 | $this->line('Creating frontstage admin user...'); |
121 | 121 | $this->comment(''); |
122 | - $shallCreate = true; |
|
122 | + $shallCreate=true; |
|
123 | 123 | if (User::count()) { |
124 | - $shallCreate = $this->confirm('Detected existing frontstage user, do you really want to create frontstage admin?'); |
|
124 | + $shallCreate=$this->confirm('Detected existing frontstage user, do you really want to create frontstage admin?'); |
|
125 | 125 | $this->comment(''); |
126 | 126 | } |
127 | 127 | if (!$shallCreate) { |
128 | 128 | return false; |
129 | 129 | } |
130 | - while(true) { |
|
130 | + while (true) { |
|
131 | 131 | try { |
132 | - $createdUser = $this->createFrontUser(); |
|
132 | + $createdUser=$this->createFrontUser(); |
|
133 | 133 | break; |
134 | - } catch(Exception $e) { |
|
134 | + } catch (Exception $e) { |
|
135 | 135 | $this->line("\n <bg=red;fg=white> Exception </> : <fg=yellow>Error occured while creating admin user.</>\n"); |
136 | 136 | continue; |
137 | 137 | } |
@@ -140,9 +140,9 @@ discard block |
||
140 | 140 | } |
141 | 141 | |
142 | 142 | private function createFrontUser() { |
143 | - $username = $this->ask('Please choose a username:', 'admin'); |
|
144 | - $email = $this->ask('Please choose a email address:', '[email protected]'); |
|
145 | - $password = Hash::make(Str::random(8)); |
|
143 | + $username=$this->ask('Please choose a username:', 'admin'); |
|
144 | + $email=$this->ask('Please choose a email address:', '[email protected]'); |
|
145 | + $password=Hash::make(Str::random(8)); |
|
146 | 146 | $createdUser=User::create([ |
147 | 147 | 'name' => $username, |
148 | 148 | 'email' => $email, |
@@ -17,7 +17,7 @@ |
||
17 | 17 | */ |
18 | 18 | public function index(Request $request) |
19 | 19 | { |
20 | - $status = Auth::check() ? Auth::user()->getDojoStatistics() : false; |
|
20 | + $status=Auth::check() ? Auth::user()->getDojoStatistics() : false; |
|
21 | 21 | return view('dojo.index', [ |
22 | 22 | 'page_title' => "Dojo", |
23 | 23 | 'site_title' => config("app.name"), |
@@ -29,7 +29,7 @@ |
||
29 | 29 | |
30 | 30 | $result=$submissionModel->getWaitingSubmission(); |
31 | 31 | |
32 | - $submissionCount = count($result); |
|
32 | + $submissionCount=count($result); |
|
33 | 33 | |
34 | 34 | Log::channel('babel_judge_sync')->info("Currently $submissionCount submission(s) awaiting", [$result]); |
35 | 35 |