From e8032fd9027435c57572fd0d8bab411841859cbc Mon Sep 17 00:00:00 2001 From: jessib Date: Mon, 23 Dec 2013 16:44:18 -0800 Subject: Initial start to messages API. --- users/config/routes.rb | 2 ++ 1 file changed, 2 insertions(+) (limited to 'users/config') diff --git a/users/config/routes.rb b/users/config/routes.rb index 736b283..9a7c531 100644 --- a/users/config/routes.rb +++ b/users/config/routes.rb @@ -6,6 +6,8 @@ Rails.application.routes.draw do resources :sessions, :only => [:new, :create, :update] delete "logout" => "sessions#destroy", :as => "logout" resources :users, :only => [:create, :update, :destroy, :index] + get "user_messages/:user_id" => "messages#user_messages" + put "mark_read/:user_id/:message_id" => "messages#mark_read" end scope "(:locale)", :locale => MATCH_LOCALE do -- cgit v1.2.3 From fac34e1fb21d9310227c4cfc28c3ef03806ba465 Mon Sep 17 00:00:00 2001 From: jessib Date: Thu, 26 Dec 2013 12:37:26 -0800 Subject: Very very rough start to having messages for payment automatically created. --- users/config/locales/en.yml | 1 + users/config/schedule.rb | 24 ++++++++++++++++++++++++ 2 files changed, 25 insertions(+) create mode 100644 users/config/schedule.rb (limited to 'users/config') diff --git a/users/config/locales/en.yml b/users/config/locales/en.yml index 934fcee..0db63eb 100644 --- a/users/config/locales/en.yml +++ b/users/config/locales/en.yml @@ -38,6 +38,7 @@ en: deactivate_account: "Deactivate the account %{username}" deactivate_description: "This will temporarily deactivate some account functionality." #todo detail exact functionality. can receive email but not send or renew client certificate? + payment_one_month_warning: "We hope you have been enjoying this service this past month. Please sign up to pay within the next month, by %{date_in_one_month}. Directions for payment are available at INSERT_URL" # # overview diff --git a/users/config/schedule.rb b/users/config/schedule.rb new file mode 100644 index 0000000..1b2b171 --- /dev/null +++ b/users/config/schedule.rb @@ -0,0 +1,24 @@ +# Use this file to easily define all of your cron jobs. +# +# It's helpful, but not entirely necessary to understand cron before proceeding. +# http://en.wikipedia.org/wiki/Cron + +# Example: +# +# set :output, "/path/to/my/cron_log.log" +# +# every 2.hours do +# command "/usr/bin/some_great_command" +# runner "MyModel.some_method" +# rake "some:great:rake:task" +# end +# +# every 4.days do +# runner "AnotherModel.prune_old_records" +# end + +# Learn more: http://github.com/javan/whenever + +every 1.day, :at => '1am' do + runner "User.one_month_warning_to_pay" +end -- cgit v1.2.3 From 4dae5eaa1bdb211d9d3ff29d5a9e9a86424e9748 Mon Sep 17 00:00:00 2001 From: jessib Date: Mon, 30 Dec 2013 16:22:38 -0800 Subject: Fixes to initial go at job to send one month warnings. --- users/config/schedule.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'users/config') diff --git a/users/config/schedule.rb b/users/config/schedule.rb index 1b2b171..9ddcf2f 100644 --- a/users/config/schedule.rb +++ b/users/config/schedule.rb @@ -20,5 +20,5 @@ # Learn more: http://github.com/javan/whenever every 1.day, :at => '1am' do - runner "User.one_month_warning_to_pay" + runner "User.send_one_month_warnings end -- cgit v1.2.3 From f9c96f8844205afe3c310b5b914752068728d38f Mon Sep 17 00:00:00 2001 From: jessib Date: Tue, 31 Dec 2013 11:48:18 -0800 Subject: Cleanup of code for messages API and cron job for 1 month payment warning. Authentication still remaining piece. --- users/config/schedule.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'users/config') diff --git a/users/config/schedule.rb b/users/config/schedule.rb index 9ddcf2f..4ecbe7c 100644 --- a/users/config/schedule.rb +++ b/users/config/schedule.rb @@ -20,5 +20,5 @@ # Learn more: http://github.com/javan/whenever every 1.day, :at => '1am' do - runner "User.send_one_month_warnings + runner "User.send_one_month_warnings" end -- cgit v1.2.3 From c7e66852324714a166dd35dc3d5873a0053dcb9b Mon Sep 17 00:00:00 2001 From: jessib Date: Tue, 7 Jan 2014 12:57:01 -0800 Subject: Some refactoring, to simplify user model, optimize, and allow messages to be sorted by date (although are not now.) Also, rather than use whenever gem, will have cron job created to call task. --- users/config/routes.rb | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'users/config') diff --git a/users/config/routes.rb b/users/config/routes.rb index 9a7c531..2819fa9 100644 --- a/users/config/routes.rb +++ b/users/config/routes.rb @@ -6,8 +6,7 @@ Rails.application.routes.draw do resources :sessions, :only => [:new, :create, :update] delete "logout" => "sessions#destroy", :as => "logout" resources :users, :only => [:create, :update, :destroy, :index] - get "user_messages/:user_id" => "messages#user_messages" - put "mark_read/:user_id/:message_id" => "messages#mark_read" + resources :messages, :only => [:index, :update] end scope "(:locale)", :locale => MATCH_LOCALE do -- cgit v1.2.3 From 90243155b425a540cb357f1c84b93effe798c9a1 Mon Sep 17 00:00:00 2001 From: jessib Date: Tue, 7 Jan 2014 13:00:50 -0800 Subject: Remove schedule file now that we aren't using whenever gem. --- users/config/schedule.rb | 24 ------------------------ 1 file changed, 24 deletions(-) delete mode 100644 users/config/schedule.rb (limited to 'users/config') diff --git a/users/config/schedule.rb b/users/config/schedule.rb deleted file mode 100644 index 4ecbe7c..0000000 --- a/users/config/schedule.rb +++ /dev/null @@ -1,24 +0,0 @@ -# Use this file to easily define all of your cron jobs. -# -# It's helpful, but not entirely necessary to understand cron before proceeding. -# http://en.wikipedia.org/wiki/Cron - -# Example: -# -# set :output, "/path/to/my/cron_log.log" -# -# every 2.hours do -# command "/usr/bin/some_great_command" -# runner "MyModel.some_method" -# rake "some:great:rake:task" -# end -# -# every 4.days do -# runner "AnotherModel.prune_old_records" -# end - -# Learn more: http://github.com/javan/whenever - -every 1.day, :at => '1am' do - runner "User.send_one_month_warnings" -end -- cgit v1.2.3 From 9776dd10fc60efde38946588d0955c406f6c1f5e Mon Sep 17 00:00:00 2001 From: Azul Date: Tue, 8 Apr 2014 14:22:56 +0200 Subject: move users: config and lib --- .../config/initializers/add_controller_methods.rb | 4 -- users/config/initializers/error_constants.rb | 1 - users/config/initializers/warden.rb | 7 --- users/config/locales/en.yml | 73 ---------------------- users/config/routes.rb | 29 --------- 5 files changed, 114 deletions(-) delete mode 100644 users/config/initializers/add_controller_methods.rb delete mode 100644 users/config/initializers/error_constants.rb delete mode 100644 users/config/initializers/warden.rb delete mode 100644 users/config/locales/en.yml delete mode 100644 users/config/routes.rb (limited to 'users/config') diff --git a/users/config/initializers/add_controller_methods.rb b/users/config/initializers/add_controller_methods.rb deleted file mode 100644 index f572ecb..0000000 --- a/users/config/initializers/add_controller_methods.rb +++ /dev/null @@ -1,4 +0,0 @@ -ActiveSupport.on_load(:application_controller) do - include ControllerExtension::Authentication - include ControllerExtension::TokenAuthentication -end diff --git a/users/config/initializers/error_constants.rb b/users/config/initializers/error_constants.rb deleted file mode 100644 index d4a0f52..0000000 --- a/users/config/initializers/error_constants.rb +++ /dev/null @@ -1 +0,0 @@ -WRONG_PASSWORD = SRP::WrongPassword diff --git a/users/config/initializers/warden.rb b/users/config/initializers/warden.rb deleted file mode 100644 index 45feb6c..0000000 --- a/users/config/initializers/warden.rb +++ /dev/null @@ -1,7 +0,0 @@ -Rails.configuration.middleware.use RailsWarden::Manager do |config| - config.default_strategies :secure_remote_password - config.failure_app = SessionsController -end - -RailsWarden.unauthenticated_action = :new - diff --git a/users/config/locales/en.yml b/users/config/locales/en.yml deleted file mode 100644 index ed6653a..0000000 --- a/users/config/locales/en.yml +++ /dev/null @@ -1,73 +0,0 @@ -en: - account_settings: "Account Settings" - logout: "Logout" - none: "None" - signup: "Sign Up" - signup_message: "Please create an account." - cancel: "Cancel" - login: "Log In" - username: "Username" - password: "Password" - change_password: "Change Password" - login_message: "Please log in with your account." - invalid_user_pass: "Not a valid username/password combination" - invalid_ephemeral: "Invalid random key used. This looked like an attempt to hack the site to us. If it wasn't please contact support so we can look into the issue." - all_strategies_failed: "Could not understand your login attempt. Please first send your login and a SRP ephemeral value A and then send the client_auth in the same session (using cookies)." - update_login_and_password: "Update Login and Password" - destroy_my_account: "Destroy my account" - destroy_account_info: "This will permanently destroy your account and all the data associated with it. Proceed with caution!" - admin_destroy_account: "Destroy the account %{username}" - account_destroyed: "The account has been destroyed successfully." - set_email_address: "Set email address" - forward_email: "Forward Email" - email_aliases: "Email Aliases" - public_key: "Public Key" - add_email_alias: "Add Email Alias" - user_updated_successfully: "Settings have been updated successfully." - user_created_successfully: "Successfully created your account." - email_alias_destroyed_successfully: "Removed email alias %{alias}." - use_ascii_key: "OpenPGP public key. Do not change this value unless you know what you are doing." - advanced_options: "Advanced Options" - not_authorized: "Sorry, but you are not authorized to perform that action." - not_authorized_login: "Please log in to perform that action." - search: "Search" - cookie_disabled_warning: "You have cookies disabled. You will not be able to login until you enable cookies." - js_required_html: "We are sorry, but this doesn't work without javascript enabled. This is because the authentication system used, SRP, requires javascript." - enable_account: "Enable the account %{username}" - enable_description: "This will restore the account to full functionality" - deactivate_account: "Deactivate the account %{username}" - deactivate_description: "This will temporarily deactivate some account functionality." #todo detail exact functionality. can receive email but not send or renew client certificate? - payment_one_month_warning: "We hope you have been enjoying this service this past month. Please sign up to pay within the next month, by %{date_in_one_month}. Directions for payment are available at INSERT_URL" - bye: "Goodbye!" - bye_message: "So long and thanks for all the fish." - - # - # overview - # - overview_welcome: "Welcome %{username}." - overview_intro: "From this user control panel, you can:" - overview_tickets: "Create and check support tickets." - overview_email: "Modify email settings." - overview_account: "Delete your account." - - # - # rails - # - activemodel: - models: - user: - one: User - other: "%{count} Users" - simple_form: - labels: - user: - email_forward: "Email Forward" - hints: - user: - email_forward: > - Forward all email messages to this address. Messages will be encrypted before being forwarded. - This is an option for advanced users who are familar with OpenPGP. - placeholders: - user: - email_forward: "my_other_email@domain.net" - 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 -- cgit v1.2.3