]> git.openstreetmap.org Git - rails.git/commitdiff
merge r17141:17256 from trunk
authorMatt Amos <zerebubuth@gmail.com>
Tue, 25 Aug 2009 16:49:52 +0000 (16:49 +0000)
committerMatt Amos <zerebubuth@gmail.com>
Tue, 25 Aug 2009 16:49:52 +0000 (16:49 +0000)
21 files changed:
app/controllers/diary_entry_controller.rb
app/controllers/oauth_clients_controller.rb
app/controllers/oauth_controller.rb
app/controllers/user_controller.rb
app/views/oauth/oauthorize.html.erb
app/views/oauth_clients/_form.html.erb
app/views/oauth_clients/edit.html.erb
app/views/oauth_clients/index.html.erb
app/views/oauth_clients/new.html.erb
app/views/oauth_clients/not_found.erb
app/views/oauth_clients/show.html.erb
app/views/user/login.html.erb
app/views/user/new.html.erb
config/locales/en.yml
config/locales/hu.yml
config/potlatch/localised/hu/localised.yaml
db/migrate/043_add_referer_to_user_token.rb [new file with mode: 0644]
test/fixtures/languages.yml
test/functional/diary_entry_controller_test.rb
test/integration/user_creation_test.rb
test/unit/language_test.rb

index 52e287b9a1d9fe65ad55038e6f6542a5c6276b39..690b4292b746e0a2aea89cfa7c12478f60b82c12 100644 (file)
@@ -103,7 +103,7 @@ class DiaryEntryController < ApplicationController
 
       if user
         @entries = DiaryEntry.find(:all, :conditions => ['user_id = ?', user.id], :order => 'created_at DESC', :limit => 20)
-        @title = I18n.t('diary_entry.feed.user.title', :user => user.display_name, :locale => I18n.locale)
+        @title = I18n.t('diary_entry.feed.user.title', :user => user.display_name)
         @description = I18n.t('diary_entry.feed.user.description', :user => user.display_name)
         @link = "http://#{SERVER_URL}/user/#{user.display_name}/diary"
       else
@@ -113,8 +113,8 @@ class DiaryEntryController < ApplicationController
       @entries = DiaryEntry.find(:all, :include => :user,
         :conditions => ["users.visible = ? AND diary_entries.language_code = ?", true, params[:language]],
         :order => 'created_at DESC', :limit => 20)
