1 class UserController < ApplicationController
5 @user = User.new(params[:user])
9 flash[:notice] = 'User was successfully created. Check your email for a confirmation note, and you\'ll be mapping in no time :-)'
10 Notifier::deliver_signup_confirm(@user)
11 redirect_to :action => 'login'
13 render :action => 'new'
18 if params['user']['email']
19 user = User.find_by_email(params['user']['email'])
21 user.token = User.make_token
23 Notifier::deliver_lost_password(user)
24 flash[:notice] = "Sorry you lost it :-( but an email is on it's way so you can reset it soon."
26 flash[:notice] = "Couldn't find that email address, sorry."
36 email = params[:user][:email]
37 pass = params[:user][:password]
38 u = User.authenticate(email, pass)
40 u.token = User.make_token
41 u.timeout = 1.day.from_now
43 session[:token] = u.token
44 redirect_to :controller => 'site', :action => 'index'
47 flash[:notice] = "Couldn't log in with those details"
54 u = User.find_by_token(session[:token])
56 u.token = User.make_token
62 redirect_to :controller => 'site', :action => 'index'
66 @user = User.find_by_token(params[:confirm_string])
67 if @user && @user.active == 0
70 flash[:notice] = 'Confirmed your account, thanks for signing up!'
72 #FIXME: login the person magically
74 redirect_to :action => 'login'
76 flash[:notice] = 'Something went wrong confirming that user'