Getting mailer working

This commit is contained in:
Will Bradley 2012-09-15 23:43:19 -07:00
parent daa202131c
commit cd4f689400
5 changed files with 43 additions and 4 deletions

View File

@ -9,7 +9,7 @@ class User < ActiveRecord::Base
attr_accessible :email, :password, :password_confirmation, :remember_me attr_accessible :email, :password, :password_confirmation, :remember_me
require 'open-uri' 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 validates_uniqueness_of :card_id, :card_number

View File

@ -39,7 +39,11 @@
</div> </div>
<div class="field"> <div class="field">
<%= f.label :card_permissions %><br /> <%= f.label :card_permissions %><br />
<%= f.select :card_permissions, [["Enabled",1],["Disabled",255]] %> <%= f.select :card_permissions, [["Enabled",1],["Disabled",255]] %>
</div>
<div class="field">
<%= f.label :admin, "Admin?" %><br />
<%= f.check_box :admin %>
</div> </div>
<div class="actions"> <div class="actions">
<%= f.submit %> <%= f.submit %>

View File

@ -7,7 +7,8 @@
<th>Name</th> <th>Name</th>
<th>Card DB ID</th> <th>Card DB ID</th>
<th>Card Number</th> <th>Card Number</th>
<th>Permissions</th> <th>Card Access</th>
<th>Admin?</th>
<th></th> <th></th>
<th></th> <th></th>
<th></th> <th></th>
@ -19,7 +20,8 @@
<td><%= user.name %></td> <td><%= user.name %></td>
<td><%= user.card_id %></td> <td><%= user.card_id %></td>
<td><%= user.card_number %></td> <td><%= user.card_number %></td>
<td><%= user.card_permissions %></td> <td><%= if user.card_permissions == 1 then "Enabled" else "Disabled" end %></td>
<td><%= if user.admin? then "Admin" end %></td>
<td><%= link_to 'Upload', upload_path(user) %></td> <td><%= link_to 'Upload', upload_path(user) %></td>
<td><%= link_to 'Edit', edit_user_path(user) %></td> <td><%= link_to 'Edit', edit_user_path(user) %></td>
<td><%= link_to 'Destroy', user, :confirm => 'Are you sure? WARNING: THIS DOES NOT REMOVE THE USER FROM THE DOOR SYSTEM! DISABLE THEM FIRST.', :method => :delete %></td> <td><%= link_to 'Destroy', user, :confirm => 'Are you sure? WARNING: THIS DOES NOT REMOVE THE USER FROM THE DOOR SYSTEM! DISABLE THEM FIRST.', :method => :delete %></td>

View File

@ -1,11 +1,32 @@
development: development:
door_access_url: "http://192.168.1.177" door_access_url: "http://192.168.1.177"
door_access_password: "1234" 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: test:
door_access_url: "http://192.168.1.177" door_access_url: "http://192.168.1.177"
door_access_password: "1234" 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: production:
door_access_url: "http://192.168.1.177" door_access_url: "http://192.168.1.177"
door_access_password: "1234" 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: ""

View File

@ -1 +1,13 @@
APP_CONFIG = YAML.load_file("#{Rails.root}/config/config.yml")[Rails.env] 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']
}