some more rails stuff
authorSteve Coast <steve@asklater.com>
Fri, 28 Jul 2006 22:53:54 +0000 (22:53 +0000)
committerSteve Coast <steve@asklater.com>
Fri, 28 Jul 2006 22:53:54 +0000 (22:53 +0000)
app/controllers/user_controller.rb
app/models/notifier.rb [new file with mode: 0644]
app/views/layouts/user.rhtml
app/views/notifier/signup_confirm.rhtml [new file with mode: 0644]
app/views/user/signup.rhtml [new file with mode: 0644]
config/environment.rb

index da27a95dcce283288a578323ae3240093c3097b9..42460b4e0d15872a1569f7d1529601ccea93e5b6 100644 (file)
@@ -1,5 +1,10 @@
 class UserController < ApplicationController
 
+  def create
+    # do some checks, find the user then send the mail
+    Notifier::deliver_confirm_signup(user)
+  end
+  
   def new
 
   end
diff --git a/app/models/notifier.rb b/app/models/notifier.rb
new file mode 100644 (file)
index 0000000..484cb70
--- /dev/null
@@ -0,0 +1,12 @@
+class Notifier < ActionMailer::Base
+
+  def signup_confirm( user )
+    # Email header info MUST be added here
+    @recipients = user.email
+    @from = 'abuse@openstreetmap.org'
+    @subject = '[OpenStreetMap] Confirm your email address'
+
+    @body['url'] = 'http://www.openstreetmap.org/user/confirm?confirm_string=' + user.token
+  end
+  
+end
index dc90025bb8bc0c06a1af081eb24da013aa02c3da..3d8287fcd07a1bc4ba79247caae674135da77668 100644 (file)
@@ -18,8 +18,8 @@
 
 
   <span id="greeting">
-    <%= link_to 'Login', :controller => 'user', :action => 'login' %> /
-    <%= link_to 'Sign up', :controller => 'user', :action => 'new' %>
+    <%= link_to 'Login', {:controller => 'user', :action => 'login'}, {:id => 'loginanchor'}%> /
+    <%= link_to 'Sign up', {:controller => 'user', :action => 'new'}, {:id => 'registeranchor'} %>
   </span>
   
   <div>
diff --git a/app/views/notifier/signup_confirm.rhtml b/app/views/notifier/signup_confirm.rhtml
new file mode 100644 (file)
index 0000000..a998f57
--- /dev/null
@@ -0,0 +1,8 @@
+Hi,
+
+Somone (hopefully you) would like to create an account over at
+www.openstreetmap.org
+
+If this is you, please click the link below to confirm that account.
+
+<%= @url %>
diff --git a/app/views/user/signup.rhtml b/app/views/user/signup.rhtml
new file mode 100644 (file)
index 0000000..907b308
--- /dev/null
@@ -0,0 +1 @@
+blah
index 03e9560821839cbffa4b71b359ecc0a2c396272b..781d332d9c9afc546104144d05c5d28064ba76d8 100644 (file)
@@ -50,4 +50,11 @@ end
 #   inflect.uncountable %w( fish sheep )
 # end
 
-# Include your application configuration below
\ No newline at end of file
+# Include your application configuration below
+
+
+ActionMailer::Base.server_settings = {
+  :address  => "localhost",
+  :port  => 25, 
+  :domain  => 'localhost',
+}