if @user.save
token.destroy
flash[:notice] = t "user.reset_password.flash changed"
- redirect_to :action => "login"
+ successful_login(@user)
end
end
else
flash[:error] = t "user.confirm_resend.failure", :name => params[:display_name]
else
Notifier.signup_confirm(user, user.tokens.create).deliver_now
- flash[:notice] = t("user.confirm_resend.success", :email => user.email).html_safe
+ flash[:notice] = t("user.confirm_resend.success", :email => user.email, :sender => SUPPORT_EMAIL).html_safe
end
redirect_to :action => "login"
when "active", "confirmed" then
successful_login(user, env["omniauth.params"]["referer"])
when "suspended" then
- failed_login t("user.login.account is suspended", :webmaster => "mailto:webmaster@openstreetmap.org")
+ failed_login t("user.login.account is suspended", :webmaster => "mailto:#{SUPPORT_EMAIL}")
else
failed_login t("user.login.auth failure")
end
elsif user = User.authenticate(:username => username, :password => password, :pending => true)
unconfirmed_login(user)
elsif User.authenticate(:username => username, :password => password, :suspended => true)
- failed_login t("user.login.account is suspended", :webmaster => "mailto:webmaster@openstreetmap.org")
+ failed_login t("user.login.account is suspended", :webmaster => "mailto:#{SUPPORT_EMAIL}"), username
else
- failed_login t("user.login.auth failure")
+ failed_login t("user.login.auth failure"), username
end
end
##
# process a failed login
- def failed_login(message)
+ def failed_login(message, username = nil)
flash[:error] = message
- redirect_to :action => "login", :referer => session[:referer]
+ redirect_to :action => "login", :referer => session[:referer],
+ :username => username, :remember_me => session[:remember_me]
session.delete(:remember_me)
session.delete(:referer)
user.display_name = params[:user][:display_name]
user.new_email = params[:user][:new_email]
- if params[:user][:pass_crypt].length > 0 || params[:user][:pass_crypt_confirmation].length > 0
+ unless params[:user][:pass_crypt].empty? && params[:user][:pass_crypt_confirmation].empty?
user.pass_crypt = params[:user][:pass_crypt]
user.pass_crypt_confirmation = params[:user][:pass_crypt_confirmation]
end