-      @title = I18n.t('diary_entry.feed.language.title', Language.find(params[:language]).english_name)
-      @description = I18n.t('diary_entry.feed.language.description', Language.find(params[:language]).english_name)
+      @title = I18n.t('diary_entry.feed.language.title', :language_name => Language.find(params[:language]).english_name)
+      @description = I18n.t('diary_entry.feed.language.description', :language_name => Language.find(params[:language]).english_name)
       @link = "http://#{SERVER_URL}/diary/#{params[:language]}"
     else
       @entries = DiaryEntry.find(:all, :include => :user,
index 00606c1ecb2e873018f031bd5ab31ae1746f4886..f90302894a359d00b7e5c29f09cd8b84e6e34ae3 100644 (file)
@@ -2,8 +2,9 @@ class OauthClientsController < ApplicationController
   layout 'site'
 
   before_filter :authorize_web
+  before_filter :set_locale
   before_filter :require_user
-  
+
   def index
     @client_applications = @user.client_applications
     @tokens = @user.oauth_tokens.find :all, :conditions => 'oauth_tokens.invalidated_at is null and oauth_tokens.authorized_at is not null'
@@ -16,13 +17,13 @@ class OauthClientsController < ApplicationController
   def create
     @client_application = @user.client_applications.build(params[:client_application])
     if @client_application.save
-      flash[:notice] = "Registered the information successfully"
+      flash[:notice] = t'oauth_clients.create.flash'
       redirect_to :action => "show", :id => @client_application.id
     else
       render :action => "new"
     end
   end
-  
+
   def show
     @client_application = @user.client_applications.find(params[:id])
   rescue ActiveRecord::RecordNotFound
@@ -33,11 +34,11 @@ class OauthClientsController < ApplicationController
   def edit
     @client_application = @user.client_applications.find(params[:id])
   end
-  
+
   def update
     @client_application = @user.client_applications.find(params[:id])
     if @client_application.update_attributes(params[:client_application])
-      flash[:notice] = "Updated the client information successfully"
+      flash[:notice] = t'oauth_clients.update.flash'
       redirect_to :action => "show", :id => @client_application.id
     else
       render :action => "edit"
@@ -47,7 +48,7 @@ class OauthClientsController < ApplicationController
   def destroy
     @client_application = @user.client_applications.find(params[:id])
     @client_application.destroy
-    flash[:notice] = "Destroyed the client application registration"
+    flash[:notice] = t'oauth_clients.destroy.flash'
     redirect_to :action => "index"
   end
 end
index f8959beaefdd260a8110fad96523a37a0f2f1939..98075b8f810d40bf9cdd6faf8012095e4d0aed3f 100644 (file)
@@ -1,7 +1,8 @@
 class OauthController < ApplicationController
   layout 'site'
 
-  before_filter :authorize_web, :except => [:request_token, :access_token]
+  before_filter :authorize_web, :only => [:oauthorize, :revoke]
+  before_filter :set_locale, :only => [:oauthorize, :revoke]
   before_filter :require_user, :only => [:oauthorize]
   before_filter :verify_oauth_consumer_signature, :only => [:request_token]
   before_filter :verify_oauth_request_token, :only => [:access_token]
@@ -11,13 +12,11 @@ class OauthController < ApplicationController
   def request_token
     @token = current_client_application.create_request_token
 
-    logger.info "in REQUEST TOKEN"
     if @token
       logger.info "request token params: #{params.inspect}"
       # request tokens indicate what permissions the client *wants*, not
       # necessarily the same as those which the user allows.
       current_client_application.permissions.each do |pref|
-        logger.info "PARAMS found #{pref}"
         @token.write_attribute(pref, true)
       end
       @token.save!
@@ -26,8 +25,8 @@ class OauthController < ApplicationController
     else
       render :nothing => true, :status => 401
     end
-  end 
-  
+  end
+
   def access_token
     @token = current_token && current_token.exchange!
     if @token
@@ -39,19 +38,18 @@ class OauthController < ApplicationController
 
   def oauthorize
     @token = RequestToken.find_by_token params[:oauth_token]
-    unless @token.invalidated?    
-      if request.post? 
+    unless @token.invalidated?
+      if request.post?
         any_auth = false
         @token.client_application.permissions.each do |pref|
           if params[pref]
-            logger.info "OAUTHORIZE PARAMS found #{pref}"
             @token.write_attribute(pref, true)
             any_auth ||= true
           else
             @token.write_attribute(pref, false)
           end
         end
-        
+
         if any_auth
           @token.authorize!(@user)
           redirect_url = params[:oauth_callback] || @token.client_application.callback_url
@@ -69,15 +67,13 @@ class OauthController < ApplicationController
       render :action => "authorize_failure"
     end
   end
-  
+
   def revoke
     @token = @user.oauth_tokens.find_by_token params[:token]
     if @token
       @token.invalidate!
-      flash[:notice] = "You've revoked the token for #{@token.client_application.name}"
+      flash[:notice] = t('oauth.revoke.flash', :application => @token.client_application.name)
     end
-    logger.info "about to redirect"
     redirect_to :controller => 'oauth_clients', :action => 'index'
   end
-  
 end
index 86b715154750dbd3d6203a846f4c471e2860b123..bea700331c2eb67f362f4a51d7089546f3b99a10 100644 (file)
@@ -29,7 +29,7 @@ class UserController < ApplicationController
 
       if @user.save
         flash[:notice] = t 'user.new.flash create success message'
-        Notifier.deliver_signup_confirm(@user, @user.tokens.create)
+        Notifier.deliver_signup_confirm(@user, @user.tokens.create(:referer => params[:referer]))
         redirect_to :action => 'login'
       else
         render :action => 'new'
@@ -198,10 +198,15 @@ class UserController < ApplicationController
         @user.active = true
         @user.email_valid = true
         @user.save!
+        referer = token.referer
         token.destroy
         flash[:notice] = t 'user.confirm.success'
         session[:user] = @user.id
-        redirect_to :action => 'account', :display_name => @user.display_name
+        unless referer.nil?
+          redirect_to referer
+        else
+          redirect_to :action => 'account', :display_name => @user.display_name
+        end
       else
         @notice = t 'user.confirm.failure'
       end
index 0b9d321fece6f53cc13b6591c333f2bf3855363e..844a86d5228af1bfb37f9b9398cb9d1d394955ef 100644 (file)
@@ -1,17 +1,15 @@
 <h1>Authorize access to your account</h1>
-<p><%= t('oauth.client_application.request_access', :app_name => link_to(@token.client_application.name,@token.client_application.url)) %></p>
+<p><%= t('oauth.oauthorize.request_access', :app_name => link_to(@token.client_application.name,@token.client_application.url)) %></p>
 <% form_tag authorize_url do %>
   <%= hidden_field_tag "oauth_token", @token.token %>
   <%- if params[:oauth_callback] -%>
-  <%= hidden_field_tag "oauth_callback", params[:oauth_callback] %>
-<%- end -%>
-<p><%= t 'oauth.client_application.allow_to' %></p>
-<ul style="list-style:none">
-<% @token.client_application.permissions.each do |perm| %>
-  <li><%= check_box_tag perm.to_s, "yes", @token.read_attribute(perm) %><%= t "oauth.client_application.#{perm}" %></li>
-<% end %>
-</ul>
-<p>
-       <%= submit_tag %>
-</p>
+    <%= hidden_field_tag "oauth_callback", params[:oauth_callback] %>
+  <%- end -%>
+  <p><%= t 'oauth.oauthorize.allow_to' %></p>
+  <ul style="list-style:none">
+  <% @token.client_application.permissions.each do |perm| %>
+    <li><%= check_box_tag perm.to_s, "yes", @token.read_attribute(perm) %><%= t "oauth.oauthorize.#{perm}" %></li>
+  <% end %>
+  </ul>
+  <p><%= submit_tag %></p>
 <% end %>
index f8fd4347e7a65d12879533ae308d115dafb15b69..dc8f8e3d91e96f15d7710151edcb2f237e9e6117 100644 (file)
@@ -1,23 +1,23 @@
 <div class="field">
-       <label for="client_application_name"><%= t'oauth.client_application.form.name' %> (<%= t'oauth.client_application.form.required' %>)</label><br/>
-       <%= f.text_field :name %>
+  <label for="client_application_name"><%= t'oauth_clients.form.name' %> (<%= t'oauth_clients.form.required' %>)</label><br/>
+  <%= f.text_field :name %>
 </div>
 <div class="field">
-       <label for="client_application_url"><%= t'oauth.client_application.form.url' %> (<%= t'oauth.client_application.form.required' %>)</label><br/>
-       <%= f.text_field :url %>
+  <label for="client_application_url"><%= t'oauth_clients.form.url' %> (<%= t'oauth_clients.form.required' %>)</label><br/>
+  <%= f.text_field :url %>
 </div>
 <div class="field">
-       <label for="client_application_callback_url"><%= t'oauth.client_application.form.callback_url' %></label><br/>
-       <%= f.text_field :callback_url %>
+  <label for="client_application_callback_url"><%= t'oauth_clients.form.callback_url' %></label><br/>
+  <%= f.text_field :callback_url %>
 </div>
 <div class="field">
-       <label for="client_application_support_url"><%= t'oauth.client_application.form.support_url' %></label><br/>
-       <%= f.text_field :support_url %>
+  <label for="client_application_support_url"><%= t'oauth_clients.form.support_url' %></label><br/>
+  <%= f.text_field :support_url %>
 </div>
-<p><%= t'oauth.client_application.form.requests' %></p>
+<p><%= t'oauth_clients.form.requests' %></p>
 <% ClientApplication.all_permissions.each do |perm| %>
 <div class="field">
   <%= f.check_box perm %>
-  <label for="client_application_<%= perm.to_s %>"><%= t('oauth.client_application.form.' + perm.to_s) %></label><br/>
+  <label for="client_application_<%= perm.to_s %>"><%= t('oauth_clients.form.' + perm.to_s) %></label><br/>
 </div>
 <% end %>
index 855fc03d85b6ae1e625426c22098f65cafb07f1f..085ddef4ec5dbf9d1c24c4a625624005ed971da8 100644 (file)
@@ -1,6 +1,6 @@
-<h1><%= t'oauth.client_application.edit.title' %></h1>
+<h1><%= t'oauth_clients.edit.title' %></h1>
 <% form_for :client_application, @client_application, :url => oauth_client_path(@client_application.user.display_name, @client_application), :html => { :method => :put } do |f| %>
-       <%= render :partial => "form", :locals => { :f => f } %>
-       <br/>
-       <%= submit_tag t'oauth.client_application.edit.submit' %>
+  <%= render :partial => "form", :locals => { :f => f } %>
+  <br/>
+  <%= submit_tag t'oauth_clients.edit.submit' %>
 <% end %>
index 9f11cddef16c6ece66bc9072dd0ec9755dddce75..d95c68bcb09d9a41552109fbaf252546b4eef9a0 100644 (file)
@@ -1,10 +1,10 @@
-<h1><%= t'oauth.client_application.index.title' %></h1>
+<h1><%= t'oauth_clients.index.title' %></h1>
 <% unless @tokens.empty? %>
-<h3><%= t'oauth.client_application.index.my_tokens' %></h3>
-<p><%= t'oauth.client_application.index.list_tokens' %></p>
+<h3><%= t'oauth_clients.index.my_tokens' %></h3>
+<p><%= t'oauth_clients.index.list_tokens' %></p>
 <table>
-  <tr><th><%= t'oauth.client_application.index.application' %></th>
-    <th><%= t'oauth.client_application.index.issued_at' %></th><th>&nbsp;</th></tr>
+  <tr><th><%= t'oauth_clients.index.application' %></th>
+    <th><%= t'oauth_clients.index.issued_at' %></th><th>&nbsp;</th></tr>
   <% @tokens.each do |token|%>
     <% content_tag_for :tr, token do %>
       <td><%= link_to token.client_application.name, token.client_application.url %></td>
       <td>
        <% form_tag :controller => 'oauth', :action => 'revoke' do %>
        <%= hidden_field_tag 'token', token.token %>
-       <%= submit_tag t('oauth.client_application.index.revoke') %>
+       <%= submit_tag t('oauth_clients.index.revoke') %>
        <% end %>
       </td>
     <% end %>
   <% end %>    
 </table>
 <% end %>
-<h3><%= t'oauth.client_application.index.my_apps' %></h3>
+<h3><%= t'oauth_clients.index.my_apps' %></h3>
 <% if @client_applications.empty? %>
-<p><%= t('oauth.client_application.index.no_apps', :oauth => "<a href=\"http://oauth.net\">OAuth</a>") %></p>
+<p><%= t('oauth_clients.index.no_apps', :oauth => "<a href=\"http://oauth.net\">OAuth</a>") %></p>
 <% else %>
-<p><%= t'oauth.client_application.index.registered_apps' %></p>
+<p><%= t'oauth_clients.index.registered_apps' %></p>
 <% @client_applications.each do |client|%>
   <% div_for client do %>
     <%= link_to client.name, :action => :show, :id => client.id %>
   <% end %>
 <% end %>
 <% end %>
-<h3><%= link_to t('oauth.client_application.index.register_new'), :action => :new %></h3>
+<h3><%= link_to t('oauth_clients.index.register_new'), :action => :new %></h3>
index 75102f80c91c76da92101c17bb2e9d7bfb42c986..292c53fc0e0433353f8e0c28d64b8414a8a7c1f9 100644 (file)
@@ -1,6 +1,6 @@
-<h1><%= t'oauth.client_application.new.title' %></h1>
+<h1><%= t'oauth_clients.new.title' %></h1>
 <% form_for :client_application, :url => { :action => :create } do |f| %>
    <%= render :partial => "form", :locals => { :f => f } %>
    <br />
-   <%= submit_tag t'oauth.client_application.new.submit' %>
+   <%= submit_tag t('oauth_clients.new.submit') %>
 <% end %>
index 9a9865b73ddef75b62a0d06d687be7be07a2964b..d5c6ca755b5b98dc77d188d491fd8874fc61c8e5 100644 (file)
@@ -1 +1 @@
-<p><%= t('oauth.client_application.not_found', :type => @type) %></p>
+<p><%= t('oauth_clients.not_found.sorry', :type => @type) %></p>
index df8fbc2481b01d3a3db975b939c6653fef39d6eb..2769fcd289174922bf471e2fa1fa8d25a9a0de12 100644 (file)
@@ -1,28 +1,27 @@
-<h1><%= t('oauth.client_application.show.title', :app_name => @client_application.name) %></h1>
+<h1><%= t('oauth_clients.show.title', :app_name => @client_application.name) %></h1>
 <p>
-       <b><%= t'oauth.client_application.show.key' %></b> <%=@client_application.key %>
+  <b><%= t'oauth_clients.show.key' %></b> <%=@client_application.key %>
 </p>
 <p>
-       <b><%= t'oauth.client_application.show.secret' %></b> <%=@client_application.secret %>
+  <b><%= t'oauth_clients.show.secret' %></b> <%=@client_application.secret %>
 </p>
 <p>
-       <b><%= t'oauth.client_application.show.url' %></b> http<%='s' if request.ssl? %>://<%= request.host_with_port %><%=@client_application.oauth_server.request_token_path %>
+  <b><%= t'oauth_clients.show.url' %></b> http<%='s' if request.ssl? %>://<%= request.host_with_port %><%=@client_application.oauth_server.request_token_path %>
 </p>
 <p>
-       <b><%= t'oauth.client_application.show.access_url' %></b> http<%='s' if request.ssl? %>://<%= request.host_with_port %><%=@client_application.oauth_server.access_token_path %>
+  <b><%= t'oauth_clients.show.access_url' %></b> http<%='s' if request.ssl? %>://<%= request.host_with_port %><%=@client_application.oauth_server.access_token_path %>
 </p>
 <p>
-       <b><%= t'oauth.client_application.show.authorize_url' %></b> http<%='s' if request.ssl? %>://<%= request.host_with_port %><%=@client_application.oauth_server.authorize_path %>
+  <b><%= t'oauth_clients.show.authorize_url' %></b> http<%='s' if request.ssl? %>://<%= request.host_with_port %><%=@client_application.oauth_server.authorize_path %>
 </p>
 
-<p><%= t'oauth.client_application.show.requests' %></p>
+<p><%= t'oauth_clients.show.requests' %></p>
 <ul><% @client_application.permissions.each do |perm| %>
 <div class="field">
-  <li><%= t('oauth.client_application.form.' + perm.to_s) %></li>
+  <li><%= t('oauth_clients.form.' + perm.to_s) %></li>
 </div>
 <% end %></ul>
 
-<p><%= t'oauth.client_application.show.support_notice' %></p>
-
-<p><%= link_to t('oauth.client_application.show.edit'), edit_oauth_client_url(@client_application.user.display_name, @client_application) %></p>
+<p><%= t'oauth_clients.show.support_notice' %></p>
 
+<p><%= link_to t('oauth_clients.show.edit'), edit_oauth_client_url(@client_application.user.display_name, @client_application) %></p>
index 9b6d62f92fc1f96b201de57def528b9213efa07d..0ae8fc0d9da3ba6452094df6822378effde9c21f 100644 (file)
@@ -1,6 +1,6 @@
 <h1><%= t 'user.login.heading' %></h1>
 
-<p><%= t 'user.login.please login', :create_user_link => link_to(t('user.login.create_account'), :controller => 'user', :action => 'new') %></p>
+<p><%= t 'user.login.please login', :create_user_link => link_to(t('user.login.create_account'), :controller => 'user', :action => 'new', :referer => params[:referer]) %></p>
 
 <% form_tag :action => 'login' do %>
 <%= hidden_field_tag('referer', h(params[:referer])) %>
index 6ac85560d3720b78fef0829d49c1574502b4c6fd..8b1dab5bedd153ccab5452fa9c442c0811dc199d 100644 (file)
@@ -19,6 +19,7 @@
 <%= error_messages_for 'user' %>
 
 <% form_tag :action => 'save' do %>
+<%= hidden_field_tag('referer', h(params[:referer])) unless params[:referer].nil? %>
 <table id="loginForm">
   <tr><td class="fieldName"><%= t 'user.new.email address' %></td><td><%= text_field('user', 'email',{:size => 50, :maxlength => 255, :tabindex => 1}) %></td></tr>
   <tr><td class="fieldName"><%= t 'user.new.confirm email address' %></td><td><%= text_field('user', 'email_confirmation',{:size => 50, :maxlength => 255, :tabindex => 2}) %></td></tr>
index 16f66dbbc12945ce3caffc28e0a4997fcc8ba90c..42fa072d1567f2437dedcf308bf1e88be9666995 100644 (file)
@@ -797,7 +797,7 @@ en:
     make_public:
       made_public: "Track made public"
   oauth:
-    client_application:
+    oauthorize:
       request_access: "The application {{app_name}} is requesting access to your account. Please check whether you would like the application to have the following capabilities. You may choose as many or as few as you like."
       allow_to: "Allow the client application to:"
       allow_read_prefs:  "read your user preferences."
@@ -806,53 +806,63 @@ en:
       allow_write_api:   "modify the map."
       allow_read_gpx:    "read your private GPS traces."
       allow_write_gpx:   "upload GPS traces."
-      new:
-        title: "Register a new application"
-        submit: "Register"
-      edit:
-        title: "Edit your application"
-        submit: "Edit"
-      show:
-        title: "OAuth details for {{app_name}}"
-        key: "Consumer Key:"
-        secret: "Consumer Secret:"
-        url: "Request Token URL:"
-        access_url: "Access Token URL:"
-        authorize_url: "Authorise URL:"
-        support_notice: "We support hmac-sha1 (recommended) as well as plain text in ssl mode."
-        edit: "Edit Details"
-        requests: "Requesting the following permissions from the user:"
-        allow_read_prefs:  "read their user preferences."
-        allow_write_prefs: "modify their user preferences."
-        allow_write_diary: "create diary entries, comments and make friends."
-        allow_write_api:   "modify the map."
-        allow_read_gpx:    "read their private GPS traces."
-        allow_write_gpx:   "upload GPS traces."
-      index:
-        title: "My OAuth Details"
-        my_tokens: "My Authorised Applications"
-        list_tokens: "The following tokens have been issued to applications in your name:"
-        application: "Application Name"
-        issued_at: "Issued At"
-        revoke: "Revoke!"
-        my_apps: "My Client Applications"
-        no_apps: "Do you have an application you would like to register for use with us using the {{oauth}} standard? You must register your web application before it can make OAuth requests to this service."
-        registered_apps: "You have the following client applications registered:"
-        register_new: "Register your application"
-      form:
-        name: "Name"
-        required: "Required"
-        url: "Main Application URL"
-        callback_url: "Callback URL"
-        support_url: "Support URL"
-        requests: "Request the following permissions from the user:"
-        allow_read_prefs:  "read their user preferences."
-        allow_write_prefs: "modify their user preferences."
-        allow_write_diary: "create diary entries, comments and make friends."
-        allow_write_api:   "modify the map."
-        allow_read_gpx:    "read their private GPS traces."
-        allow_write_gpx:   "upload GPS traces."
-      not_found: "Sorry, that {{type}} could not be found."
+    revoke:
+      flash: "You've revoked the token for {{application}}"
+  oauth_clients:
+    new:
+      title: "Register a new application"
+      submit: "Register"
+    edit:
+      title: "Edit your application"
+      submit: "Edit"
+    show:
+      title: "OAuth details for {{app_name}}"
+      key: "Consumer Key:"
+      secret: "Consumer Secret:"
+      url: "Request Token URL:"
+      access_url: "Access Token URL:"
+      authorize_url: "Authorise URL:"
+      support_notice: "We support hmac-sha1 (recommended) as well as plain text in ssl mode."
+      edit: "Edit Details"
+      requests: "Requesting the following permissions from the user:"
+      allow_read_prefs:  "read their user preferences."
+      allow_write_prefs: "modify their user preferences."
+      allow_write_diary: "create diary entries, comments and make friends."
+      allow_write_api:   "modify the map."
+      allow_read_gpx:    "read their private GPS traces."
+      allow_write_gpx:   "upload GPS traces."
+    index:
+      title: "My OAuth Details"
+      my_tokens: "My Authorised Applications"
+      list_tokens: "The following tokens have been issued to applications in your name:"
+      application: "Application Name"
+      issued_at: "Issued At"
+      revoke: "Revoke!"
+      my_apps: "My Client Applications"
+      no_apps: "Do you have an application you would like to register for use with us using the {{oauth}} standard? You must register your web application before it can make OAuth requests to this service."
+      registered_apps: "You have the following client applications registered:"
+      register_new: "Register your application"
+    form:
+      name: "Name"
+      required: "Required"
+      url: "Main Application URL"
+      callback_url: "Callback URL"
+      support_url: "Support URL"
+      requests: "Request the following permissions from the user:"
+      allow_read_prefs:  "read their user preferences."
+      allow_write_prefs: "modify their user preferences."
+      allow_write_diary: "create diary entries, comments and make friends."
+      allow_write_api:   "modify the map."
+      allow_read_gpx:    "read their private GPS traces."
+      allow_write_gpx:   "upload GPS traces."
+    not_found: 
+      sorry: "Sorry, that {{type}} could not be found."
+    create:
+      flash: "Registered the information successfully"
+    update:
+      flash: "Updated the client information successfully"
+    destroy:
+      flash: "Destroyed the client application registration"
   user:
     login:
       title: "Login"
index d65033c46c9124814b4abd3a8abf01c808c5f17a..3d943b787ea8637e1df63ab6cf873d3428586d2b 100644 (file)
@@ -87,6 +87,9 @@ hu:
       download: "{{changeset_xml_link}} vagy {{osmchange_xml_link}} letöltése"
       changesetxml: "Changeset XML"
       osmchangexml: "osmChange XML"
+      feed:
+        title: "Módosításcsomag: {{id}}"
+        title_comment: "Módosításcsomag: {{id}} - {{comment}}"
     changeset_navigation:
       user:
         name_tooltip: "{{user}} szerkesztéseinek megtekintése"
@@ -317,6 +320,16 @@ hu:
       edit_link: Ezen bejegyzés szerkesztése
     diary_comment:
       comment_from: "{{link_user}} hozzászólása ekkor: {{comment_created_at}}"
+    feed:
+      user:
+        title: "{{user}} OpenStreetMap naplóbejegyzései"
+        description: "Legutóbbi OpenStreetMap naplóbejegyzések {{user}} felhasználótól"
+      language:
+        title: "OpenStreetMap naplóbejegyzések {{language_name}} nyelven"
+        description: "Legutóbbi naplóbejegyzések az OpenStreetMap felhasználóitól {{language_name}} nyelven"
+      all:
+        title: "OpenStreetMap naplóbejegyzések"
+        description: "Legutóbbi naplóbejegyzések az OpenStreetMap felhasználóitól"
   export:
     start:
       area_to_export: "Exportálandó terület"
@@ -690,6 +703,11 @@ hu:
           destination: "Csak célforgalom"
           construction: "Utak építés alatt"
   trace:
+    visibility:
+      private: "Magán (megosztva csak névtelenül, rendezetlen pontok)"
+      public: "Nyilvános (megjelenik a nyomvonalak listáján névtelenül, rendezetlen pontok)"
+      trackable: "Követhető (megosztva csak névtelenül, rendezett pontok időbélyeggel)"
+      identifiable: "Azonosítható (megjelenik a nyomvonalak listáján, és azonodítható, rendezett pontok időbélyeggel)"
     create:
       upload_trace: "GPS nyomvonal feltöltése"
       trace_uploaded: "A GPX fájl feltöltése megtörtént, és várakozik az adatbázisba való beillesztésre. Ez általában fél órán belül megtörténik, és fogsz kapni egy e-mailt, amint elkészült."
@@ -708,6 +726,9 @@ hu:
       tags: "Címkék:"
       tags_help: "vesszővel elválasztva"
       save_button: "Módosítások mentése"
+      visibility: "Láthatóság:"
+      visibility_help: "Mit jelent ez?"
+      visibility_help_url: "http://wiki.openstreetmap.org/wiki/Visibility_of_GPS_traces"
     no_such_user:
       title: "Nincs ilyen felhasználó"
       heading: "{{user}} felhasználó nem létezik"
@@ -717,9 +738,9 @@ hu:
       description: "Leírás"
       tags: "Címkék"
       tags_help: "vesszővel elválasztva"
-      public: "Nyilvános?"
-      public_help: "mit jelent ez?"
-      public_help_url: "http://wiki.openstreetmap.org/wiki/Visibility_of_GPS_traces"
+      visibility: "Láthatóság"
+      visibility_help: "Mit jelent ez?"
+      visibility_help_url: "http://wiki.openstreetmap.org/wiki/Visibility_of_GPS_traces"
       upload_button: "Feltöltés"
       help: "Segítség"
       help_url: "http://wiki.openstreetmap.org/wiki/Upload"
@@ -745,10 +766,10 @@ hu:
       description: "Leírás:"
       tags: "Címkék:"
       none: "nincsenek"
-      make_public: "Ezen nyomvonal nyilvánossá tétele véglegesen"
       edit_track: "Ezen nyomvonal szerkesztése"
       delete_track: "Ezen nyomvonal törlése"
       trace_not_found: "Nem található nyomvonal!"
+      visibility: "Láthatóság:"
     trace_paging_nav:
       showing: "Jelenlegi oldal:"
       of: "összesen:"
@@ -775,6 +796,73 @@ hu:
       scheduled_for_deletion: "A nyomvonal törlésre kijelölve"
     make_public:
       made_public: "A nyomvonal nyilvános lett"
+  oauth:
+    oauthorize:
+      request_access: "A(z) {{app_name}} alkalmazás hozzáférést kér a felhasználói fiókodhoz. Kérlek, jelöld, ha azt szeretnéd, hogy az alkalmazás rendelkezzen a következő képességekkel. Választhatsz olyan sokat vagy keveset, amennyit szeretnél."
+      allow_to: "Az alábbiak engedélyezése a kliensalkalmazásnak:"
+      allow_read_prefs:  "felhasználói beállítások olvasása."
+      allow_write_prefs: "felhasználói beállítások módosítása."
+      allow_write_diary: "naplóbejegyzések, hozzászólások készítése és barátok hozzáadása."
+      allow_write_api:   "a térkép módosítása."
+      allow_read_gpx:    "magán GPS nyomvonalak olvasása."
+      allow_write_gpx:   "GPS nyomvonalak feltöltése."
+    revoke:
+      flash: "Visszavontad az utalványt a(z) {{application}} alkalmazáshoz"
+  oauth_clients:
+    new:
+      title: "Új alkalmazás regisztrálása"
+      submit: "Regisztrálás"
+    edit:
+      title: "Alkalmazás szerkesztése"
+      submit: "Szerkesztés"
+    show:
+      title: "{{app_name}} OAuth részletei"
+      key: "Consumer Key:"
+      secret: "Consumer Secret:"
+      url: "Request Token URL:"
+      access_url: "Access Token URL:"
+      authorize_url: "Authorise URL:"
+      support_notice: "Támogatjuk a hmac-sha1 hitelesítést (ajánlott), valamint a sima szöveget ssl módban."
+      edit: "Részletek szerkesztése"
+      requests: "A következő engedélyek kérése a felhasználótól:"
+      allow_read_prefs:  "felhasználó beállításainak olvasása."
+      allow_write_prefs: "felhasználó beállításainak módosítása."
+      allow_write_diary: "naplóbejegyzések, hozzászólások készítése és barátok hozzáadása."
+      allow_write_api:   "a térkép módosítása."
+      allow_read_gpx:    "magán GPS nyomvonalainak olvasása."
+      allow_write_gpx:   "GPS nyomvonalak feltöltése."
+    index:
+      title: "OAuth részletek"
+      my_tokens: "Engedélyezett alkalmazások"
+      list_tokens: "A következő utalványok kerültek kibocsátásra a nevedben:"
+      application: "Alkalmazás neve"
+      issued_at: "Kibocsátva ekkor"
+      revoke: Visszavonás!"
+      my_apps: "Kliensalkalmazások"
+      no_apps: "Van olyan alkalmazásod, amit szeretnél regisztrálni a velünk való használathoz a(z) {{oauth}} szabvány használatával? Regisztrálnod kell a webalkalmazásod, mielőtt OAuth kéréseket küld ehhez a szolgáltatáshoz."
+      registered_apps: "A következő kliensalkalmazások vannak regisztrálva:"
+      register_new: "Alkalmazás regisztrálása"
+    form:
+      name: "Név"
+      required: "Szükséges"
+      url: "Main Application URL"
+      callback_url: "Callback URL"
+      support_url: "Support URL"
+      requests: "A következő engedélyek kérése a felhasználótól:"
+      allow_read_prefs:  "felhasználó beállításainak olvasása."
+      allow_write_prefs: "felhasználó beállításainak módosítása."
+      allow_write_diary: "naplóbejegyzések, hozzászólások készítése és barátok hozzáadása."
+      allow_write_api:   "a térkép módosítása."
+      allow_read_gpx:    "magán GPS nyomvonalainak olvasása."
+      allow_write_gpx:   "GPS nyomvonalak feltöltése."
+    not_found: 
+      sorry: "Sajnálom, a(z) {{type}} nem található."
+    create:
+      flash: "Az információ sikeresen regisztrálva"
+    update:
+      flash: "A kliens információi sikeresen frissítve"
+    destroy:
+      flash: "A kliensalkalmazás regisztrációja törölve"
   user:
     login:
       title: "Bejelentkezés"
@@ -851,6 +939,7 @@ hu:
       nearby users: "Közeli felhasználók: "
       no nearby users: "Még nincsenek felhasználók, akik megadták, hogy a közelben szerkesztenek."
       change your settings: beállítások módosítása
+      my_oauth_details: "OAuth részletek megtekintése"
     friend_map:
       your location: Helyed
       nearby mapper: "Közeli térképszerkesztők: "
index e7ee9f2d1f8a27ad8a1bfecd47cd7a9c0dede049..d06699347a45bf66aaaecdcb7a27dc642a29d70f 100644 (file)
@@ -3,6 +3,7 @@
 "hint_pointselected": pont kijelölve\n(shift+kattintás a pontra\núj vonal kezdéséhez)
 "action_movepoint": pont mozgatása
 "hint_drawmode": kattintás pont hozzáadásához\ndupla kattintás/Enter\na vonal befejezéséhez
+"action_insertnode": pont hozzáadása vonalhoz
 "hint_overendpoint": végpont fölött ($1)\nkattintás a csatlakoztatáshoz\nshift+kattintás az egyesítéshez
 "hint_overpoint": pont fölött ($1)\nkattintás a csatlakoztatáshoz
 "closechangeset": Módosításcsomag bezárása
 "cancel": Mégse
 "ok": OK
 "prompt_changesetcomment": "Adj leírást a módosításaidhoz:"
+"newchangeset": "\nKérlek, próbáld újra: a Potlatch egy új módosításcsomagot fog kezdeni."
 "emailauthor": \n\nKérlek, jelentsd a hibát (angolul) a richard\@systemeD.net e-mail címre, és írd le, hogy mit csináltál akkor, amikor a hiba történt.
 "retry": Újra
 "error_connectionfailed": Sajnálom - az OpenStreetMap szerverhez való kapcsolódás sikertelen. A legutóbbi módosítások nem lettek elmentve.\n\nSzeretnéd megpróbálni újra?
 "error_readfailed": Sajnálom - az OpenStreetMap szerver az adatok lekérdezésekor nem válaszolt.\n\nSzeretnéd megpróbálni újra?
 "conflict_waychanged": Amióta elkezdtél szerkeszteni, valaki más módosította a(z) $1$2 vonalat.
-"conflict_visitway": "A vonal megtekintéséhez kattints az 'OK'-ra."
+"conflict_visitway": A vonal megtekintéséhez kattints az OK-ra.
 "conflict_poichanged": Amióta elkezdtél szerkeszteni, valaki más módosította a(z) $1$2 pontot.
-"conflict_visitpoi": "A pont megtekintéséhez kattints az 'OK'-ra."
+"conflict_visitpoi": A pont megtekintéséhez kattints az OK-ra.
 "conflict_relchanged": Amióta elkezdtél szerkeszteni, valaki más módosította a(z) $1$2 kapcsolatot.
 "conflict_download": Az ő változatának letöltése
 "conflict_overwrite": Az ő változatának felülírása
 "tip_repeattag": Az előzőleg kiválasztott vonal címkéinek megismétlése (R)
 "tip_alert": Hiba történt - kattints a részletekért
 "help": Súgó
-"manual": Kézikönyv
+"advanced_parallel": Párhuzamos vonal
+"advanced_history": Vonal története
+"advanced_inspector": Felügyelő
+"advanced_undelete": Törlés visszavonása
+"advanced_close": Módosításcsomag lezárása
+"advanced_maximise": Ablak maximalizálása
 "way": Vonal
 "advice_toolong": Túl hosszú a feloldáshoz - vágd rövidebb szakaszokra
 "deleting": törlése
 "action_deletepoint": pont törlése
+"advice_deletingway": Vonal törlése (Z a visszavonáshoz)
+"advice_revertingway": Visszaállítás a legutóbb mentett vonalra (Z a viszavonáshoz)
 "action_cancelchanges": "módosítások elvetése:"
-"custom": "Egyéni:"
+"advice_revertingpoi": Visszaállítás a legutóbb mentett POI-ra (Z a viszavonáshoz)
+"advice_deletingpoi": POI törlése (Z a visszavonáshoz)
+"custom": "Egyéni: "
 "nobackground": Nincs háttérkép
 "option_fadebackground": Áttetsző háttér
 "option_thinlines": Vékony vonalak használata minden méretaránynál
 "error_noway": A(z) $1 nem található (talán már eltávolítottad?), így nem vonható vissza.
 "error_nosharedpoint": A(z) $1 és a(z) $2 vonalaknak már nincs közös pontja, így nem vonható vissza a kettévágás.
 "error_nopoi": A POI nem található (talán már eltávolítottad?), így nem vonható vissza.
-"action_tidyway": vonal tisztítása
 "delete": Törlés
 "prompt_taggedpoints": Ezen a vonalon van néhány címkézett pont. Biztosan törlöd?
 "a_way": vonal $1
+"action_changeway": módosítások vonalhoz
 "advice_waydragged": Vonal áthelyezve (Z a visszavonáshoz)
 "action_moveway": vonal mozgatása
 "action_splitway": vonal kettévágása
 "advice_tagconflict": A címkék nem egyeznek - ellenőrizd (Z a visszavonáshoz)
 "advice_nocommonpoint": A vonalaknak nincs közös pontjuk
 "action_reverseway": vonal megfordítása
-"action_insertnode": pont hozzáadása vonalhoz
 "prompt_createparallel": Párhuzamos vonal készítése
 "offset_dual": Osztott pályás út (D2)
 "offset_motorway": Autópálya (D3)
 "offset_choose": Válassz eltolást (m)
 "action_createparallel": párhuzamos vonalak készítése
 "action_addpoint": pont hozzáadása a vonal végéhez
+"advanced_minimise": Ablak minimalizálása
diff --git a/db/migrate/043_add_referer_to_user_token.rb b/db/migrate/043_add_referer_to_user_token.rb
new file mode 100644 (file)
index 0000000..554cc93
--- /dev/null
@@ -0,0 +1,9 @@
+class AddRefererToUserToken < ActiveRecord::Migration
+  def self.up
+    add_column :user_tokens, :referer, :text
+  end
+
+  def self.down
+    remove_column :user_tokens, :referer
+  end
+end
index e992da23e124f060c06c4fe8bca5619ec76c767b..7f4a18af69494f3df2ba3c634285adff85ccc5bb 100644 (file)
@@ -9,3 +9,8 @@ de:
   code: de
   english_name: German
   native_name: Deutsch
+
+sl:
+  code: sl
+  english_name: Slovenian
+  native_name: slovenščina
index d060af4167edecce21d5d91512a2efb5712a9a9a..1f3492ae98a1236e4d1e7f0cb474f352fa9400d9 100644 (file)
@@ -176,9 +176,44 @@ class DiaryEntryControllerTest < ActionController::TestCase
   
   def test_rss
     get :rss
-    assert_response :success
+    assert_response :success, "Should be able to get a diary RSS"
+    assert_select "rss:root", :count => 1 do
+      assert_select "channel", :count => 1 do
+        assert_select "channel>title", :count => 1
+        assert_select "image", :count => 1
+        assert_select "channel>item", :count => 2
+      end
+    end
+  end
+  
+  def test_rss_language
+    get :rss, {:language => diary_entries(:normal_user_entry_1).language_code}
+    assert_response :success, "Should be able to get a specific language diary RSS"
+    assert_select "rss>channel>item", :count => 1 #, "Diary entries should be filtered by language"
+  end
+  
+#  def test_rss_nonexisting_language
+#    get :rss, {:language => 'xx'}
+#    assert_response :not_found, "Should not be able to get a nonexisting language diary RSS"
+#  end
+
+  def test_rss_language_with_no_entries
+    get :rss, {:language => 'sl'}
+    assert_response :success, "Should be able to get a specific language diary RSS"
+    assert_select "rss>channel>item", :count => 0 #, "Diary entries should be filtered by language"
+  end
+
+  def test_rss_user
+    get :rss, {:display_name => users(:normal_user).display_name}
+    assert_response :success, "Should be able to get a specific users diary RSS"
+    assert_select "rss>channel>item", :count => 2 #, "Diary entries should be filtered by user"
   end
   
+  def test_rss_nonexisting_user
+    get :rss, {:display_name => 'fakeUsername76543'}
+    assert_response :not_found, "Should not be able to get a nonexisting users diary RSS"
+  end
+
   def test_viewing_diary_entry
     get :view, {:display_name => users(:normal_user).display_name, :id => diary_entries(:normal_user_entry_1).id}
     assert_response :success
index e6ac49e8d5579c82ec16aad6b0c868261f6c050f..e4ed2329490d2b1d382f1fcce74b071110f780f6 100644 (file)
@@ -85,4 +85,44 @@ class UserCreationTest < ActionController::IntegrationTest
     # Submit the reset password token
     # Check that the password has changed, and the user can login
   end
+
+  def test_user_create_redirect
+    new_email = "redirect_tester@osm.org"
+    display_name = "redirect_tester"
+    password = "testtest"
+    # nothing special about this page, just need a protected page to redirect back to.
+    referer = "/traces/mine"
+    assert_difference('User.count') do
+      assert_difference('ActionMailer::Base.deliveries.size', 1) do
+        post_via_redirect "/user/save", 
+        {:user => { :email => new_email, :email_confirmation => new_email, :display_name => display_name, :pass_crypt => password, :pass_crypt_confirmation => password}, :referer => referer }
+      end
+    end
+      
+    # Check the e-mail
+    register_email = ActionMailer::Base.deliveries.first
+    
+    assert_equal register_email.to[0], new_email
+    # Check that the confirm account url is correct
+    confirm_regex = Regexp.new("/user/confirm\\?confirm_string=([a-zA-Z0-9]*)")
+    assert_match(confirm_regex, register_email.body)
+    confirm_string = confirm_regex.match(register_email.body)[1]
+    
+    # Check the page
+    assert_response :success
+    assert_template 'login'
+    
+    ActionMailer::Base.deliveries.clear
+
+    # Go to the confirmation page
+    get 'user/confirm', { :confirm_string => confirm_string }
+    assert_response :success
+    assert_template 'user/confirm'
+
+    post 'user/confirm', { :confirm_string => confirm_string, :confirm_action => 'submit' }
+    assert_response :redirect
+    follow_redirect!
+    assert_response :success
+    assert_template "trace/mine"
+  end
 end
index da30044594899f248b704e644eb96c596bb1a44c..a171c1e2e1fae307edf7d1a53b561687b718e6a7 100644 (file)
@@ -2,6 +2,6 @@ require File.dirname(__FILE__) + '/../test_helper'
 
 class LanguageTest < ActiveSupport::TestCase
   test "language count" do
-    assert_equal 2, Language.count
+    assert_equal 3, Language.count
   end
 end