MS DG; basic view support; it works, but it is ugly
This commit is contained in:
parent
a86d965079
commit
04f6cdaacf
5 changed files with 50 additions and 5 deletions
|
|
@ -22,7 +22,7 @@ class RegistrationsController < Devise::RegistrationsController
|
|||
end
|
||||
end
|
||||
|
||||
def update
|
||||
def update
|
||||
super
|
||||
end
|
||||
end
|
||||
|
|
|
|||
|
|
@ -5,10 +5,11 @@
|
|||
class UsersController < ApplicationController
|
||||
require File.join(Rails.root, 'lib/diaspora/ostatus_builder')
|
||||
require File.join(Rails.root, 'lib/diaspora/exporter')
|
||||
require File.join(Rails.root, 'lib/diaspora/importer')
|
||||
require File.join(Rails.root, 'lib/collect_user_photos')
|
||||
|
||||
|
||||
before_filter :authenticate_user!, :except => [:new, :create, :public]
|
||||
before_filter :authenticate_user!, :except => [:new, :create, :public, :import]
|
||||
|
||||
respond_to :html
|
||||
|
||||
|
|
@ -81,6 +82,28 @@ class UsersController < ApplicationController
|
|||
def invite
|
||||
User.invite!(:email => params[:email])
|
||||
end
|
||||
|
||||
|
||||
def import
|
||||
xml = params[:upload][:file].read
|
||||
|
||||
params[:user][:diaspora_handle] = 'asodij@asodij.asd'
|
||||
|
||||
|
||||
begin
|
||||
importer = Diaspora::Importer.new(Diaspora::Parsers::XML)
|
||||
importer.execute(xml, params[:user])
|
||||
flash[:notice] = "hang on a sec, try logging in!"
|
||||
|
||||
rescue Exception => e
|
||||
flash[:error] = "Derp, something went wrong: #{e.message}"
|
||||
end
|
||||
|
||||
redirect_to new_user_registration_path
|
||||
#redirect_to user_session_path
|
||||
end
|
||||
|
||||
|
||||
|
||||
private
|
||||
def prep_image_url(params)
|
||||
|
|
|
|||
|
|
@ -24,3 +24,27 @@
|
|||
= pr.text_field :last_name
|
||||
= f.submit t('.sign_up')
|
||||
= render :partial => "devise/shared/links"
|
||||
|
||||
|
||||
%br
|
||||
%br
|
||||
|
||||
%h2 or, upload yourself
|
||||
|
||||
|
||||
= form_tag '/users/import', :multipart => true do
|
||||
|
||||
%p
|
||||
= label_tag 'user[email]'
|
||||
= text_field_tag 'user[email]'
|
||||
%p
|
||||
= label_tag 'user[password]'
|
||||
= password_field_tag 'user[password]'
|
||||
%p
|
||||
= label_tag 'user[password_confirmation]'
|
||||
= password_field_tag 'user[password_confirmation]'
|
||||
|
||||
%label Select File
|
||||
= file_field 'upload', 'file'
|
||||
= submit_tag "Upload"
|
||||
|
||||
|
|
|
|||
|
|
@ -16,6 +16,7 @@ Diaspora::Application.routes.draw do
|
|||
# added public route to user
|
||||
match 'public/:username', :to => 'users#public'
|
||||
match 'users/export', :to => 'users#export'
|
||||
match 'users/import', :to => 'users#import'
|
||||
match 'users/export_photos', :to => 'users#export_photos'
|
||||
resources :users, :except => [:create, :new, :show]
|
||||
|
||||
|
|
|
|||
|
|
@ -131,9 +131,6 @@ describe Diaspora::Importer do
|
|||
@user.serialized_private_key.should == @old_user.serialized_private_key
|
||||
end
|
||||
|
||||
it 'should ensure a match between persons public and private keys' do
|
||||
pending
|
||||
end
|
||||
end
|
||||
|
||||
describe '#parse_aspects' do
|
||||
|
|
|
|||
Loading…
Reference in a new issue