if params[:user][:auth_provider].blank? ||
(params[:user][:auth_provider] == current_user.auth_provider &&
params[:user][:auth_uid] == current_user.auth_uid)
update_user(current_user, params)
if params[:user][:auth_provider].blank? ||
(params[:user][:auth_provider] == current_user.auth_provider &&
params[:user][:auth_uid] == current_user.auth_uid)
update_user(current_user, params)
end
elsif errors = session.delete(:user_errors)
errors.each do |attribute, error|
end
elsif errors = session.delete(:user_errors)
errors.each do |attribute, error|
elsif current_user.auth_provider.present?
# Verify external authenticator before moving on
session[:new_user] = current_user
elsif current_user.auth_provider.present?
# Verify external authenticator before moving on
session[:new_user] = current_user
session[:remember_me] ||= params[:remember_me]
password_authentication(params[:username], params[:password])
end
session[:remember_me] ||= params[:remember_me]
password_authentication(params[:username], params[:password])
end
token = UserToken.find_by(:token => params[:confirm_string])
if token&.user&.active?
flash[:error] = t("users.confirm.already active")
token = UserToken.find_by(:token => params[:confirm_string])
if token&.user&.active?
flash[:error] = t("users.confirm.already active")
elsif !token || token.expired?
flash[:error] = t("users.confirm.unknown token")
redirect_to :action => "confirm"
elsif !token || token.expired?
flash[:error] = t("users.confirm.unknown token")
redirect_to :action => "confirm"
if user.nil? || token.nil? || token.user != user
flash[:error] = t "users.confirm_resend.failure", :name => params[:display_name]
else
if user.nil? || token.nil? || token.user != user
flash[:error] = t "users.confirm_resend.failure", :name => params[:display_name]
else
- Notifier.signup_confirm(user, user.tokens.create).deliver_later
- flash[:notice] = t("users.confirm_resend.success", :email => user.email, :sender => Settings.support_email).html_safe
+ UserMailer.signup_confirm(user, user.tokens.create).deliver_later
+ flash[:notice] = t "users.confirm_resend.success_html", :email => user.email, :sender => Settings.support_email
redirect_to :action => "account", :display_name => current_user.display_name
elsif token
flash[:error] = t "users.confirm_email.failure"
redirect_to :action => "account", :display_name => current_user.display_name
elsif token
flash[:error] = t "users.confirm_email.failure"
session[:user_errors] = current_user.errors.as_json
redirect_to :action => "account", :display_name => current_user.display_name
session[:user_errors] = current_user.errors.as_json
redirect_to :action => "account", :display_name => current_user.display_name
# process a successful login
def successful_login(user, referer = nil)
session[:user] = user.id
# process a successful login
def successful_login(user, referer = nil)
session[:user] = user.id
session_expires_after 28.days if session[:remember_me]
target = referer || session[:referer] || url_for(:controller => :site, :action => :index)
session_expires_after 28.days if session[:remember_me]
target = referer || session[:referer] || url_for(:controller => :site, :action => :index)
user.languages = params[:user][:languages].split(",")
case params[:avatar_action]
user.languages = params[:user][:languages].split(",")
case params[:avatar_action]