diff --git a/app/models/user.rb b/app/models/user.rb
index ab50e5e..4699129 100644
--- a/app/models/user.rb
+++ b/app/models/user.rb
@@ -9,7 +9,7 @@ class User < ActiveRecord::Base
attr_accessible :email, :password, :password_confirmation, :remember_me
require 'open-uri'
- attr_accessible :card_id, :card_number, :card_permissions, :name
+ attr_accessible :card_id, :card_number, :card_permissions, :name, :admin
validates_uniqueness_of :card_id, :card_number
diff --git a/app/views/users/_form.html.erb b/app/views/users/_form.html.erb
index 5af47f9..44b309d 100644
--- a/app/views/users/_form.html.erb
+++ b/app/views/users/_form.html.erb
@@ -39,7 +39,11 @@
<%= f.label :card_permissions %>
- <%= f.select :card_permissions, [["Enabled",1],["Disabled",255]] %>
+ <%= f.select :card_permissions, [["Enabled",1],["Disabled",255]] %>
+
+
+ <%= f.label :admin, "Admin?" %>
+ <%= f.check_box :admin %>
<%= f.submit %>
diff --git a/app/views/users/index.html.erb b/app/views/users/index.html.erb
index 22c33aa..ad70def 100644
--- a/app/views/users/index.html.erb
+++ b/app/views/users/index.html.erb
@@ -7,7 +7,8 @@
Name |
Card DB ID |
Card Number |
- Permissions |
+ Card Access |
+ Admin? |
|
|
|
@@ -19,7 +20,8 @@
<%= user.name %> |
<%= user.card_id %> |
<%= user.card_number %> |
- <%= user.card_permissions %> |
+ <%= if user.card_permissions == 1 then "Enabled" else "Disabled" end %> |
+ <%= if user.admin? then "Admin" end %> |
<%= link_to 'Upload', upload_path(user) %> |
<%= link_to 'Edit', edit_user_path(user) %> |
<%= link_to 'Destroy', user, :confirm => 'Are you sure? WARNING: THIS DOES NOT REMOVE THE USER FROM THE DOOR SYSTEM! DISABLE THEM FIRST.', :method => :delete %> |
diff --git a/config/config.yml.example b/config/config.yml.example
index f06dac0..3a4e7d7 100644
--- a/config/config.yml.example
+++ b/config/config.yml.example
@@ -1,11 +1,32 @@
development:
door_access_url: "http://192.168.1.177"
door_access_password: "1234"
+ smtp_tls: true
+ smtp_address: "smtp.gmail.com"
+ smtp_port: 587
+ smtp_domain: "gmail.com"
+ smtp_authentication: "login"
+ smtp_user: ""
+ smtp_password: ""
test:
door_access_url: "http://192.168.1.177"
door_access_password: "1234"
+ smtp_tls: true
+ smtp_address: "smtp.gmail.com"
+ smtp_port: 587
+ smtp_domain: "gmail.com"
+ smtp_authentication: "login"
+ smtp_user: ""
+ smtp_password: ""
production:
door_access_url: "http://192.168.1.177"
door_access_password: "1234"
+ smtp_tls: true
+ smtp_address: "smtp.gmail.com"
+ smtp_port: 587
+ smtp_domain: "gmail.com"
+ smtp_authentication: "login"
+ smtp_user: ""
+ smtp_password: ""
diff --git a/config/initializers/load_config.rb b/config/initializers/load_config.rb
index e687429..40468ec 100644
--- a/config/initializers/load_config.rb
+++ b/config/initializers/load_config.rb
@@ -1 +1,13 @@
APP_CONFIG = YAML.load_file("#{Rails.root}/config/config.yml")[Rails.env]
+
+ActionMailer::Base.delivery_method = :smtp
+ActionMailer::Base.smtp_settings = {
+ :tls => APP_CONFIG['smtp_tls'],
+ :address => APP_CONFIG['smtp_address'],
+ :port => APP_CONFIG['smtp_port'],
+ :domain => APP_CONFIG['smtp_domain'],
+ :authentication => APP_CONFIG['smtp_authentication'],
+ :user_name => APP_CONFIG['smtp_user'],
+ :password => APP_CONFIG['smtp_password']
+ }
+