diff options
author | Azul <azul@leap.se> | 2013-01-25 19:26:51 +0100 |
---|---|---|
committer | Azul <azul@leap.se> | 2013-01-25 19:26:51 +0100 |
commit | 9563ed191556e739c8f99be4d0fc75ac31c8f6cd (patch) | |
tree | 5a87fc1947921766a5430896f4bcf531dc396bff /users/app | |
parent | 77a51e1de520299afd2b33e7a3992aaafab1d6ae (diff) | |
parent | dac578781baf73a006cc78e29588dd1f6fdc0fd3 (diff) |
Merge branch 'master' into merge_leap_ca
Diffstat (limited to 'users/app')
-rw-r--r-- | users/app/controllers/webfinger_controller.rb | 19 | ||||
-rw-r--r-- | users/app/models/user.rb | 2 | ||||
-rw-r--r-- | users/app/views/users/_public_key_field.html.haml | 1 | ||||
-rw-r--r-- | users/app/views/users/edit.html.haml | 1 | ||||
-rw-r--r-- | users/app/views/webfinger/host_meta.xml.erb | 11 | ||||
-rw-r--r-- | users/app/views/webfinger/search.xml.erb | 7 |
6 files changed, 41 insertions, 0 deletions
diff --git a/users/app/controllers/webfinger_controller.rb b/users/app/controllers/webfinger_controller.rb new file mode 100644 index 0000000..8872802 --- /dev/null +++ b/users/app/controllers/webfinger_controller.rb @@ -0,0 +1,19 @@ +class WebfingerController < ApplicationController + + respond_to :xml, :json + layout false + + def host_meta + @host_meta = Webfinger::HostMetaPresenter.new(request) + respond_with @host_meta + end + + def search + username = params[:q].split('@')[0].to_s.downcase + user = User.find_by_login(username) + raise RECORD_NOT_FOUND, 'User not found' unless user.present? + @presenter = Webfinger::UserPresenter.new(user, request) + respond_with @presenter + end + +end diff --git a/users/app/models/user.rb b/users/app/models/user.rb index 292fb13..80d49a3 100644 --- a/users/app/models/user.rb +++ b/users/app/models/user.rb @@ -9,6 +9,8 @@ class User < CouchRest::Model::Base property :email_forward, String, :accessible => true property :email_aliases, [LocalEmail] + property :public_key, :accessible => true + validates :login, :password_salt, :password_verifier, :presence => true diff --git a/users/app/views/users/_public_key_field.html.haml b/users/app/views/users/_public_key_field.html.haml new file mode 100644 index 0000000..af88cbd --- /dev/null +++ b/users/app/views/users/_public_key_field.html.haml @@ -0,0 +1 @@ += f.input :public_key, :as => :text, :hint => t(:use_ascii_key), :input_html => {:class => "span5", :rows => 20} # will want to tweak this to be wide enough (maybe smaller text?) diff --git a/users/app/views/users/edit.html.haml b/users/app/views/users/edit.html.haml index 238c0eb..950a3b1 100644 --- a/users/app/views/users/edit.html.haml +++ b/users/app/views/users/edit.html.haml @@ -8,6 +8,7 @@ %legend=t :email_address The associated email address is = render @user.email_address, :as => :span + = user_form_with 'public_key_field', :legend => :public_key = user_form_with 'email_forward_field', :legend => :forward_email = user_form_with 'email_aliases', :legend => :add_email_alias = render 'tabs/tabs', :tabs => [:account, :email] diff --git a/users/app/views/webfinger/host_meta.xml.erb b/users/app/views/webfinger/host_meta.xml.erb new file mode 100644 index 0000000..cfcbcc0 --- /dev/null +++ b/users/app/views/webfinger/host_meta.xml.erb @@ -0,0 +1,11 @@ +<?xml version='1.0' encoding='UTF-8'?> + <XRD xmlns='http://docs.oasis-open.org/ns/xri/xrd-1.0'> + + <Subject><%= @host_meta.subject %></Subject> + + <%- @host_meta.links.each do |rel, link| %> + <Link rel='<%= rel %>' + type='<%= link[:type] %>' + template='<%= link[:template] %>' /> + <%- end %> + </XRD> diff --git a/users/app/views/webfinger/search.xml.erb b/users/app/views/webfinger/search.xml.erb new file mode 100644 index 0000000..7328552 --- /dev/null +++ b/users/app/views/webfinger/search.xml.erb @@ -0,0 +1,7 @@ +<?xml version="1.0" encoding="UTF-8"?> +<XRD xmlns="http://docs.oasis-open.org/ns/xri/xrd-1.0"> + <Subject><%= @presenter.subject %></Subject> + <%- @presenter.links.each do |rel, link| %> + <Link rel=<%=rel%> type=<%=link[:type]%> href="<%= link[:key] %>"/> + <% end %> +</XRD> |