helper_method :current_user
helper_method :oauth_token
- helper_method :preferred_langauges
private
end
def require_oauth
- @oauth_token = current_user.access_token(Settings.oauth_key) if current_user && Settings.key?(:oauth_key)
+ @oauth_token = current_user.oauth_token(Settings.oauth_application) if current_user && Settings.key?(:oauth_application)
end
##
end
end
- def preferred_languages(reset: false)
- @preferred_languages = nil if reset
+ def preferred_languages
@preferred_languages ||= if params[:locale]
Locale.list(params[:locale])
elsif current_user
helper_method :preferred_languages
- def set_locale(reset: false)
+ def set_locale
if current_user&.languages&.empty? && !http_accept_language.user_preferred_languages.empty?
current_user.languages = http_accept_language.user_preferred_languages
current_user.save
end
- I18n.locale = Locale.available.preferred(preferred_languages(:reset => reset))
+ I18n.locale = Locale.available.preferred(preferred_languages)
response.headers["Vary"] = "Accept-Language"
response.headers["Content-Language"] = I18n.locale.to_s
has_many :client_applications
has_many :oauth_tokens, -> { order(:authorized_at => :desc).preload(:client_application) }, :class_name => "OauthToken"
- has_many :oauth2_applications, :class_name => Doorkeeper.config.application_model.name, :foreign_key => :owner_id
+ has_many :oauth2_applications, :class_name => Doorkeeper.config.application_model.name, :as => :owner
has_many :access_grants, :class_name => Doorkeeper.config.access_grant_model.name, :foreign_key => :resource_owner_id
has_many :access_tokens, :class_name => Doorkeeper.config.access_token_model.name, :foreign_key => :resource_owner_id
before_save :encrypt_password
before_save :update_tile
after_save :spam_check
- after_save :reset_preferred_languages
def to_param
display_name
@preferred_languages ||= Locale.list(languages)
end
- def reset_preferred_languages
- @preferred_languages = nil
- end
-
def nearby(radius = Settings.nearby_radius, num = Settings.nearby_users)
if home_lon && home_lat
gc = OSM::GreatCircle.new(home_lat, home_lon)
end
##
- # return an oauth access token for a specified application
+ # return an oauth 1 access token for a specified application
def access_token(application_key)
ClientApplication.find_by(:key => application_key).access_token_for_user(self)
end
+ ##
+ # return an oauth 2 access token for a specified application
+ def oauth_token(application_id)
+ application = Doorkeeper.config.application_model.find_by(:uid => application_id)
+
+ Doorkeeper.config.access_token_model.find_or_create_for(
+ :application => application,
+ :resource_owner => self,
+ :scopes => application.scopes
+ )
+ end
+
def fingerprint
digest = Digest::SHA256.new
digest.update(email)
trace:
tagstring: comma delimited
user_block:
- reason: The reason why the user is being blocked. Please be as calm and as reasonable as possible, giving as much detail as you can about the situation, remembering that the message will be publicly visible. Bear in mind that not all users understand the community jargon, so please try to use laymans terms.
+ reason: The reason why the user is being blocked. Please be as calm and as reasonable as possible, giving as much detail as you can about the situation, remembering that the message will be publicly visible. Bear in mind that not all users understand the community jargon, so please try to use layman's terms.
needs_view: Does the user need to log in before this block will be cleared?
user:
email_confirmation: 'Your address is not displayed publicly, see our <a href="https://wiki.osmfoundation.org/wiki/Privacy_Policy" title="OSMF privacy policy including section on email addresses">privacy policy</a> for more information.'
houseboat: "Houseboat"
hut: "Hut"
industrial: "Industrial Building"
- kindergarten: "Kindergarden Building"
+ kindergarten: "Kindergarten Building"
manufacture: "Manufacturing Building"
office: "Office Building"
public: "Public Building"
sport: "Sportsclub"
"yes": "Club"
craft:
- beekeper: "Beekeeper"
+ beekeeper: "Beekeeper"
blacksmith: "Blacksmith"
brewery: "Brewery"
carpenter: "Carpenter"
ambulance_station: "Ambulance Station"
assembly_point: "Assembly Point"
defibrillator: "Defibrillator"
- fire_xtinguisher: "Fire Extinguisher"
+ fire_extinguisher: "Fire Extinguisher"
fire_water_pond: "Fire Water Pond"
landing_site: "Emergency Landing Site"
life_ring: "Emergency Life Ring"
railway: "Historic Railway"
roman_road: "Roman Road"
ruins: "Ruins"
+ rune_stone: "Rune Stone"
stone: "Stone"
tomb: "Tomb"
tower: "Tower"
reset: "Reset Password"
flash changed: "Your password has been changed."
flash token bad: "Did not find that token, check the URL maybe?"
+ preferences:
+ show:
+ title: My Preferences
+ preferred_editor: Preferred Editor
+ preferred_languages: Preferred Languages
+ edit_preferences: Edit Preferences
+ edit:
+ title: Edit Preferences
+ save: Update Preferences
+ cancel: Cancel
+ update:
+ failure: Couldn't update preferences.
+ update_success_flash:
+ message: Preferences updated.
+ profiles:
+ edit:
+ title: Edit Profile
+ save: Update Profile
+ cancel: Cancel
+ image: Image
+ gravatar:
+ gravatar: "Use Gravatar"
+ link: "https://wiki.openstreetmap.org/wiki/Gravatar"
+ what_is_gravatar: "What is Gravatar?"
+ disabled: "Gravatar has been disabled."
+ enabled: "Display of your Gravatar has been enabled."
+ new image: "Add an image"
+ keep image: "Keep the current image"
+ delete image: "Remove the current image"
+ replace image: "Replace the current image"
+ image size hint: "(square images at least 100x100 work best)"
+ home location: "Home Location"
+ no home location: "You have not entered your home location."
+ update home location on click: "Update home location when I click on the map?"
+ update:
+ success: Profile updated.
+ failure: Couldn't update profile.
sessions:
new:
title: "Login"
my profile: My Profile
my settings: My Settings
my comments: My Comments
+ my_preferences: My Preferences
blocks on me: Blocks on Me
blocks by me: Blocks by Me
+ edit_profile: Edit Profile
send message: Send Message
diary: Diary
edits: Edits
agreed_with_pd: "You have also declared that you consider your edits to be in the Public Domain."
link: "https://www.osmfoundation.org/wiki/License/Contributor_Terms"
link text: "what is this?"
- image: Image
- gravatar:
- gravatar: "Use Gravatar"
- link: "https://wiki.openstreetmap.org/wiki/Gravatar"
- what_is_gravatar: "What is Gravatar?"
- disabled: "Gravatar has been disabled."
- enabled: "Display of your Gravatar has been enabled."
- new image: "Add an image"
- keep image: "Keep the current image"
- delete image: "Remove the current image"
- replace image: "Replace the current image"
- image size hint: "(square images at least 100x100 work best)"
- home location: "Home Location"
- no home location: "You have not entered your home location."
- update home location on click: "Update home location when I click on the map?"
save changes button: Save Changes
make edits public button: Make all my edits public
return to profile: Return to profile