- session[:new_user] = current_user.slice("email", "display_name", "pass_crypt", "pass_crypt_confirmation")
- redirect_to :action => :terms
- end
- end
- end
-
- ##
- # destroy a user, marking them as deleted and removing personal data
- def destroy
- @user.soft_destroy!
- redirect_to user_path(:display_name => params[:display_name])
- end
-
- def terms
- @legale = params[:legale] || OSM.ip_to_country(request.remote_ip) || Settings.default_legale
- @text = OSM.legal_text_for_country(@legale)
-
- if request.xhr?
- render :partial => "terms"
- else
- @title = t ".title"
-
- if current_user&.terms_agreed?
- # Already agreed to terms, so just show settings
- redirect_to edit_account_path
- elsif current_user.nil? && session[:new_user].nil?
- redirect_to login_path(:referer => request.fullpath)
- end
- end
- end
-
- def save
- @title = t "users.new.title"
-
- if params[:decline] || !(params[:read_tou] && params[:read_ct])
- if current_user
- current_user.terms_seen = true
-
- flash[:notice] = { :partial => "users/terms_declined_flash" } if current_user.save
-
- referer = safe_referer(params[:referer]) if params[:referer]
-
- redirect_to referer || edit_account_path
- elsif params[:decline]
- redirect_to t("users.terms.declined"), :allow_other_host => true
- else
- redirect_to :action => :terms
- end
- elsif current_user
- unless current_user.terms_agreed?
- current_user.consider_pd = params[:user][:consider_pd]
- current_user.tou_agreed = Time.now.utc
- current_user.terms_agreed = Time.now.utc
- current_user.terms_seen = true
-
- flash[:notice] = t "users.new.terms accepted" if current_user.save
- end
-
- referer = safe_referer(params[:referer]) if params[:referer]
-
- redirect_to referer || edit_account_path
- else
- new_user = session.delete(:new_user)
- verified_email = new_user.delete("verified_email")
-
- self.current_user = User.new(new_user)
-
- if check_signup_allowed(current_user.email)
- current_user.data_public = true
- current_user.description = "" if current_user.description.nil?
- current_user.creation_ip = request.remote_ip
- current_user.languages = http_accept_language.user_preferred_languages
- current_user.terms_agreed = Time.now.utc
- current_user.tou_agreed = Time.now.utc
- current_user.terms_seen = true
-
- if current_user.auth_uid.blank?
- current_user.auth_provider = nil
- current_user.auth_uid = nil
- elsif current_user.email == verified_email
- current_user.activate
- end
-
- if current_user.save