Browse Source

less spammy emails

pull/1/head
Nicolae Claudius 13 years ago
parent
commit
b2b897324d
  1. 5
      app/models/user.rb
  2. 12
      app/views/devise/mailer/confirmation_instructions.html.erb
  3. 13
      app/views/devise/mailer/reset_password_instructions.html.erb
  4. 7
      app/views/devise/mailer/unlock_instructions.html.erb
  5. 63
      app/views/layouts/emails.html.erb
  6. 4
      config/application.rb

5
app/models/user.rb

@ -17,4 +17,9 @@ class User < ActiveRecord::Base
attr_accessible :email, :password, :password_confirmation, :remember_me, :first_name, :last_name
has_many :records
def name
first_name + ' ' + last_name
end
end

12
app/views/devise/mailer/confirmation_instructions.html.erb

@ -1,5 +1,13 @@
<p>Welcome <%= @resource.email %>!</p>
<p>Welcome <%= @resource.name %>!</p>
<p>You can confirm your account through the link below:</p>
<p><%= link_to 'Confirm my account', confirmation_url(@resource, :confirmation_token => @resource.confirmation_token) %></p>
<p>
<%= link_to 'Confirm my account',
confirmation_url(@resource, :confirmation_token => @resource.confirmation_token) %>
</p>
<p>
If you cannot see the link copy and paste the following address in your browser address bar:<br />
<%= confirmation_url(@resource, :confirmation_token => @resource.confirmation_token) %>
</p>

13
app/views/devise/mailer/reset_password_instructions.html.erb

@ -1,8 +1,17 @@
<p>Hello <%= @resource.email %>!</p>
<p>Hello <%= @resource.name %>!</p>
<p>Someone has requested a link to change your password, and you can do this through the link below.</p>
<p><%= link_to 'Change my password', edit_password_url(@resource, :reset_password_token => @resource.reset_password_token) %></p>
<p>
<%= link_to 'Change my password',
edit_password_url(@resource, :reset_password_token => @resource.reset_password_token) %>
</p>
<p>
If you cannot see the link copy and paste the following address in your browser address bar:<br />
<%= edit_password_url(@resource, :reset_password_token => @resource.reset_password_token) %>
</p>
<p>If you didn't request this, please ignore this email.</p>
<p>Your password won't change until you access the link above and create a new one.</p>

7
app/views/devise/mailer/unlock_instructions.html.erb

@ -1,7 +1,12 @@
<p>Hello <%= @resource.email %>!</p>
<p>Hello <%= @resource.name %>!</p>
<p>Your account has been locked due to an excessive amount of unsuccessful sign in attempts.</p>
<p>Click the link below to unlock your account:</p>
<p><%= link_to 'Unlock my account', unlock_url(@resource, :unlock_token => @resource.unlock_token) %></p>
<p>
If you cannot see the link copy and paste the following address in your browser address bar:<br />
<%= unlock_url(@resource, :unlock_token => @resource.unlock_token) %>
</p>

63
app/views/layouts/emails.html.erb

@ -0,0 +1,63 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>EntryDNS</title>
<style type="text/css">
/* Client-specific Styles */
#outlook a { padding: 0; } /* Force Outlook to provide a "view in browser" button. */
body { width: 100% !important; } .ReadMsgBody { width: 100%; } .ExternalClass { width: 100%; } /* Force Hotmail to display emails at full width */
body { -webkit-text-size-adjust: none; -ms-text-size-adjust: none; } /* Prevent Webkit and Windows Mobile platforms from changing default font sizes. */
/* Reset Styles */
body { margin: 0; padding: 0; }
img { height: auto; line-height: 100%; outline: none; text-decoration: none; }
a img { border:none; }
#backgroundTable { margin: 0; padding: 0; width: 100% !important; }
p {
margin: 1em 0;
}
h1, h2, h3, h4, h5, h6 {
color: black !important;
line-height: 100% !important;
}
h1 a, h2 a, h3 a, h4 a, h5 a, h6 a {
color: blue !important;
}
h1 a:active, h2 a:active, h3 a:active, h4 a:active, h5 a:active, h6 a:active {
color: red !important; /* Preferably not the same color as the normal header link color. There is limited support for psuedo classes in email clients, this was added just for good measure. */
}
h1 a:visited, h2 a:visited, h3 a:visited, h4 a:visited, h5 a:visited, h6 a:visited {
color: purple !important; /* Preferably not the same color as the normal header link color. There is limited support for psuedo classes in email clients, this was added just for good measure. */
}
table td {
border-collapse: collapse;
}
.yshortcuts, .yshortcuts a, .yshortcuts a:link,.yshortcuts a:visited, .yshortcuts a:hover, .yshortcuts a span { color: black; text-decoration: none !important; border-bottom: none !important; background: none !important; } /* Body text color for the New Yahoo. This example sets the font of Yahoo's Shortcuts to black. */
</style>
</head>
<body>
<table cellpadding="0" cellspacing="0" border="0" id="backgroundTable">
<tr>
<td>
<%= yield %>
</td>
</tr>
</table>
<!-- End of wrapper table -->
</body>
</html>

4
config/application.rb

@ -47,7 +47,7 @@ module Entrydns
config.to_prepare do
layout = proc{|controller|
l = user_signed_in? ? "application" : "marketing"
l = user_signed_in? ? "application" : "public"
request.xhr? ? false : l
}
Devise::SessionsController.layout layout
@ -55,6 +55,8 @@ module Entrydns
Devise::ConfirmationsController.layout layout
Devise::UnlocksController.layout layout
Devise::PasswordsController.layout layout
Devise::Mailer.layout "emails"
end
end

Loading…
Cancel
Save