Skip to content

Commit 5c4a561

Browse files
committed
Issue #57 verifier password when checking off workshifts
1 parent 0a7da2f commit 5c4a561

File tree

3 files changed

+10
-4
lines changed

3 files changed

+10
-4
lines changed

app/controllers/workshift_assignments_controller.rb

+6-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,12 @@ def check_off
1616
redirect_to user_profile_path(@workshift_assignment.workshifter)
1717
return
1818
end
19-
@workshift_assignment.check_off(verifier)
19+
if !verifier.valid_password?(params[:verifier_password])
20+
flash[:alert] = 'Invalid password for ' + verifier.name
21+
redirect_to user_profile_path(@workshift_assignment.workshifter)
22+
return
23+
end
24+
@workshift_assignment.check_off(verifier)
2025
ConfirmationMailer.sign_off_email(@workshift_assignment.verifier.email,
2126
@workshift_assignment.workshifter).deliver
2227
flash[:notice] = 'Assignment successfully checked off'

app/models/workshift_assignment.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ def gen_next_assignment
4848
# for loop, different cases whether it was attempted sold/sold/done
4949

5050
def check_off(verifier)
51-
if verifier != self.workshifter || verifer.role === 'Workshift Manager'
51+
if verifier != self.workshifter || verifier.role === 'Workshift Manager'
5252
self.verifier = verifier
5353
self.status = "complete"
5454
self.sign_off_time = Time.zone.now # NEEDS TO BE FIXED PROBABLY

app/views/users/_workshift_assignments.html.haml

+3-2
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
%th End Time
1212
%th Status
1313
- if current_user == @user
14-
%th
14+
%th Verifier's info
1515
%th
1616
%tbody
1717
- workshift_assignments.each do |workshift_assignment|
@@ -25,8 +25,9 @@
2525
- if current_user == @user
2626
%td
2727
= form_tag assignment_check_off_path(workshift_assignment) do
28-
= text_field_tag :verifier_name, nil, class: 'verifier-name'
28+
= text_field_tag :verifier_name, nil, class: 'verifier-name', :placeholder => "Verifier's name"
2929
= hidden_field_tag :verifier, nil
30+
= password_field_tag :verifier_password, nil, class: 'verifier-password', :placeholder => "Verifier's password"
3031
= submit_tag "Check Off", class: 'button success small radius'
3132
%td
3233
= form_tag put_on_market_path(workshift_assignment) do

0 commit comments

Comments
 (0)