aboutsummaryrefslogtreecommitdiffstats
path: root/app/models
diff options
context:
space:
mode:
Diffstat (limited to 'app/models')
-rw-r--r--app/models/post_redirect.rb13
-rw-r--r--app/models/user_mailer.rb26
2 files changed, 38 insertions, 1 deletions
diff --git a/app/models/post_redirect.rb b/app/models/post_redirect.rb
index b7cf39092..4c4ddcc2f 100644
--- a/app/models/post_redirect.rb
+++ b/app/models/post_redirect.rb
@@ -5,11 +5,14 @@
# Copyright (c) 2007 UK Citizens Online Democracy. All rights reserved.
# Email: francis@mysociety.org; WWW: http://www.mysociety.org/
#
-# $Id: post_redirect.rb,v 1.2 2007-11-02 10:28:20 francis Exp $
+# $Id: post_redirect.rb,v 1.3 2007-11-05 16:46:10 francis Exp $
require 'openssl' # for random bytes function
class PostRedirect < ActiveRecord::Base
+ # Optional, does login confirm after email.
+ belongs_to :user
+
# We store YAML version of POST parameters in the database
def post_params=(params)
self.post_params_yaml = params.to_yaml
@@ -18,6 +21,14 @@ class PostRedirect < ActiveRecord::Base
YAML.load(self.post_params_yaml)
end
+ # We store YAML version of textual "reason for redirect" parameters
+ def reason_params=(reason_params)
+ self.reason_params_yaml = reason_params.to_yaml
+ end
+ def reason_params
+ YAML.load(self.reason_params_yaml)
+ end
+
# Makes a random token, suitable for using in URLs e.g confirmation messages.
def self.generate_random_token
bits = 12 * 8
diff --git a/app/models/user_mailer.rb b/app/models/user_mailer.rb
new file mode 100644
index 000000000..a7e59f36a
--- /dev/null
+++ b/app/models/user_mailer.rb
@@ -0,0 +1,26 @@
+# models/user_mailer.rb:
+# Emails relating to user accounts. e.g. Confirming a new account
+#
+# Copyright (c) 2007 UK Citizens Online Democracy. All rights reserved.
+# Email: francis@mysociety.org; WWW: http://www.mysociety.org/
+#
+# $Id: user_mailer.rb,v 1.1 2007-11-05 16:46:10 francis Exp $
+
+class UserMailer < ActionMailer::Base
+
+ def confirm_login(user, reasons, url)
+ @from = MySociety::Config.get("CONTACT_EMAIL")
+ @recipients = user.email
+ @subject = reasons[:email_subject]
+ @body[:reasons] = reasons
+ @body[:name] = user.name
+ @body[:url] = url
+ end
+
+end
+
+#'reason_web' => _("To view your pledges, we need to check your email address."),
+#'reason_email' => _("Then you will be able to view your pledges."),
+#'reason_email_subject' => _('View your pledges at PledgeBank.com')
+
+