]> git.openstreetmap.org Git - rails.git/blobdiff - app/controllers/user_controller.rb
Improve favicons
[rails.git] / app / controllers / user_controller.rb
index c7e44dab64e3da5f4f541dff74fdf07eff87e2e5..3a0e0a14935c4fc5ae270610568f250be3820310 100644 (file)
@@ -252,14 +252,12 @@ class UserController < ApplicationController
   def login
     session[:referer] = params[:referer] if params[:referer]
 
   def login
     session[:referer] = params[:referer] if params[:referer]
 
-    if params[:username] || params[:openid_url]
-      if params[:openid_url].present?
-        session[:remember_me] ||= params[:remember_me_openid]
-        redirect_to auth_url("openid", params[:openid_url])
-      else
-        session[:remember_me] ||= params[:remember_me]
-        password_authentication(params[:username], params[:password])
-      end
+    if params[:username].present? && params[:password].present?
+      session[:remember_me] ||= params[:remember_me]
+      password_authentication(params[:username], params[:password])
+    elsif params[:openid_url].present?
+      session[:remember_me] ||= params[:remember_me_openid]
+      redirect_to auth_url("openid", params[:openid_url])
     end
   end
 
     end
   end
 
@@ -547,7 +545,7 @@ class UserController < ApplicationController
   # omniauth failure callback
   def auth_failure
     flash[:error] = t("user.auth_failure." + params[:message])
   # omniauth failure callback
   def auth_failure
     flash[:error] = t("user.auth_failure." + params[:message])
-    redirect_to params[:origin]
+    redirect_to params[:origin] || login_url
   end
 
   private
   end
 
   private