ispmail-on-rails 0.2.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +19 -0
- data/.rspec +2 -0
- data/.travis.yml +4 -0
- data/Gemfile +61 -0
- data/LICENSE.txt +21 -0
- data/README.md +41 -0
- data/Rakefile +6 -0
- data/app/assets/images/.keep +0 -0
- data/app/assets/javascripts/application.js +25 -0
- data/app/assets/javascripts/virtual_aliases.coffee +3 -0
- data/app/assets/javascripts/virtual_domains.coffee +3 -0
- data/app/assets/javascripts/virtual_users.coffee +3 -0
- data/app/assets/stylesheets/_settings.scss +566 -0
- data/app/assets/stylesheets/application.css +21 -0
- data/app/assets/stylesheets/clearance.scss +6 -0
- data/app/assets/stylesheets/foundation_and_overrides.scss +51 -0
- data/app/assets/stylesheets/virtual_aliases.scss +3 -0
- data/app/assets/stylesheets/virtual_domains.scss +3 -0
- data/app/assets/stylesheets/virtual_users.scss +3 -0
- data/app/controllers/api/base_controller.rb +90 -0
- data/app/controllers/api/virtual_aliases_controller.rb +12 -0
- data/app/controllers/api/virtual_domains_controller.rb +15 -0
- data/app/controllers/api/virtual_users_controller.rb +15 -0
- data/app/controllers/application_controller.rb +9 -0
- data/app/controllers/concerns/.keep +0 -0
- data/app/controllers/virtual_aliases_controller.rb +6 -0
- data/app/controllers/virtual_domains_controller.rb +6 -0
- data/app/controllers/virtual_users_controller.rb +6 -0
- data/app/helpers/application_helper.rb +33 -0
- data/app/helpers/virtual_aliases_helper.rb +2 -0
- data/app/helpers/virtual_domains_helper.rb +2 -0
- data/app/helpers/virtual_users_helper.rb +2 -0
- data/app/mailers/.keep +0 -0
- data/app/models/.keep +0 -0
- data/app/models/concerns/.keep +0 -0
- data/app/models/user.rb +3 -0
- data/app/models/virtual_alias.rb +16 -0
- data/app/models/virtual_domain.rb +22 -0
- data/app/models/virtual_user.rb +35 -0
- data/app/validators/domain_name_validator.rb +21 -0
- data/app/validators/password_validator.rb +10 -0
- data/app/views/api/virtual_aliases/index.json.jbuilder +6 -0
- data/app/views/api/virtual_aliases/show.json.jbuilder +6 -0
- data/app/views/api/virtual_domains/index.json.jbuilder +4 -0
- data/app/views/api/virtual_domains/show.json.jbuilder +4 -0
- data/app/views/api/virtual_users/index.json.jbuilder +5 -0
- data/app/views/api/virtual_users/show.json.jbuilder +5 -0
- data/app/views/application/_heading.html.erb +12 -0
- data/app/views/clearance_mailer/change_password.html.erb +8 -0
- data/app/views/clearance_mailer/change_password.text.erb +5 -0
- data/app/views/layouts/application.html.erb +41 -0
- data/app/views/passwords/create.html.erb +3 -0
- data/app/views/passwords/edit.html.erb +18 -0
- data/app/views/passwords/new.html.erb +16 -0
- data/app/views/sessions/_form.html.erb +22 -0
- data/app/views/sessions/new.html.erb +6 -0
- data/app/views/users/_form.html.erb +9 -0
- data/app/views/users/new.html.erb +15 -0
- data/app/views/virtual_aliases/index.html.erb +58 -0
- data/app/views/virtual_domains/index.html.erb +56 -0
- data/app/views/virtual_users/_password_form.html.erb +23 -0
- data/app/views/virtual_users/index.html.erb +57 -0
- data/bin/bundle +3 -0
- data/bin/console +14 -0
- data/bin/rails +9 -0
- data/bin/rake +9 -0
- data/bin/setup +29 -0
- data/bin/spring +15 -0
- data/config.ru +4 -0
- data/config/application.rb +30 -0
- data/config/boot.rb +3 -0
- data/config/database.yml +31 -0
- data/config/environment.rb +5 -0
- data/config/environments/development.rb +42 -0
- data/config/environments/production.rb +82 -0
- data/config/environments/test.rb +43 -0
- data/config/initializers/assets.rb +11 -0
- data/config/initializers/backtrace_silencers.rb +7 -0
- data/config/initializers/clearance.rb +4 -0
- data/config/initializers/cookies_serializer.rb +3 -0
- data/config/initializers/filter_parameter_logging.rb +4 -0
- data/config/initializers/inflections.rb +16 -0
- data/config/initializers/mime_types.rb +4 -0
- data/config/initializers/session_store.rb +3 -0
- data/config/initializers/wrap_parameters.rb +14 -0
- data/config/locales/clearance.en.yml +59 -0
- data/config/locales/en.yml +23 -0
- data/config/routes.rb +74 -0
- data/config/secrets.yml +22 -0
- data/db/development.sqlite3 +0 -0
- data/db/migrate/20160321130230_create_virtual_domains.rb +13 -0
- data/db/migrate/20160321130250_create_virtual_users.rb +16 -0
- data/db/migrate/20160321130353_create_virtual_aliases.rb +15 -0
- data/db/migrate/20160321133546_create_users.rb +14 -0
- data/db/schema.rb +59 -0
- data/db/seeds.rb +8 -0
- data/ispmail-on-rails.gemspec +25 -0
- data/lib/assets/.keep +0 -0
- data/lib/ispmail/on/rails.rb +9 -0
- data/lib/ispmail/on/rails/version.rb +7 -0
- data/lib/tasks/.keep +0 -0
- data/log/.keep +0 -0
- data/public/404.html +67 -0
- data/public/422.html +67 -0
- data/public/500.html +66 -0
- data/public/favicon.ico +0 -0
- data/public/robots.txt +5 -0
- data/tmp/.keep +0 -0
- data/vendor/assets/javascripts/.keep +0 -0
- data/vendor/assets/stylesheets/.keep +0 -0
- metadata +198 -0
@@ -0,0 +1,12 @@
|
|
1
|
+
<!-- domain-heading from application/_heading.html.erb -->
|
2
|
+
<div class="row domain-heading">
|
3
|
+
<div class="small-6 columns">
|
4
|
+
<h1>Virtual users for <%= @domain.name %></h1>
|
5
|
+
</div>
|
6
|
+
<div class="small-6 columns">
|
7
|
+
<p>
|
8
|
+
<%= @domain.name %> MX record does <b><%= "NOT" unless @domain.does_resolve_to_host? %></b> resolve to this server
|
9
|
+
<p>
|
10
|
+
</div>
|
11
|
+
</div>
|
12
|
+
|
@@ -0,0 +1,41 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
<html lang="en">
|
3
|
+
<head>
|
4
|
+
<meta charset="utf-8" />
|
5
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
6
|
+
|
7
|
+
<title><%= content_for?(:title) ? yield(:title) : "ISPmail" %></title>
|
8
|
+
|
9
|
+
<%= stylesheet_link_tag "application" %>
|
10
|
+
<%= javascript_include_tag "application", 'data-turbolinks-track' => true %>
|
11
|
+
<%= csrf_meta_tag %>
|
12
|
+
</head>
|
13
|
+
<body>
|
14
|
+
<div class="top-bar">
|
15
|
+
<div class="top-bar-left">
|
16
|
+
<ul class="menu">
|
17
|
+
<li class="menu-text">ISPmail for <%=Socket.gethostname %></li>
|
18
|
+
<%= content_tag :li, link_to("Virtual domains", virtual_domains_path) %>
|
19
|
+
<%= yield(:menu) %>
|
20
|
+
</ul>
|
21
|
+
</div>
|
22
|
+
|
23
|
+
<div class="top-bar-right">
|
24
|
+
<ul class="menu">
|
25
|
+
<% if signed_in? -%>
|
26
|
+
<li><%= button_to t(".sign_out"), sign_out_path, method: :delete, class: "button" %></li>
|
27
|
+
<% end -%>
|
28
|
+
</ul>
|
29
|
+
</div>
|
30
|
+
</div>
|
31
|
+
|
32
|
+
<div class="reveal" id="messages" data-reveal data-show-flash="<%=!flash.empty?%>">
|
33
|
+
<%= flash_messages flash.collect {|k,v| "<div class='callout #{k}'>#{v}</div>" }.join("\n").html_safe, !flash.alert.nil? %>
|
34
|
+
</div>
|
35
|
+
|
36
|
+
<div class="column row">
|
37
|
+
<%= yield %>
|
38
|
+
</div>
|
39
|
+
|
40
|
+
</body>
|
41
|
+
</html>
|
@@ -0,0 +1,18 @@
|
|
1
|
+
<div id="clearance" class="password-reset">
|
2
|
+
<h2><%= t(".title") %></h2>
|
3
|
+
|
4
|
+
<p><%= t(".description") %></p>
|
5
|
+
|
6
|
+
<%= form_for :password_reset,
|
7
|
+
url: user_password_path(@user, token: @user.confirmation_token),
|
8
|
+
html: { method: :put } do |form| %>
|
9
|
+
<div class="password-field">
|
10
|
+
<%= form.label :password %>
|
11
|
+
<%= form.password_field :password %>
|
12
|
+
</div>
|
13
|
+
|
14
|
+
<div class="submit-field">
|
15
|
+
<%= form.submit class: "button" %>
|
16
|
+
</div>
|
17
|
+
<% end %>
|
18
|
+
</div>
|
@@ -0,0 +1,16 @@
|
|
1
|
+
<div id="clearance" class="password-reset">
|
2
|
+
<h2><%= t(".title") %></h2>
|
3
|
+
|
4
|
+
<p><%= t(".description") %></p>
|
5
|
+
|
6
|
+
<%= form_for :password, url: passwords_path do |form| %>
|
7
|
+
<div class="text-field">
|
8
|
+
<%= form.label :email %>
|
9
|
+
<%= form.text_field :email, type: 'email' %>
|
10
|
+
</div>
|
11
|
+
|
12
|
+
<div class="submit-field">
|
13
|
+
<%= form.submit class: "button" %>
|
14
|
+
</div>
|
15
|
+
<% end %>
|
16
|
+
</div>
|
@@ -0,0 +1,22 @@
|
|
1
|
+
<%= form_for :session, url: session_path do |form| %>
|
2
|
+
<div class="text-field">
|
3
|
+
<%= form.label :email %>
|
4
|
+
<%= form.text_field :email, type: 'email' %>
|
5
|
+
</div>
|
6
|
+
|
7
|
+
<div class="password-field">
|
8
|
+
<%= form.label :password %>
|
9
|
+
<%= form.password_field :password %>
|
10
|
+
</div>
|
11
|
+
|
12
|
+
<div class="submit-field">
|
13
|
+
<%= form.submit class: "button" %>
|
14
|
+
</div>
|
15
|
+
|
16
|
+
<div class="other-links">
|
17
|
+
<% if Clearance.configuration.allow_sign_up? %>
|
18
|
+
<%= link_to t(".sign_up"), sign_up_path %>
|
19
|
+
<% end %>
|
20
|
+
<%= link_to t(".forgot_password"), new_password_path %>
|
21
|
+
</div>
|
22
|
+
<% end %>
|
@@ -0,0 +1,15 @@
|
|
1
|
+
<div id="clearance" class="sign-up">
|
2
|
+
<h2><%= t(".title") %></h2>
|
3
|
+
|
4
|
+
<%= form_for @user do |form| %>
|
5
|
+
<%= render partial: '/users/form', object: form %>
|
6
|
+
|
7
|
+
<div class="submit-field">
|
8
|
+
<%= form.submit class: "button" %>
|
9
|
+
</div>
|
10
|
+
|
11
|
+
<div class="other-links">
|
12
|
+
<%= link_to t(".sign_in"), sign_in_path %>
|
13
|
+
</div>
|
14
|
+
<% end %>
|
15
|
+
</div>
|
@@ -0,0 +1,58 @@
|
|
1
|
+
<%= content_for :menu do %>
|
2
|
+
<li><%= @domain.name %>/</li>
|
3
|
+
<li><%= link_to "users", virtual_users_path(@domain.name) %></li>
|
4
|
+
<% end %>
|
5
|
+
|
6
|
+
<div class="column row">
|
7
|
+
<%= render partial: "heading" %>
|
8
|
+
|
9
|
+
<%= form_for @virtual_alias, url: api_virtual_aliases_path, remote: true do |f| %>
|
10
|
+
<div class="input-group">
|
11
|
+
<%= f.hidden_field :domain_id %>
|
12
|
+
<%= content_tag :span, "Source", class: "input-group-label" %>
|
13
|
+
<%= f.text_field :source, class: "input-group-field", placeholder: "john@#{@domain.name}" %>
|
14
|
+
<%= content_tag :span, "Destination", class: "input-group-label" %>
|
15
|
+
<%= f.text_field :destination, class: "input-group-field", placeholder: "jill@#{@domain.name}" %>
|
16
|
+
<%= content_tag :div, class: "input-group-button" do %>
|
17
|
+
<%= f.submit class: "button" %>
|
18
|
+
<% end %>
|
19
|
+
</div>
|
20
|
+
<% end # form %>
|
21
|
+
|
22
|
+
<table>
|
23
|
+
<thead>
|
24
|
+
<tr>
|
25
|
+
<th>Source</th>
|
26
|
+
<th>Destination</th>
|
27
|
+
<th>Actions</th>
|
28
|
+
</tr>
|
29
|
+
</thead>
|
30
|
+
<tbody>
|
31
|
+
<% @domain.virtual_aliases.each do |virtual_alias| %>
|
32
|
+
<tr id="virtual_alias_<%= virtual_alias.id %>">
|
33
|
+
<%= content_tag :td, virtual_alias.source %>
|
34
|
+
<%= content_tag :td, virtual_alias.destination %>
|
35
|
+
<%= content_tag :td do %>
|
36
|
+
<%= link_to 'Delete', api_virtual_alias_path(virtual_alias),
|
37
|
+
method: :delete, remote: true, data: { confirm: "Are you sure?" } %>
|
38
|
+
<% end %>
|
39
|
+
</tr>
|
40
|
+
<% end %>
|
41
|
+
</tbody>
|
42
|
+
</table>
|
43
|
+
|
44
|
+
<script type="text/javascript">
|
45
|
+
<%= form_error_callout("new_virtual_alias") %>
|
46
|
+
|
47
|
+
$('form#new_virtual_alias').bind('ajax:success', function(evt, data, status, xhr){
|
48
|
+
$("tbody").append("<tr><td>" + data.virtual_alias.source +
|
49
|
+
"</td><td>" + data.virtual_alias.destination +
|
50
|
+
"</td></tr>");
|
51
|
+
})
|
52
|
+
|
53
|
+
$('[data-remote][data-method="delete"]').bind('ajax:success', function(evt, data, status, xhr){
|
54
|
+
$(evt.target).closest('tr').remove();
|
55
|
+
})
|
56
|
+
</script>
|
57
|
+
</div>
|
58
|
+
|
@@ -0,0 +1,56 @@
|
|
1
|
+
<div class="row">
|
2
|
+
<div class="">
|
3
|
+
<h1>Virtual domains</h1>
|
4
|
+
|
5
|
+
<%= form_for @domain, url: api_virtual_domains_path, remote: true do |f| %>
|
6
|
+
<div class="input-group">
|
7
|
+
<%= content_tag :span, "Add new virtual domain", class: "input-group-label" %>
|
8
|
+
<%= f.text_field :name, class: "input-group-field", placeholder: "example.com" %>
|
9
|
+
<%= content_tag :div, class: "input-group-button" do %>
|
10
|
+
<%= f.submit class: "button" %>
|
11
|
+
<% end %>
|
12
|
+
</div>
|
13
|
+
<% end # form %>
|
14
|
+
|
15
|
+
<table>
|
16
|
+
<thead>
|
17
|
+
<tr>
|
18
|
+
<th>Domain name</th>
|
19
|
+
<th>Does MX resolve here?</th>
|
20
|
+
<th>Number of users</th>
|
21
|
+
<th>Number of aliases</th>
|
22
|
+
<th>Actions</th>
|
23
|
+
</tr>
|
24
|
+
</thead>
|
25
|
+
<tbody>
|
26
|
+
<% @domains.each do |domain| %>
|
27
|
+
<tr>
|
28
|
+
<%= content_tag :td, link_to(domain.name, virtual_users_path(domain.name)) %>
|
29
|
+
<%= content_tag :td, domain.does_resolve_to_host? %>
|
30
|
+
<%= content_tag :td, link_to(domain.virtual_users.count, virtual_users_path(domain.name)) %>
|
31
|
+
<%= content_tag :td, link_to(domain.virtual_aliases.count, virtual_aliases_path(domain.name)) %>
|
32
|
+
<%= content_tag :td do %>
|
33
|
+
<%= link_to 'Delete', api_virtual_domain_path(domain),
|
34
|
+
method: :delete, remote: true, data: { confirm: "Are you sure?" } %>
|
35
|
+
<% end %>
|
36
|
+
</tr>
|
37
|
+
<% end %>
|
38
|
+
</tbody>
|
39
|
+
</table>
|
40
|
+
|
41
|
+
<script type="text/javascript">
|
42
|
+
<%= form_error_callout("new_virtual_domain") %>
|
43
|
+
|
44
|
+
$('form#new_virtual_domain').bind('ajax:success', function(evt, data, status, xhr){
|
45
|
+
$("tbody").append(
|
46
|
+
"<tr><td><a href='/" + data.virtual_domain.name + "/users'>" +
|
47
|
+
data.virtual_domain.name + "</a>" +
|
48
|
+
"</td></tr>");
|
49
|
+
})
|
50
|
+
|
51
|
+
$('[data-remote][data-method="delete"]').bind('ajax:success', function(evt, data, status, xhr){
|
52
|
+
$(evt.target).closest('tr').remove();
|
53
|
+
})
|
54
|
+
</script>
|
55
|
+
</div>
|
56
|
+
</div>
|
@@ -0,0 +1,23 @@
|
|
1
|
+
<h5><%= virtual_user.email %></h5>
|
2
|
+
<%= form_for virtual_user, url: api_virtual_user_path(virtual_user), remote: true do |f| %>
|
3
|
+
<div class="row">
|
4
|
+
<div class="medium-12 columns">
|
5
|
+
<%= f.hidden_field :domain_id %>
|
6
|
+
<%= f.label :new_password %>
|
7
|
+
<%= f.text_field :new_password %>
|
8
|
+
</div>
|
9
|
+
</div>
|
10
|
+
<div class="row">
|
11
|
+
<div class="medium-6 columns">
|
12
|
+
<%= f.submit "Save new password", class: "button" %>
|
13
|
+
</div>
|
14
|
+
</div>
|
15
|
+
<% end %>
|
16
|
+
|
17
|
+
<script type="text/javascript">
|
18
|
+
<%= form_error_callout("edit_virtual_user_#{virtual_user.id}") %>
|
19
|
+
|
20
|
+
$('form#edit_virtual_user_<%= virtual_user.id %>').bind('ajax:success', function(evt, data, status, xhr){
|
21
|
+
$(evt.target.parentElement).foundation('close');
|
22
|
+
})
|
23
|
+
</script>
|
@@ -0,0 +1,57 @@
|
|
1
|
+
<%= content_for :menu do %>
|
2
|
+
<li><%= @domain.name %>/</li>
|
3
|
+
<li><%= link_to "aliases", virtual_aliases_path(@domain.name) %></li>
|
4
|
+
<% end %>
|
5
|
+
|
6
|
+
<div class="column row">
|
7
|
+
<%= render partial: "heading" %>
|
8
|
+
|
9
|
+
<%= form_for @virtual_user, url: api_virtual_users_path, remote: true do |f| %>
|
10
|
+
<div class="input-group">
|
11
|
+
<%= f.hidden_field :domain_id %>
|
12
|
+
<%= content_tag :span, "Add new virtual user", class: "input-group-label" %>
|
13
|
+
<%= f.text_field :email, class: "input-group-field", placeholder: "john@example.com" %>
|
14
|
+
<%= content_tag :span, "Password", class: "input-group-label" %>
|
15
|
+
<%= f.text_field :new_password, class: "input-group-field" %>
|
16
|
+
<%= content_tag :div, class: "input-group-button" do %>
|
17
|
+
<%= f.submit class: "button" %>
|
18
|
+
<% end %>
|
19
|
+
</div>
|
20
|
+
<% end # form %>
|
21
|
+
|
22
|
+
<table>
|
23
|
+
<thead>
|
24
|
+
<tr>
|
25
|
+
<th>Email</th>
|
26
|
+
<th>Actions</th>
|
27
|
+
</tr>
|
28
|
+
</thead>
|
29
|
+
<tbody>
|
30
|
+
<% @domain.virtual_users.each do |user| %>
|
31
|
+
<tr id="virtual_user_<%= user.id %>">
|
32
|
+
<%= content_tag :td, user.email %>
|
33
|
+
<%= content_tag :td do %>
|
34
|
+
<%= link_to "Delete", api_virtual_user_path(user), class: "warning",
|
35
|
+
method: :delete, remote: true, data: { confirm: "Are you sure?" } %>
|
36
|
+
<%= link_to "Change password", "#", "data-toggle" => "change_user_#{user.id}" %>
|
37
|
+
<div class="dropdown-pane top" id="<%= "change_user_#{user.id}" %>" data-dropdown data-close-on-click=true>
|
38
|
+
<%= render partial: "password_form", locals: { virtual_user: user } %>
|
39
|
+
</div>
|
40
|
+
<% end %>
|
41
|
+
</tr>
|
42
|
+
<% end %>
|
43
|
+
</tbody>
|
44
|
+
</table>
|
45
|
+
|
46
|
+
<script type="text/javascript">
|
47
|
+
<%= form_error_callout("new_virtual_user") %>
|
48
|
+
|
49
|
+
$('form#new_virtual_user').bind('ajax:success', function(evt, data, status, xhr){
|
50
|
+
$("tbody").append("<tr><td>" + data.virtual_user.email + "</td></tr>");
|
51
|
+
})
|
52
|
+
|
53
|
+
$('[data-remote][data-method="delete"]').bind('ajax:success', function(evt, data, status, xhr){
|
54
|
+
$(evt.target).closest('tr').remove();
|
55
|
+
})
|
56
|
+
</script>
|
57
|
+
</div>
|
data/bin/bundle
ADDED
data/bin/console
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require "bundler/setup"
|
4
|
+
require "ispmail/on/rails"
|
5
|
+
|
6
|
+
# You can add fixtures and/or initialization code here to make experimenting
|
7
|
+
# with your gem easier. You can also use a different console, if you like.
|
8
|
+
|
9
|
+
# (If you use this, don't forget to add pry to your Gemfile!)
|
10
|
+
# require "pry"
|
11
|
+
# Pry.start
|
12
|
+
|
13
|
+
require "irb"
|
14
|
+
IRB.start
|
data/bin/rails
ADDED
@@ -0,0 +1,9 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
begin
|
3
|
+
load File.expand_path('../spring', __FILE__)
|
4
|
+
rescue LoadError => e
|
5
|
+
raise unless e.message.include?('spring')
|
6
|
+
end
|
7
|
+
APP_PATH = File.expand_path('../../config/application', __FILE__)
|
8
|
+
require_relative '../config/boot'
|
9
|
+
require 'rails/commands'
|