]> git.openstreetmap.org Git - rails.git/commitdiff
Prefer username/password to openid_url if both are set
authorTom Hughes <tom@compton.nu>
Thu, 16 Apr 2015 10:14:57 +0000 (11:14 +0100)
committerTom Hughes <tom@compton.nu>
Thu, 16 Apr 2015 10:14:57 +0000 (11:14 +0100)
app/controllers/user_controller.rb

index c7e44dab64e3da5f4f541dff74fdf07eff87e2e5..fcd330ec34abf5b7e2eca0d3d6d453bd4f5be40a 100644 (file)
@@ -252,14 +252,12 @@ class UserController < ApplicationController
   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