ispmail-on-rails 0.2.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (112) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +19 -0
  3. data/.rspec +2 -0
  4. data/.travis.yml +4 -0
  5. data/Gemfile +61 -0
  6. data/LICENSE.txt +21 -0
  7. data/README.md +41 -0
  8. data/Rakefile +6 -0
  9. data/app/assets/images/.keep +0 -0
  10. data/app/assets/javascripts/application.js +25 -0
  11. data/app/assets/javascripts/virtual_aliases.coffee +3 -0
  12. data/app/assets/javascripts/virtual_domains.coffee +3 -0
  13. data/app/assets/javascripts/virtual_users.coffee +3 -0
  14. data/app/assets/stylesheets/_settings.scss +566 -0
  15. data/app/assets/stylesheets/application.css +21 -0
  16. data/app/assets/stylesheets/clearance.scss +6 -0
  17. data/app/assets/stylesheets/foundation_and_overrides.scss +51 -0
  18. data/app/assets/stylesheets/virtual_aliases.scss +3 -0
  19. data/app/assets/stylesheets/virtual_domains.scss +3 -0
  20. data/app/assets/stylesheets/virtual_users.scss +3 -0
  21. data/app/controllers/api/base_controller.rb +90 -0
  22. data/app/controllers/api/virtual_aliases_controller.rb +12 -0
  23. data/app/controllers/api/virtual_domains_controller.rb +15 -0
  24. data/app/controllers/api/virtual_users_controller.rb +15 -0
  25. data/app/controllers/application_controller.rb +9 -0
  26. data/app/controllers/concerns/.keep +0 -0
  27. data/app/controllers/virtual_aliases_controller.rb +6 -0
  28. data/app/controllers/virtual_domains_controller.rb +6 -0
  29. data/app/controllers/virtual_users_controller.rb +6 -0
  30. data/app/helpers/application_helper.rb +33 -0
  31. data/app/helpers/virtual_aliases_helper.rb +2 -0
  32. data/app/helpers/virtual_domains_helper.rb +2 -0
  33. data/app/helpers/virtual_users_helper.rb +2 -0
  34. data/app/mailers/.keep +0 -0
  35. data/app/models/.keep +0 -0
  36. data/app/models/concerns/.keep +0 -0
  37. data/app/models/user.rb +3 -0
  38. data/app/models/virtual_alias.rb +16 -0
  39. data/app/models/virtual_domain.rb +22 -0
  40. data/app/models/virtual_user.rb +35 -0
  41. data/app/validators/domain_name_validator.rb +21 -0
  42. data/app/validators/password_validator.rb +10 -0
  43. data/app/views/api/virtual_aliases/index.json.jbuilder +6 -0
  44. data/app/views/api/virtual_aliases/show.json.jbuilder +6 -0
  45. data/app/views/api/virtual_domains/index.json.jbuilder +4 -0
  46. data/app/views/api/virtual_domains/show.json.jbuilder +4 -0
  47. data/app/views/api/virtual_users/index.json.jbuilder +5 -0
  48. data/app/views/api/virtual_users/show.json.jbuilder +5 -0
  49. data/app/views/application/_heading.html.erb +12 -0
  50. data/app/views/clearance_mailer/change_password.html.erb +8 -0
  51. data/app/views/clearance_mailer/change_password.text.erb +5 -0
  52. data/app/views/layouts/application.html.erb +41 -0
  53. data/app/views/passwords/create.html.erb +3 -0
  54. data/app/views/passwords/edit.html.erb +18 -0
  55. data/app/views/passwords/new.html.erb +16 -0
  56. data/app/views/sessions/_form.html.erb +22 -0
  57. data/app/views/sessions/new.html.erb +6 -0
  58. data/app/views/users/_form.html.erb +9 -0
  59. data/app/views/users/new.html.erb +15 -0
  60. data/app/views/virtual_aliases/index.html.erb +58 -0
  61. data/app/views/virtual_domains/index.html.erb +56 -0
  62. data/app/views/virtual_users/_password_form.html.erb +23 -0
  63. data/app/views/virtual_users/index.html.erb +57 -0
  64. data/bin/bundle +3 -0
  65. data/bin/console +14 -0
  66. data/bin/rails +9 -0
  67. data/bin/rake +9 -0
  68. data/bin/setup +29 -0
  69. data/bin/spring +15 -0
  70. data/config.ru +4 -0
  71. data/config/application.rb +30 -0
  72. data/config/boot.rb +3 -0
  73. data/config/database.yml +31 -0
  74. data/config/environment.rb +5 -0
  75. data/config/environments/development.rb +42 -0
  76. data/config/environments/production.rb +82 -0
  77. data/config/environments/test.rb +43 -0
  78. data/config/initializers/assets.rb +11 -0
  79. data/config/initializers/backtrace_silencers.rb +7 -0
  80. data/config/initializers/clearance.rb +4 -0
  81. data/config/initializers/cookies_serializer.rb +3 -0
  82. data/config/initializers/filter_parameter_logging.rb +4 -0
  83. data/config/initializers/inflections.rb +16 -0
  84. data/config/initializers/mime_types.rb +4 -0
  85. data/config/initializers/session_store.rb +3 -0
  86. data/config/initializers/wrap_parameters.rb +14 -0
  87. data/config/locales/clearance.en.yml +59 -0
  88. data/config/locales/en.yml +23 -0
  89. data/config/routes.rb +74 -0
  90. data/config/secrets.yml +22 -0
  91. data/db/development.sqlite3 +0 -0
  92. data/db/migrate/20160321130230_create_virtual_domains.rb +13 -0
  93. data/db/migrate/20160321130250_create_virtual_users.rb +16 -0
  94. data/db/migrate/20160321130353_create_virtual_aliases.rb +15 -0
  95. data/db/migrate/20160321133546_create_users.rb +14 -0
  96. data/db/schema.rb +59 -0
  97. data/db/seeds.rb +8 -0
  98. data/ispmail-on-rails.gemspec +25 -0
  99. data/lib/assets/.keep +0 -0
  100. data/lib/ispmail/on/rails.rb +9 -0
  101. data/lib/ispmail/on/rails/version.rb +7 -0
  102. data/lib/tasks/.keep +0 -0
  103. data/log/.keep +0 -0
  104. data/public/404.html +67 -0
  105. data/public/422.html +67 -0
  106. data/public/500.html +66 -0
  107. data/public/favicon.ico +0 -0
  108. data/public/robots.txt +5 -0
  109. data/tmp/.keep +0 -0
  110. data/vendor/assets/javascripts/.keep +0 -0
  111. data/vendor/assets/stylesheets/.keep +0 -0
  112. metadata +198 -0
