X-Git-Url: https://git.openstreetmap.org/rails.git/blobdiff_plain/a46c4083ae491ea5f0bd2be6c4bea8c795fedaa3..613e88c4a8728c2f1ab8a2fb9338762b947eac6a:/app/controllers/user_controller.rb diff --git a/app/controllers/user_controller.rb b/app/controllers/user_controller.rb index 42460b4e0..3012765d2 100644 --- a/app/controllers/user_controller.rb +++ b/app/controllers/user_controller.rb @@ -1,11 +1,32 @@ class UserController < ApplicationController - def create - # do some checks, find the user then send the mail - Notifier::deliver_confirm_signup(user) + def save + @user = User.new(params[:user]) + @user.set_defaults + + if @user.save + flash[:notice] = 'Users was successfully created.' + Notifier::deliver_signup_confirm(@user) + redirect_to :action => 'login' + else + render :action => 'new' + end end - + def new end + + def confirm + @user = User.find_by_token(params[:confirm_string]) + if @user && @user.active == 0 + @user.active = true + @user.save + flash[:notice] = 'Confirmed your account' + redirect_to :action => 'login' + else + flash[:notice] = 'Something went wrong confirming that user' + end + end + end