Description:
NEED TESTING
move to stronger parameter for xxx.new(params[
Commit status:
[Not Reviewed]
References:
Diff options:
Comments:
0 Commit comments
0 Inline Comments
Unresolved TODOs:
There are no unresolved TODOs
r637:d56b2e7de528 - - 4 files changed: 10 inserted, 6 deleted
@@ -45,7 +45,7 | |||||
|
45 | # POST /announcements |
|
45 | # POST /announcements |
|
46 | # POST /announcements.xml |
|
46 | # POST /announcements.xml |
|
47 | def create |
|
47 | def create |
|
48 |
- @announcement = Announcement.new( |
|
48 | + @announcement = Announcement.new(announcement_params) |
|
49 |
|
49 | ||
|
50 | respond_to do |format| |
|
50 | respond_to do |format| |
|
51 | if @announcement.save |
|
51 | if @announcement.save |
@@ -28,7 +28,7 | |||||
|
28 | end |
|
28 | end |
|
29 |
|
29 | ||
|
30 | def create |
|
30 | def create |
|
31 |
- @problem = Problem.new( |
|
31 | + @problem = Problem.new(problem_params) |
|
32 | @description = Description.new(params[:description]) |
|
32 | @description = Description.new(params[:description]) |
|
33 | if @description.body!='' |
|
33 | if @description.body!='' |
|
34 | if !@description.save |
|
34 | if !@description.save |
@@ -47,7 +47,7 | |||||
|
47 | end |
|
47 | end |
|
48 |
|
48 | ||
|
49 | def quick_create |
|
49 | def quick_create |
|
50 |
- @problem = Problem.new( |
|
50 | + @problem = Problem.new(problem_params) |
|
51 | @problem.full_name = @problem.name if @problem.full_name == '' |
|
51 | @problem.full_name = @problem.name if @problem.full_name == '' |
|
52 | @problem.full_score = 100 |
|
52 | @problem.full_score = 100 |
|
53 | @problem.available = false |
|
53 | @problem.available = false |
@@ -47,7 +47,7 | |||||
|
47 | end |
|
47 | end |
|
48 |
|
48 | ||
|
49 | def create |
|
49 | def create |
|
50 |
- @user = User.new(params |
|
50 | + @user = User.new(user_params) |
|
51 | @user.activated = true |
|
51 | @user.activated = true |
|
52 | if @user.save |
|
52 | if @user.save |
|
53 | flash[:notice] = 'User was successfully created.' |
|
53 | flash[:notice] = 'User was successfully created.' |
@@ -52,7 +52,7 | |||||
|
52 | redirect_to :controller => 'main', :action => 'login' |
|
52 | redirect_to :controller => 'main', :action => 'login' |
|
53 | return |
|
53 | return |
|
54 | end |
|
54 | end |
|
55 |
- @user = User.new(params |
|
55 | + @user = User.new(user_params) |
|
56 | @user.password_confirmation = @user.password = User.random_password |
|
56 | @user.password_confirmation = @user.password = User.random_password |
|
57 | @user.activated = false |
|
57 | @user.activated = false |
|
58 | if (@user.valid?) and (@user.save) |
|
58 | if (@user.valid?) and (@user.save) |
@@ -209,6 +209,10 | |||||
|
209 | #finally, we allow only admin |
|
209 | #finally, we allow only admin |
|
210 | admin_authorization |
|
210 | admin_authorization |
|
211 | end |
|
211 | end |
|
212 | - |
|
212 | + |
|
|
213 | + private | ||
|
|
214 | + def user_params | ||
|
|
215 | + params.require(:user).permit(:login, :full_name, :email) | ||
|
|
216 | + end | ||
|
213 |
|
217 | ||
|
214 | end |
|
218 | end |
You need to be logged in to leave comments.
Login now