@@ -0,0 +1,74 @@
1
+ Rails.application.routes.draw do
2
+ get ":id/users", to: "virtual_users#index", as: :virtual_users, id: /\S+\.\S+/
3
+ get ":id/aliases", to: "virtual_aliases#index", as: :virtual_aliases, id: /\S+\.\S+/
4
+
5
+ resources :virtual_domains do
6
+ resources :virtual_users
7
+ resources :virtual_aliases
8
+ end
9
+
10
+ namespace :api do
11
+ resources :virtual_domains, :virtual_users, :virtual_aliases
12
+ end
13
+
14
+ # The priority is based upon order of creation: first created -> highest priority.
15
+ # See how all your routes lay out with "rake routes".
16
+
17
+ # You can have the root of your site routed with "root"
18
+ constraints Clearance::Constraints::SignedIn.new do
19
+ root 'virtual_domains#index', as: :admin_root
20
+ end
21
+
22
+ constraints Clearance::Constraints::SignedOut.new do
23
+ root to: 'clearance/sessions#new'
24
+ end
25
+
26
+ # Example of regular route:
27
+ # get 'products/:id' => 'catalog#view'
28
+
29
+ # Example of named route that can be invoked with purchase_url(id: product.id)
30
+ # get 'products/:id/purchase' => 'catalog#purchase', as: :purchase
31
+
32
+ # Example resource route (maps HTTP verbs to controller actions automatically):
33
+ # resources :products
34
+
35
+ # Example resource route with options:
36
+ # resources :products do
37
+ # member do
38
+ # get 'short'
39
+ # post 'toggle'
40
+ # end
41
+ #
42
+ # collection do
43
+ # get 'sold'
44
+ # end
45
+ # end
46
+
47
+ # Example resource route with sub-resources:
48
+ # resources :products do
49
+ # resources :comments, :sales
50
+ # resource :seller
51
+ # end
52
+
53
+ # Example resource route with more complex sub-resources:
54
+ # resources :products do
55
+ # resources :comments
56
+ # resources :sales do
57
+ # get 'recent', on: :collection
58
+ # end
59
+ # end
60
+
61
+ # Example resource route with concerns:
62
+ # concern :toggleable do
63
+ # post 'toggle'
64
+ # end
65
+ # resources :posts, concerns: :toggleable
66
+ # resources :photos, concerns: :toggleable
67
+
68
+ # Example resource route within a namespace:
69
+ # namespace :admin do
70
+ # # Directs /admin/products/* to Admin::ProductsController
71
+ # # (app/controllers/admin/products_controller.rb)
72
+ # resources :products
73
+ # end
74
+ end
@@ -0,0 +1,22 @@
1
+ # Be sure to restart your server when you modify this file.
2
+
3
+ # Your secret key is used for verifying the integrity of signed cookies.
4
+ # If you change this key, all old signed cookies will become invalid!
5
+
6
+ # Make sure the secret is at least 30 characters and all random,
7
+ # no regular words or you'll be exposed to dictionary attacks.
8
+ # You can use `rake secret` to generate a secure secret key.
9
+
10
+ # Make sure the secrets in this file are kept private
11
+ # if you're sharing your code publicly.
12
+
13
+ development:
14
+ secret_key_base: ed6c02aa51d851ec5796d455717508678a714d9d35f3ec971e4535a23231b07f130a8ff034a1ac0776976f59928392256e20e75e6195d095847a21fdeb564fc2
15
+
16
+ test:
17
+ secret_key_base: 22671ed3f62b1b1735764d2bf98e8f72812025f55e9a0b0cdbb9a27e50618be012efb7aaeedeec36bbed2cb60015b55f04dd27738ff00aa2a44389254f53155a
18
+
19
+ # Do not keep production secrets in the repository,
20
+ # instead read values from the environment.
21
+ production:
22
+ secret_key_base: <%= ENV["SECRET_KEY_BASE"] %>
Binary file
@@ -0,0 +1,13 @@
1
+ class CreateVirtualDomains < ActiveRecord::Migration
2
+ def change
3
+ begin
4
+ create_table :virtual_domains do |t|
5
+ t.string :name, null: false
6
+
7
+ t.timestamps null: false
8
+ end
9
+ add_index :domains, :name, unique: true
10
+ rescue
11
+ end
12
+ end
13
+ end
@@ -0,0 +1,16 @@
1
+ class CreateVirtualUsers < ActiveRecord::Migration
2
+ def change
3
+ begin
4
+ create_table :virtual_users do |t|
5
+ t.references :domain, index: true, null: false
6
+ t.string :password, null: false
7
+ t.string :email, null: false
8
+
9
+ t.timestamps null: false
10
+ end
11
+ add_index :virtual_users, :email, unique: true
12
+ add_foreign_key :virtual_users, :domains, on_delete: :cascade
13
+ rescue
14
+ end
15
+ end
16
+ end
@@ -0,0 +1,15 @@
1
+ class CreateVirtualAliases < ActiveRecord::Migration
2
+ def change
3
+ begin
4
+ create_table :virtual_aliases do |t|
5
+ t.references :domain, index: true, null: false
6
+ t.string :source, null: false
7
+ t.string :destination, null: false
8
+
9
+ t.timestamps null: false
10
+ end
11
+ add_foreign_key :virtual_aliases, :domains, on_delete: :cascade
12
+ rescue
13
+ end
14
+ end
15
+ end
@@ -0,0 +1,14 @@
1
+ class CreateUsers < ActiveRecord::Migration
2
+ def change
3
+ create_table :users do |t|
4
+ t.timestamps null: false
5
+ t.string :email, null: false
6
+ t.string :encrypted_password, limit: 128, null: false
7
+ t.string :confirmation_token, limit: 128
8
+ t.string :remember_token, limit: 128, null: false
9
+ end
10
+
11
+ add_index :users, :email
12
+ add_index :users, :remember_token
13
+ end
14
+ end
@@ -0,0 +1,59 @@
1
+ # encoding: UTF-8
2
+ # This file is auto-generated from the current state of the database. Instead
3
+ # of editing this file, please use the migrations feature of Active Record to
4
+ # incrementally modify your database, and then regenerate this schema definition.
5
+ #
6
+ # Note that this schema.rb definition is the authoritative source for your
7
+ # database schema. If you need to create the application database on another
8
+ # system, you should be using db:schema:load, not running all the migrations
9
+ # from scratch. The latter is a flawed and unsustainable approach (the more migrations
10
+ # you'll amass, the slower it'll run and the greater likelihood for issues).
11
+ #
12
+ # It's strongly recommended that you check this file into your version control system.
13
+
14
+ ActiveRecord::Schema.define(version: 20160321133546) do
15
+
16
+ create_table "domains", force: :cascade do |t|
17
+ t.string "name", limit: 255, null: false
18
+ t.datetime "created_at", null: false
19
+ t.datetime "updated_at", null: false
20
+ end
21
+
22
+ add_index "domains", ["name"], name: "index_domains_on_name", unique: true, using: :btree
23
+
24
+ create_table "users", force: :cascade do |t|
25
+ t.datetime "created_at", null: false
26
+ t.datetime "updated_at", null: false
27
+ t.string "email", limit: 255, null: false
28
+ t.string "encrypted_password", limit: 128, null: false
29
+ t.string "confirmation_token", limit: 128
30
+ t.string "remember_token", limit: 128, null: false
31
+ end
32
+
33
+ add_index "users", ["email"], name: "index_users_on_email", using: :btree
34
+ add_index "users", ["remember_token"], name: "index_users_on_remember_token", using: :btree
35
+
36
+ create_table "virtual_aliases", force: :cascade do |t|
37
+ t.integer "domain_id", limit: 4, null: false
38
+ t.string "source", limit: 255, null: false
39
+ t.string "destination", limit: 255, null: false
40
+ t.datetime "created_at", null: false
41
+ t.datetime "updated_at", null: false
42
+ end
43
+
44
+ add_index "virtual_aliases", ["domain_id"], name: "index_virtual_aliases_on_domain_id", using: :btree
45
+
46
+ create_table "virtual_users", force: :cascade do |t|
47
+ t.integer "domain_id", limit: 4, null: false
48
+ t.string "password", limit: 255, null: false
49
+ t.string "email", limit: 255, null: false
50
+ t.datetime "created_at", null: false
51
+ t.datetime "updated_at", null: false
52
+ end
53
+
54
+ add_index "virtual_users", ["domain_id"], name: "index_virtual_users_on_domain_id", using: :btree
55
+ add_index "virtual_users", ["email"], name: "index_virtual_users_on_email", unique: true, using: :btree
56
+
57
+ add_foreign_key "virtual_aliases", "domains", on_delete: :cascade
58
+ add_foreign_key "virtual_users", "domains", on_delete: :cascade
59
+ end
@@ -0,0 +1,8 @@
1
+ # This file should contain all the record creation needed to seed the database with its default values.
2
+ # The data can then be loaded with the rake db:seed (or created alongside the db with db:setup).
3
+ #
4
+ # Examples:
5
+ #
6
+ # cities = City.create([{ name: 'Chicago' }, { name: 'Copenhagen' }])
7
+ # Mayor.create(name: 'Emanuel', city: cities.first)
8
+ User.create(email: "admin@example.com", password: "example")
@@ -0,0 +1,25 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'ispmail/on/rails/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "ispmail-on-rails"
8
+ spec.version = Ispmail::On::Rails::VERSION
9
+ spec.authors = ["Runar Ingebrigtsen"]
10
+ spec.email = ["runar@rin.no"]
11
+
12
+ spec.summary = %q{Rails app to manage ISPMAIL}
13
+ spec.description = %q{This Rails app is a web admin interface for https://workaround.org/ispmail/jessie/}
14
+ spec.homepage = "http://github.com/ringe/ispmail-on-rails"
15
+ spec.license = "MIT"
16
+
17
+ spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
18
+ spec.bindir = "exe"
19
+ spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
20
+ spec.require_paths = ["lib"]
21
+
22
+ spec.add_development_dependency "bundler", "~> 1.11"
23
+ spec.add_development_dependency "rake", "~> 10.0"
24
+ spec.add_development_dependency "rspec", "~> 3.0"
25
+ end
File without changes
@@ -0,0 +1,9 @@
1
+ require "ispmail/on/rails/version"
2
+
3
+ module Ispmail
4
+ module On
5
+ module Rails
6
+ # Your code goes here...
7
+ end
8
+ end
9
+ end
@@ -0,0 +1,7 @@
1
+ module Ispmail
2
+ module On
3
+ module Rails
4
+ VERSION = "0.2.2"
5
+ end
6
+ end
7
+ end
File without changes
File without changes
@@ -0,0 +1,67 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <title>The page you were looking for doesn't exist (404)</title>
5
+ <meta name="viewport" content="width=device-width,initial-scale=1">
6
+ <style>
7
+ body {
8
+ background-color: #EFEFEF;
9
+ color: #2E2F30;
10
+ text-align: center;
11
+ font-family: arial, sans-serif;
12
+ margin: 0;
13
+ }
14
+
15
+ div.dialog {
16
+ width: 95%;
17
+ max-width: 33em;
18
+ margin: 4em auto 0;
19
+ }
20
+
21
+ div.dialog > div {
22
+ border: 1px solid #CCC;
23
+ border-right-color: #999;
24
+ border-left-color: #999;
25
+ border-bottom-color: #BBB;
26
+ border-top: #B00100 solid 4px;
27
+ border-top-left-radius: 9px;
28
+ border-top-right-radius: 9px;
29
+ background-color: white;
30
+ padding: 7px 12% 0;
31
+ box-shadow: 0 3px 8px rgba(50, 50, 50, 0.17);
32
+ }
33
+
34
+ h1 {
35
+ font-size: 100%;
36
+ color: #730E15;
37
+ line-height: 1.5em;
38
+ }
39
+
40
+ div.dialog > p {
41
+ margin: 0 0 1em;
42
+ padding: 1em;
43
+ background-color: #F7F7F7;
44
+ border: 1px solid #CCC;
45
+ border-right-color: #999;
46
+ border-left-color: #999;
47
+ border-bottom-color: #999;
48
+ border-bottom-left-radius: 4px;
49
+ border-bottom-right-radius: 4px;
50
+ border-top-color: #DADADA;
51
+ color: #666;
52
+ box-shadow: 0 3px 8px rgba(50, 50, 50, 0.17);
53
+ }
54
+ </style>
55
+ </head>
56
+
57
+ <body>
58
+ <!-- This file lives in public/404.html -->
59
+ <div class="dialog">
60
+ <div>
61
+ <h1>The page you were looking for doesn't exist.</h1>
62
+ <p>You may have mistyped the address or the page may have moved.</p>
63
+ </div>
64
+ <p>If you are the application owner check the logs for more information.</p>
65
+ </div>
66
+ </body>
67
+ </html>
@@ -0,0 +1,67 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <title>The change you wanted was rejected (422)</title>
5
+ <meta name="viewport" content="width=device-width,initial-scale=1">
6
+ <style>
7
+ body {
8
+ background-color: #EFEFEF;
9
+ color: #2E2F30;
10
+ text-align: center;
11
+ font-family: arial, sans-serif;
12
+ margin: 0;
13
+ }
14
+
15
+ div.dialog {
16
+ width: 95%;
17
+ max-width: 33em;
18
+ margin: 4em auto 0;
19
+ }
20
+
21
+ div.dialog > div {
22
+ border: 1px solid #CCC;
23
+ border-right-color: #999;
24
+ border-left-color: #999;
25
+ border-bottom-color: #BBB;
26
+ border-top: #B00100 solid 4px;
27
+ border-top-left-radius: 9px;
28
+ border-top-right-radius: 9px;
29
+ background-color: white;
30
+ padding: 7px 12% 0;
31
+ box-shadow: 0 3px 8px rgba(50, 50, 50, 0.17);
32
+ }
33
+
34
+ h1 {
35
+ font-size: 100%;
36
+ color: #730E15;
37
+ line-height: 1.5em;
38
+ }
39
+
40
+ div.dialog > p {
41
+ margin: 0 0 1em;
42
+ padding: 1em;
43
+ background-color: #F7F7F7;
44
+ border: 1px solid #CCC;
45
+ border-right-color: #999;
46
+ border-left-color: #999;
47
+ border-bottom-color: #999;
48
+ border-bottom-left-radius: 4px;
49
+ border-bottom-right-radius: 4px;
50
+ border-top-color: #DADADA;
51
+ color: #666;
52
+ box-shadow: 0 3px 8px rgba(50, 50, 50, 0.17);
53
+ }
54
+ </style>
55
+ </head>
56
+
57
+ <body>
58
+ <!-- This file lives in public/422.html -->
59
+ <div class="dialog">
60
+ <div>
61
+ <h1>The change you wanted was rejected.</h1>
62
+ <p>Maybe you tried to change something you didn't have access to.</p>
63
+ </div>
64
+ <p>If you are the application owner check the logs for more information.</p>
65
+ </div>
66
+ </body>
67
+ </html>
@@ -0,0 +1,66 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <title>We're sorry, but something went wrong (500)</title>
5
+ <meta name="viewport" content="width=device-width,initial-scale=1">
6
+ <style>
7
+ body {
8
+ background-color: #EFEFEF;
9
+ color: #2E2F30;
10
+ text-align: center;
11
+ font-family: arial, sans-serif;
12
+ margin: 0;
13
+ }
14
+
15
+ div.dialog {
16
+ width: 95%;
17
+ max-width: 33em;
18
+ margin: 4em auto 0;
19
+ }
20
+
21
+ div.dialog > div {
22
+ border: 1px solid #CCC;
23
+ border-right-color: #999;
24
+ border-left-color: #999;
25
+ border-bottom-color: #BBB;
26
+ border-top: #B00100 solid 4px;
27
+ border-top-left-radius: 9px;
28
+ border-top-right-radius: 9px;
29
+ background-color: white;
30
+ padding: 7px 12% 0;
31
+ box-shadow: 0 3px 8px rgba(50, 50, 50, 0.17);
32
+ }
33
+
34
+ h1 {
35
+ font-size: 100%;
36
+ color: #730E15;
37
+ line-height: 1.5em;
38
+ }
39
+
40
+ div.dialog > p {
41
+ margin: 0 0 1em;
42
+ padding: 1em;
43
+ background-color: #F7F7F7;
44
+ border: 1px solid #CCC;
45
+ border-right-color: #999;
46
+ border-left-color: #999;
47
+ border-bottom-color: #999;
48
+ border-bottom-left-radius: 4px;
49
+ border-bottom-right-radius: 4px;
50
+ border-top-color: #DADADA;
51
+ color: #666;
52
+ box-shadow: 0 3px 8px rgba(50, 50, 50, 0.17);
53
+ }
54
+ </style>
55
+ </head>
56
+
57
+ <body>
58
+ <!-- This file lives in public/500.html -->
59
+ <div class="dialog">
60
+ <div>
61
+ <h1>We're sorry, but something went wrong.</h1>
62
+ </div>
63
+ <p>If you are the application owner check the logs for more information.</p>
64
+ </div>
65
+ </body>
66
+ </html>