From a46c4083ae491ea5f0bd2be6c4bea8c795fedaa3 Mon Sep 17 00:00:00 2001 From: Steve Coast Date: Fri, 28 Jul 2006 22:53:54 +0000 Subject: [PATCH 1/1] some more rails stuff --- app/controllers/user_controller.rb | 5 +++++ app/models/notifier.rb | 12 ++++++++++++ app/views/layouts/user.rhtml | 4 ++-- app/views/notifier/signup_confirm.rhtml | 8 ++++++++ app/views/user/signup.rhtml | 1 + config/environment.rb | 9 ++++++++- 6 files changed, 36 insertions(+), 3 deletions(-) create mode 100644 app/models/notifier.rb create mode 100644 app/views/notifier/signup_confirm.rhtml create mode 100644 app/views/user/signup.rhtml diff --git a/app/controllers/user_controller.rb b/app/controllers/user_controller.rb index da27a95dc..42460b4e0 100644 --- a/app/controllers/user_controller.rb +++ b/app/controllers/user_controller.rb @@ -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 index 000000000..484cb702f --- /dev/null +++ b/app/models/notifier.rb @@ -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 diff --git a/app/views/layouts/user.rhtml b/app/views/layouts/user.rhtml index dc90025bb..3d8287fcd 100644 --- a/app/views/layouts/user.rhtml +++ b/app/views/layouts/user.rhtml @@ -18,8 +18,8 @@ - <%= 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'} %>
diff --git a/app/views/notifier/signup_confirm.rhtml b/app/views/notifier/signup_confirm.rhtml new file mode 100644 index 000000000..a998f5782 --- /dev/null +++ b/app/views/notifier/signup_confirm.rhtml @@ -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 index 000000000..907b30816 --- /dev/null +++ b/app/views/user/signup.rhtml @@ -0,0 +1 @@ +blah diff --git a/config/environment.rb b/config/environment.rb index 03e956082..781d332d9 100644 --- a/config/environment.rb +++ b/config/environment.rb @@ -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', +} -- 2.43.2