Skip to content

Commit

Permalink
Missed a if block for valid password
Browse files Browse the repository at this point in the history
  • Loading branch information
agmps17 committed Jun 19, 2014
1 parent f012ecc commit c33a270
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
8 changes: 5 additions & 3 deletions app/controllers/webapps_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -151,10 +151,12 @@ def add_permission
@webapp = Webapp.find(params[:webapp_id]) if params[:webapp_id]
if (@user && @webapp)
check = @user.valid_password?(password)
w = WebappAccess.find_or_create(@webapp.id)
w.addUser(@user,password)
if(check)
w = WebappAccess.find_or_create(@webapp.id)
w.addUser(@user,password)
end
end
status = check ? "ok" : "notok"
@status = check ? "ok" : "notok"
@users_allowed = WebappAccess.find_or_create(@webapp.id).getUsers
end

Expand Down
2 changes: 1 addition & 1 deletion app/views/webapps/add_permission.json.jbuilder
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
self.formats = [:html]
json.status :ok
json.status @status
json.type :permission
json.webappid @webapp.id
json.userid @user.id
Expand Down

0 comments on commit c33a270

Please sign in to comment.