- # added a random nonce here which isn't predictable, making an CSRF procedure much, much more difficult.
- if params[:nonce] and params[:nonce] == session[:nonce]
- this_user = User.find_by_display_name(params[:display_name], :conditions => {:visible => true})
- if this_user and UserRole::ALL_ROLES.include? params[:role]
- UserRole.delete_all({:user_id => this_user.id, :role => params[:role]})
- redirect_to :controller => 'user', :action => 'view', :display_name => params[:display_name]
- else
- flash[:notice] = t('user_role.revoke.fail', :role => params[:role], :name => params[:display_name])
- end
- else
- @nonce = OAuth::Helper.generate_nonce
- session[:nonce] = @nonce
- end
+ UserRole.delete_all({:user_id => @this_user.id, :role => @role})
+ redirect_to :controller => 'user', :action => 'view', :display_name => @this_user.display_name