]> git.openstreetmap.org Git - rails.git/blobdiff - app/controllers/user_controller.rb
Preserve field values if the signup form fails validation
[rails.git] / app / controllers / user_controller.rb
index 9ef1ab409e292750b89b22ad7cbf60a7fc7f1da0..86689644c8032b5139aae2dcfa7b5ed1dabd75c8 100644 (file)
@@ -1,6 +1,7 @@
 class UserController < ApplicationController
   layout :choose_layout
 
+  skip_before_filter :verify_authenticity_token, :only => [:api_details, :api_gpx_files]
   before_filter :disable_terms_redirect, :only => [:terms, :save, :logout, :api_details]
   before_filter :authorize, :only => [:api_details, :api_gpx_files]
   before_filter :authorize_web, :except => [:api_details, :api_gpx_files]
@@ -48,7 +49,7 @@ class UserController < ApplicationController
       if params[:user] and params[:user][:openid_url] and @user.pass_crypt.empty?
         # We are creating an account with OpenID and no password
         # was specified so create a random one
-        @user.pass_crypt = ActiveSupport::SecureRandom.base64(16) 
+        @user.pass_crypt = SecureRandom.base64(16) 
         @user.pass_crypt_confirmation = @user.pass_crypt 
       end
 
@@ -252,6 +253,10 @@ class UserController < ApplicationController
   def new
     @title = t 'user.new.title'
     @referer = params[:referer] || session[:referer]
+    @user = User.new(:email => params[:email],
+                     :email_confirmation => params[:email],
+                     :display_name => params[:nickname],
+                     :openid_url => params[:openid])
 
     if session[:user]
       # The user is logged in already, so don't show them the signup