Skip to content

Commit

Permalink
Create an option to only allow users to edit their profile within 24
Browse files Browse the repository at this point in the history
hours of creation
  • Loading branch information
petecheslock committed Dec 22, 2023
1 parent c7081d1 commit 0b9f965
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion app/controllers/users_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,9 @@ def user_params
# Confirms the correct user.
def correct_user
@user = User.find(params[:id])
redirect_to(root_url, status: :see_other) unless current_user?(@user)
if Time.now - @user.created_at > 24.hours
flash[:danger] = "You can only edit your profile within 24 hours of account creation."
end
end

# Confirms an admin user.
Expand Down

0 comments on commit 0b9f965

Please sign in to comment.