1 class UserController < ApplicationController
4 @user = User.new(params[:user])
8 flash[:notice] = 'Users was successfully created.'
9 Notifier::deliver_signup_confirm(@user)
10 redirect_to :action => 'login'
12 render :action => 'new'
17 render :layout => 'site'
22 email = params[:user][:email]
23 pass = params[:user][:password]
24 u = User.authenticate(email, pass)
26 u.token = User.make_token
27 u.timeout = 1.day.from_now
29 session[:token] = u.token
30 redirect_to :controller => 'site', :action => 'index'
35 render :layout => 'site'
40 u = User.find_by_token(session[:token])
42 u.token = User.make_token
48 redirect_to :controller => 'site', :action => 'index'
52 @user = User.find_by_token(params[:confirm_string])
53 if @user && @user.active == 0
56 flash[:notice] = 'Confirmed your account'
58 #FIXME: login the person magically
60 redirect_to :action => 'login'
62 flash[:notice] = 'Something went wrong confirming that user'