Commit 6858e2e5 authored by maxwell's avatar maxwell

crazy ugly admin interface so an admin can invite people, and search for user...

crazy ugly admin interface so an admin can invite people, and search for user accounts for basic debugging
parent 23048275
......@@ -27,6 +27,26 @@ class StatisticsController < ApplicationController
redirect_to stat
end
def user_search
user = params[:user] || {}
user = user.delete_if {|key, value| value.blank? }
params[:user] = user
if user.keys.count == 0
@users = []
else
@users = User.where(params[:user]).all || []
end
render 'statistics/user_search'
end
def admin_inviter
Invitation.create_invitee(:identifier => params[:identifier])
flash[:notice] = "invitation sent to #{params[:identifier]}"
redirect_to 'statistics/user_search'
end
private
def redirect_unauthorized
unless AppConfig[:admins].include?(current_user.username)
......
%h3
- form_tag 'admin_inviter', :method => :get do
email to invite:
= text_field_tag 'identifier'
= submit_tag 'invite'
%h3
user search
- form_tag 'user_search', :method => :get do
username:
= text_field_tag 'user[username]', params[:user][:username]
email:
= text_field_tag 'user[email]', params[:user][:email]
invitation identifier
= text_field_tag 'user[invitation_identifier]', params[:user][:invitation_identifier]
invitation token:
= text_field_tag 'user[invitation_token]', params[:user][:invitation_token]
= submit_tag 'go'
= "#{@users.count} users found"
%br
%br
- for user in @users
= user.inspect
%br
= "invite token: #{accept_invitation_url(user, :invitation_token => user.invitation_token)}" if user.invitation_token
%br
......@@ -12,6 +12,8 @@ Diaspora::Application.routes.draw do
match 'services/finder/:provider' => 'services#finder', :as => 'friend_finder'
resources :services
match 'statistics/user_search' => 'statistics#user_search'
match 'statistics/admin_inviter' => 'statistics#admin_inviter'
match 'statistics/generate_single' => 'statistics#generate_single'
resources :statistics
......@@ -32,7 +34,6 @@ Diaspora::Application.routes.draw do
match 'photos/make_profile_photo' => 'photos#make_profile_photo'
resources :photos, :except => [:index]
devise_for :users, :controllers => {:registrations => "registrations",
:password => "devise/passwords",
:invitations => "invitations"} do
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment