diff options
author | Azul <azul@leap.se> | 2014-04-08 14:22:56 +0200 |
---|---|---|
committer | Azul <azul@leap.se> | 2014-04-08 14:30:07 +0200 |
commit | 9776dd10fc60efde38946588d0955c406f6c1f5e (patch) | |
tree | a77a83984e39a72cd1bb2f8f89c6d9646de117d7 | |
parent | b6d14dc19dd350a807826e3e097738a36613e083 (diff) |
move users: config and lib
-rw-r--r-- | Gemfile.lock | 10 | ||||
-rw-r--r-- | config/initializers/add_controller_methods.rb (renamed from users/config/initializers/add_controller_methods.rb) | 0 | ||||
-rw-r--r-- | config/initializers/error_constants.rb (renamed from users/config/initializers/error_constants.rb) | 2 | ||||
-rw-r--r-- | config/initializers/warden.rb (renamed from users/config/initializers/warden.rb) | 3 | ||||
-rw-r--r-- | config/initializers/webfinger.rb | 1 | ||||
-rw-r--r-- | config/locales/users.en.yml (renamed from users/config/locales/en.yml) | 0 | ||||
-rw-r--r-- | config/routes.rb | 27 | ||||
-rw-r--r-- | lib/tasks/leap_web_users_tasks.rake (renamed from users/lib/tasks/leap_web_users_tasks.rake) | 0 | ||||
-rw-r--r-- | lib/warden/session_serializer.rb (renamed from users/lib/warden/session_serializer.rb) | 0 | ||||
-rw-r--r-- | lib/warden/strategies/secure_remote_password.rb (renamed from users/lib/warden/strategies/secure_remote_password.rb) | 0 | ||||
-rw-r--r-- | lib/webfinger.rb (renamed from users/lib/webfinger.rb) | 0 | ||||
-rw-r--r-- | lib/webfinger/host_meta_presenter.rb (renamed from users/lib/webfinger/host_meta_presenter.rb) | 0 | ||||
-rw-r--r-- | lib/webfinger/user_presenter.rb (renamed from users/lib/webfinger/user_presenter.rb) | 0 | ||||
-rw-r--r-- | users/config/routes.rb | 29 | ||||
-rw-r--r-- | users/lib/leap_web_users.rb | 4 | ||||
-rw-r--r-- | users/lib/leap_web_users/engine.rb | 14 | ||||
-rwxr-xr-x | users/script/rails | 8 |
17 files changed, 35 insertions, 63 deletions
diff --git a/Gemfile.lock b/Gemfile.lock index 6c43a9f..0967bd6 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -22,13 +22,6 @@ PATH specs: leap_web_help (0.5.0) -PATH - remote: users - specs: - leap_web_users (0.5.0) - rails_warden - ruby-srp (~> 0.2.1) - GEM remote: https://rubygems.org/ specs: @@ -274,7 +267,6 @@ DEPENDENCIES leap_web_billing! leap_web_certs! leap_web_help! - leap_web_users! minitest-stub-const mocha (~> 0.13.0) phantomjs-binaries @@ -282,7 +274,9 @@ DEPENDENCIES quiet_assets rails (~> 3.2.11) rails-i18n + rails_warden rdiscount + ruby-srp (~> 0.2.1) sass-rails (~> 3.2.5) simple_form therubyracer (~> 0.10.2) diff --git a/users/config/initializers/add_controller_methods.rb b/config/initializers/add_controller_methods.rb index f572ecb..f572ecb 100644 --- a/users/config/initializers/add_controller_methods.rb +++ b/config/initializers/add_controller_methods.rb diff --git a/users/config/initializers/error_constants.rb b/config/initializers/error_constants.rb index d4a0f52..fdd3624 100644 --- a/users/config/initializers/error_constants.rb +++ b/config/initializers/error_constants.rb @@ -1 +1,3 @@ +require 'ruby-srp' + WRONG_PASSWORD = SRP::WrongPassword diff --git a/users/config/initializers/warden.rb b/config/initializers/warden.rb index 45feb6c..22892b3 100644 --- a/users/config/initializers/warden.rb +++ b/config/initializers/warden.rb @@ -1,3 +1,6 @@ +require "warden/session_serializer" +require "warden/strategies/secure_remote_password" + Rails.configuration.middleware.use RailsWarden::Manager do |config| config.default_strategies :secure_remote_password config.failure_app = SessionsController diff --git a/config/initializers/webfinger.rb b/config/initializers/webfinger.rb new file mode 100644 index 0000000..197062c --- /dev/null +++ b/config/initializers/webfinger.rb @@ -0,0 +1 @@ +require 'webfinger' diff --git a/users/config/locales/en.yml b/config/locales/users.en.yml index ed6653a..ed6653a 100644 --- a/users/config/locales/en.yml +++ b/config/locales/users.en.yml diff --git a/config/routes.rb b/config/routes.rb index f8bb8fb..05eca9b 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -16,4 +16,31 @@ LeapWeb::Application.routes.draw do end get '/provider.json' => 'static_config#provider' + + namespace "api", { module: "v1", + path: "/1/", + defaults: {format: 'json'} } do + resources :sessions, :only => [:new, :create, :update] + delete "logout" => "sessions#destroy", :as => "logout" + resources :users, :only => [:create, :update, :destroy, :index] + resources :messages, :only => [:index, :update] + end + + scope "(:locale)", :locale => MATCH_LOCALE do + get "login" => "sessions#new", :as => "login" + delete "logout" => "sessions#destroy", :as => "logout" + + get "signup" => "users#new", :as => "signup" + resources :users, :except => [:create, :update] do + # resource :email_settings, :only => [:edit, :update] + # resources :email_aliases, :only => [:destroy], :id => /.*/ + post 'deactivate', on: :member + post 'enable', on: :member + end + end + + get "/.well-known/host-meta" => 'webfinger#host_meta' + get "/webfinger" => 'webfinger#search' + get "/key/:login" => 'keys#show' + end diff --git a/users/lib/tasks/leap_web_users_tasks.rake b/lib/tasks/leap_web_users_tasks.rake index 62bcbe9..62bcbe9 100644 --- a/users/lib/tasks/leap_web_users_tasks.rake +++ b/lib/tasks/leap_web_users_tasks.rake diff --git a/users/lib/warden/session_serializer.rb b/lib/warden/session_serializer.rb index 81d7076..81d7076 100644 --- a/users/lib/warden/session_serializer.rb +++ b/lib/warden/session_serializer.rb diff --git a/users/lib/warden/strategies/secure_remote_password.rb b/lib/warden/strategies/secure_remote_password.rb index 2c334c6..2c334c6 100644 --- a/users/lib/warden/strategies/secure_remote_password.rb +++ b/lib/warden/strategies/secure_remote_password.rb diff --git a/users/lib/webfinger.rb b/lib/webfinger.rb index dd49b41..dd49b41 100644 --- a/users/lib/webfinger.rb +++ b/lib/webfinger.rb diff --git a/users/lib/webfinger/host_meta_presenter.rb b/lib/webfinger/host_meta_presenter.rb index 84ab7a9..84ab7a9 100644 --- a/users/lib/webfinger/host_meta_presenter.rb +++ b/lib/webfinger/host_meta_presenter.rb diff --git a/users/lib/webfinger/user_presenter.rb b/lib/webfinger/user_presenter.rb index 329f477..329f477 100644 --- a/users/lib/webfinger/user_presenter.rb +++ b/lib/webfinger/user_presenter.rb diff --git a/users/config/routes.rb b/users/config/routes.rb deleted file mode 100644 index 2819fa9..0000000 --- a/users/config/routes.rb +++ /dev/null @@ -1,29 +0,0 @@ -Rails.application.routes.draw do - - namespace "api", { module: "v1", - path: "/1/", - defaults: {format: 'json'} } do - resources :sessions, :only => [:new, :create, :update] - delete "logout" => "sessions#destroy", :as => "logout" - resources :users, :only => [:create, :update, :destroy, :index] - resources :messages, :only => [:index, :update] - end - - scope "(:locale)", :locale => MATCH_LOCALE do - get "login" => "sessions#new", :as => "login" - delete "logout" => "sessions#destroy", :as => "logout" - - get "signup" => "users#new", :as => "signup" - resources :users, :except => [:create, :update] do - # resource :email_settings, :only => [:edit, :update] - # resources :email_aliases, :only => [:destroy], :id => /.*/ - post 'deactivate', on: :member - post 'enable', on: :member - end - end - - get "/.well-known/host-meta" => 'webfinger#host_meta' - get "/webfinger" => 'webfinger#search' - get "/key/:login" => 'keys#show' - -end diff --git a/users/lib/leap_web_users.rb b/users/lib/leap_web_users.rb deleted file mode 100644 index e1b7b1f..0000000 --- a/users/lib/leap_web_users.rb +++ /dev/null @@ -1,4 +0,0 @@ -require "leap_web_users/engine" - -module LeapWebUsers -end diff --git a/users/lib/leap_web_users/engine.rb b/users/lib/leap_web_users/engine.rb deleted file mode 100644 index a2be168..0000000 --- a/users/lib/leap_web_users/engine.rb +++ /dev/null @@ -1,14 +0,0 @@ -# thou shall require all your dependencies in an engine. -require "rails_warden" -require "ruby-srp" - -require "warden/session_serializer" -require "warden/strategies/secure_remote_password" - -require "webfinger" - -module LeapWebUsers - class Engine < ::Rails::Engine - - end -end diff --git a/users/script/rails b/users/script/rails deleted file mode 100755 index ee08520..0000000 --- a/users/script/rails +++ /dev/null @@ -1,8 +0,0 @@ -#!/usr/bin/env ruby1.8 -# This command will automatically be run when you run "rails" with Rails 3 gems installed from the root of your application. - -ENGINE_ROOT = File.expand_path('../..', __FILE__) -ENGINE_PATH = File.expand_path('../../lib/leap_web_users/engine', __FILE__) - -require 'rails/all' -require 'rails/engine/commands' |