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."
33 user = User.find_by_token(params['token'])
35 pass = User.make_token(8)
36 user.pass_crypt = pass
38 Notifier::deliver_reset_password(user, pass)
39 flash[:notice] = "You're password has been changed and is on the way to your mailbox :-)"
41 flash[:notice] = "Didn't find that token, check the URL maybe?"
44 redirect_to :action => 'login'
52 email = params[:user][:email]
53 pass = params[:user][:password]
54 u = User.authenticate(email, pass)
56 u.token = User.make_token
57 u.timeout = 1.day.from_now
59 session[:token] = u.token
60 redirect_to :controller => 'site', :action => 'index'
63 flash[:notice] = "Couldn't log in with those details"
70 u = User.find_by_token(session[:token])
72 u.token = User.make_token
78 redirect_to :controller => 'site', :action => 'index'
82 @user = User.find_by_token(params[:confirm_string])
83 if @user && @user.active == 0
86 flash[:notice] = 'Confirmed your account, thanks for signing up!'
88 #FIXME: login the person magically
90 redirect_to :action => 'login'
92 flash[:notice] = 'Something went wrong confirming that user'