Rails/SkipsModelValidations:
Exclude:
- 'db/migrate/*.rb'
- - 'app/controllers/user_controller.rb'
+ - 'app/controllers/users_controller.rb'
Style/BracesAroundHashParameters:
EnforcedStyle: context_dependent
- 'app/controllers/geocoder_controller.rb'
- 'app/controllers/notes_controller.rb'
- 'app/controllers/traces_controller.rb'
- - 'app/controllers/user_controller.rb'
+ - 'app/controllers/users_controller.rb'
- 'app/controllers/user_preferences_controller.rb'
- 'app/helpers/application_helper.rb'
- 'app/helpers/browse_helper.rb'
Lint/HandleExceptions:
Exclude:
- 'app/controllers/amf_controller.rb'
- - 'app/controllers/user_controller.rb'
+ - 'app/controllers/users_controller.rb'
# Offense count: 692
Metrics/AbcSize:
# Offense count: 20
Rails/OutputSafety:
Exclude:
- - 'app/controllers/user_controller.rb'
+ - 'app/controllers/users_controller.rb'
- 'app/helpers/application_helper.rb'
- 'app/helpers/changeset_helper.rb'
- 'app/helpers/geocoder_helper.rb'
session.delete(:user)
session_expires_automatically
- redirect_to :controller => "user", :action => "suspended"
+ redirect_to :controller => "users", :action => "suspended"
# don't allow access to any auth-requiring part of the site unless
# the new CTs have been seen (and accept/decline chosen).
elsif !current_user.terms_seen && flash[:skip_terms].nil?
flash[:notice] = t "user.terms.you need to accept or decline"
if params[:referer]
- redirect_to :controller => "user", :action => "terms", :referer => params[:referer]
+ redirect_to :controller => "users", :action => "terms", :referer => params[:referer]
else
- redirect_to :controller => "user", :action => "terms", :referer => request.fullpath
+ redirect_to :controller => "users", :action => "terms", :referer => request.fullpath
end
end
elsif session[:token]
def require_user
unless current_user
if request.get?
- redirect_to :controller => "user", :action => "login", :referer => request.fullpath
+ redirect_to :controller => "users", :action => "login", :referer => request.fullpath
else
head :forbidden
end
##
# render a "no such user" page
def render_unknown_user(name)
- @title = t "user.no_such_user.title"
+ @title = t "users.no_such_user.title"
@not_found_user = name
respond_to do |format|
- format.html { render :template => "user/no_such_user", :status => :not_found }
+ format.html { render :template => "users/no_such_user", :status => :not_found }
format.all { head :not_found }
end
end
render :action => "new"
else
flash[:notice] = t ".wrong_user", :user => current_user.display_name
- redirect_to :controller => "user", :action => "login", :referer => request.fullpath
+ redirect_to :controller => "users", :action => "login", :referer => request.fullpath
end
rescue ActiveRecord::RecordNotFound
@title = t "messages.no_such_message.title"
@message.save
else
flash[:notice] = t ".wrong_user", :user => current_user.display_name
- redirect_to :controller => "user", :action => "login", :referer => request.fullpath
+ redirect_to :controller => "users", :action => "login", :referer => request.fullpath
end
rescue ActiveRecord::RecordNotFound
@title = t "messages.no_such_message.title"
@notes = @notes.visible unless current_user&.moderator?
@notes = @notes.order("updated_at DESC, id").distinct.offset((@page - 1) * @page_size).limit(@page_size).preload(:comments => :author).to_a
else
- @title = t "user.no_such_user.title"
+ @title = t "users.no_such_user.title"
@not_found_user = params[:display_name]
- render :template => "user/no_such_user", :status => :not_found
+ render :template => "users/no_such_user", :status => :not_found
end
end
end
-class UserController < ApplicationController
+class UsersController < ApplicationController
layout "site", :except => [:api_details]
skip_before_action :verify_authenticity_token, :only => [:api_read, :api_users, :api_details, :api_gpx_files, :auth_success]
if request.xhr?
render :partial => "terms"
else
- @title = t "user.terms.title"
+ @title = t "users.terms.title"
if current_user&.terms_agreed?
# Already agreed to terms, so just show settings
end
def save
- @title = t "user.new.title"
+ @title = t "users.new.title"
if params[:decline]
if current_user
current_user.terms_seen = true
- flash[:notice] = t("user.new.terms declined", :url => t("user.new.terms declined url")).html_safe if current_user.save
+ flash[:notice] = t("users.new.terms declined", :url => t("users.new.terms declined url")).html_safe if current_user.save
if params[:referer]
redirect_to params[:referer]
redirect_to :action => :account, :display_name => current_user.display_name
end
else
- redirect_to t("user.terms.declined")
+ redirect_to t("users.terms.declined")
end
elsif current_user
unless current_user.terms_agreed?
current_user.terms_agreed = Time.now.getutc
current_user.terms_seen = true
- flash[:notice] = t "user.new.terms accepted" if current_user.save
+ flash[:notice] = t "users.new.terms accepted" if current_user.save
end
if params[:referer]
current_user.errors.add(attribute, error)
end
end
- @title = t "user.account.title"
+ @title = t "users.account.title"
end
def go_public
current_user.data_public = true
current_user.save
- flash[:notice] = t "user.go_public.flash success"
+ flash[:notice] = t "users.go_public.flash success"
redirect_to :action => "account", :display_name => current_user.display_name
end
def lost_password
- @title = t "user.lost_password.title"
+ @title = t "users.lost_password.title"
if params[:user] && params[:user][:email]
user = User.visible.find_by(:email => params[:user][:email])
if user
token = user.tokens.create
Notifier.lost_password(user, token).deliver_now
- flash[:notice] = t "user.lost_password.notice email on way"
+ flash[:notice] = t "users.lost_password.notice email on way"
redirect_to :action => "login"
else
- flash.now[:error] = t "user.lost_password.notice email cannot find"
+ flash.now[:error] = t "users.lost_password.notice email cannot find"
end
end
end
def reset_password
- @title = t "user.reset_password.title"
+ @title = t "users.reset_password.title"
if params[:token]
token = UserToken.find_by(:token => params[:token])
if current_user.save
token.destroy
- flash[:notice] = t "user.reset_password.flash changed"
+ flash[:notice] = t "users.reset_password.flash changed"
successful_login(current_user)
end
end
else
- flash[:error] = t "user.reset_password.flash token bad"
+ flash[:error] = t "users.reset_password.flash token bad"
redirect_to :action => "lost_password"
end
else
end
def new
- @title = t "user.new.title"
+ @title = t "users.new.title"
@referer = params[:referer] || session[:referer]
append_content_security_policy_directives(
end
def logout
- @title = t "user.logout.title"
+ @title = t "users.logout.title"
if params[:session] == session.id
if session[:token]
if request.post?
token = UserToken.find_by(:token => params[:confirm_string])
if token&.user&.active?
- flash[:error] = t("user.confirm.already active")
+ flash[:error] = t("users.confirm.already active")
redirect_to :action => "login"
elsif !token || token.expired?
- flash[:error] = t("user.confirm.unknown token")
+ flash[:error] = t("users.confirm.unknown token")
redirect_to :action => "confirm"
else
user = token.user
end
if token.nil? || token.user != user
- flash[:notice] = t("user.confirm.success")
+ flash[:notice] = t("users.confirm.success")
redirect_to :action => :login, :referer => referer
else
token.destroy
token = UserToken.find_by(:token => session[:token])
if user.nil? || token.nil? || token.user != user
- flash[:error] = t "user.confirm_resend.failure", :name => params[:display_name]
+ flash[:error] = t "users.confirm_resend.failure", :name => params[:display_name]
else
Notifier.signup_confirm(user, user.tokens.create).deliver_now
- flash[:notice] = t("user.confirm_resend.success", :email => user.email, :sender => SUPPORT_EMAIL).html_safe
+ flash[:notice] = t("users.confirm_resend.success", :email => user.email, :sender => SUPPORT_EMAIL).html_safe
end
redirect_to :action => "login"
gravatar_enabled = gravatar_enable(current_user)
if current_user.save
flash[:notice] = if gravatar_enabled
- t("user.confirm_email.success") + " " + gravatar_status_message(current_user)
+ t("users.confirm_email.success") + " " + gravatar_status_message(current_user)
else
- t("user.confirm_email.success")
+ t("users.confirm_email.success")
end
else
flash[:errors] = current_user.errors
session[:user] = current_user.id
redirect_to :action => "account", :display_name => current_user.display_name
elsif token
- flash[:error] = t "user.confirm_email.failure"
+ flash[:error] = t "users.confirm_email.failure"
redirect_to :action => "account", :display_name => token.user.display_name
else
- flash[:error] = t "user.confirm_email.unknown_token"
+ flash[:error] = t "users.confirm_email.unknown_token"
end
end
end
friend.befriender = current_user
friend.befriendee = @new_friend
if current_user.is_friends_with?(@new_friend)
- flash[:warning] = t "user.make_friend.already_a_friend", :name => @new_friend.display_name
+ flash[:warning] = t "users.make_friend.already_a_friend", :name => @new_friend.display_name
elsif friend.save
- flash[:notice] = t "user.make_friend.success", :name => @new_friend.display_name
+ flash[:notice] = t "users.make_friend.success", :name => @new_friend.display_name
Notifier.friend_notification(friend).deliver_now
else
- friend.add_error(t("user.make_friend.failed", :name => @new_friend.display_name))
+ friend.add_error(t("users.make_friend.failed", :name => @new_friend.display_name))
end
if params[:referer]
if request.post?
if current_user.is_friends_with?(@friend)
Friend.where(:user_id => current_user.id, :friend_user_id => @friend.id).delete_all
- flash[:notice] = t "user.remove_friend.success", :name => @friend.display_name
+ flash[:notice] = t "users.remove_friend.success", :name => @friend.display_name
else
- flash[:error] = t "user.remove_friend.not_a_friend", :name => @friend.display_name
+ flash[:error] = t "users.remove_friend.not_a_friend", :name => @friend.display_name
end
if params[:referer]
when "active", "confirmed" then
successful_login(user, request.env["omniauth.params"]["referer"])
when "suspended" then
- failed_login t("user.login.account is suspended", :webmaster => "mailto:#{SUPPORT_EMAIL}").html_safe
+ failed_login t("users.login.account is suspended", :webmaster => "mailto:#{SUPPORT_EMAIL}").html_safe
else
- failed_login t("user.login.auth failure")
+ failed_login t("users.login.auth failure")
end
else
redirect_to :action => "new", :nickname => name, :email => email,
##
# omniauth failure callback
def auth_failure
- flash[:error] = t("user.auth_failure." + params[:message])
+ flash[:error] = t("users.auth_failure." + params[:message])
redirect_to params[:origin] || login_url
end
elsif user = User.authenticate(:username => username, :password => password, :pending => true)
unconfirmed_login(user)
elsif User.authenticate(:username => username, :password => password, :suspended => true)
- failed_login t("user.login.account is suspended", :webmaster => "mailto:#{SUPPORT_EMAIL}").html_safe, username
+ failed_login t("users.login.account is suspended", :webmaster => "mailto:#{SUPPORT_EMAIL}").html_safe, username
else
- failed_login t("user.login.auth failure"), username
+ failed_login t("users.login.auth failure"), username
end
end
set_locale(true)
if user.new_email.blank? || user.new_email == user.email
- flash.now[:notice] = t "user.account.flash update success"
+ flash.now[:notice] = t "users.account.flash update success"
else
user.email = user.new_email
if user.valid?
- flash.now[:notice] = t "user.account.flash update success confirm needed"
+ flash.now[:notice] = t "users.account.flash update success confirm needed"
begin
Notifier.email_confirm(user, user.tokens.create).deliver_now
# and return them to the user page.
def require_administrator
if current_user && !current_user.administrator?
- flash[:error] = t("user.filter.not_an_administrator")
+ flash[:error] = t("users.filter.not_an_administrator")
if params[:display_name]
redirect_to user_path(:display_name => params[:display_name])
# display a message about th current status of the gravatar setting
def gravatar_status_message(user)
if user.image_use_gravatar
- t "user.account.gravatar.enabled"
+ t "users.account.gravatar.enabled"
else
- t "user.account.gravatar.disabled"
+ t "users.account.gravatar.disabled"
end
end
end
module ChangesetHelper
def changeset_user_link(changeset)
if changeset.user.status == "deleted"
- t("user.no_such_user.deleted")
+ t("users.no_such_user.deleted")
elsif changeset.user.data_public?
link_to(changeset.user.display_name, user_path(changeset.user))
else
if author.nil?
""
elsif author.status == "deleted"
- t("user.no_such_user.deleted")
+ t("users.no_such_user.deleted")
else
- link_to h(author.display_name), link_options.merge(:controller => "user", :action => "show", :display_name => author.display_name)
+ link_to h(author.display_name), link_options.merge(:controller => "users", :action => "show", :display_name => author.display_name)
end
end
end
# External authentication support
def openid_logo
- image_tag "openid_small.png", :alt => t("user.login.openid_logo_alt"), :class => "openid_logo"
+ image_tag "openid_small.png", :alt => t("users.login.openid_logo_alt"), :class => "openid_logo"
end
def auth_button(name, provider, options = {})
link_to(
- image_tag("#{name}.png", :alt => t("user.login.auth_providers.#{name}.alt")),
+ image_tag("#{name}.png", :alt => t("users.login.auth_providers.#{name}.alt")),
auth_path(options.merge(:provider => provider)),
:class => "auth_button",
- :title => t("user.login.auth_providers.#{name}.title")
+ :title => t("users.login.auth_providers.#{name}.title")
)
end
if current_user&.administrator?
if user.has_role?(role)
image = "roles/#{role}"
- alt = t("user.show.role.revoke.#{role}")
- title = t("user.show.role.revoke.#{role}")
+ alt = t("users.show.role.revoke.#{role}")
+ title = t("users.show.role.revoke.#{role}")
url = revoke_role_path(:display_name => user.display_name, :role => role)
confirm = t("user_role.revoke.are_you_sure", :name => user.display_name, :role => role)
else
image = "roles/blank_#{role}"
- alt = t("user.show.role.grant.#{role}")
- title = t("user.show.role.grant.#{role}")
+ alt = t("users.show.role.grant.#{role}")
+ title = t("users.show.role.grant.#{role}")
url = grant_role_path(:display_name => user.display_name, :role => role)
confirm = t("user_role.grant.are_you_sure", :name => user.display_name, :role => role)
end
elsif user.has_role?(role)
image = "roles/#{role}"
- alt = t("user.show.role.#{role}")
- title = t("user.show.role.#{role}")
+ alt = t("users.show.role.#{role}")
+ title = t("users.show.role.#{role}")
end
if image
def signup_confirm(user, token)
with_recipient_locale user do
- @url = url_for(:controller => "user", :action => "confirm",
+ @url = url_for(:controller => "users", :action => "confirm",
:display_name => user.display_name,
:confirm_string => token.token)
def email_confirm(user, token)
with_recipient_locale user do
@address = user.new_email
- @url = url_for(:controller => "user", :action => "confirm_email",
+ @url = url_for(:controller => "users", :action => "confirm_email",
:confirm_string => token.token)
mail :to => user.new_email,
def lost_password(user, token)
with_recipient_locale user do
- @url = url_for(:controller => "user", :action => "reset_password",
+ @url = url_for(:controller => "users", :action => "reset_password",
:token => token.token)
mail :to => user.email,
with_recipient_locale friend.befriendee do
@friend = friend
@viewurl = user_url(@friend.befriender)
- @friendurl = url_for(:controller => "user", :action => "make_friend",
+ @friendurl = url_for(:controller => "users", :action => "make_friend",
:display_name => @friend.befriender.display_name)
@author = @friend.befriender.display_name
<% unless current_user %>
<div class="notice">
- <%= link_to(t(".join_discussion"), :controller => 'user', :action => 'login', :referer => request.fullpath) %>
+ <%= link_to(t(".join_discussion"), :controller => 'users', :action => 'login', :referer => request.fullpath) %>
</div>
<% end %>
-xml.a(user.display_name, :href => url_for(:controller => "user", :action => "view", :display_name => user.display_name))
+xml.a(user.display_name, :href => url_for(:controller => "users", :action => "view", :display_name => user.display_name))
<div class="diary-subscribe-buttons"><%= link_to t('javascripts.changesets.show.subscribe'), diary_entry_subscribe_path(:display_name => @entry.user.display_name, :id => @entry.id), :method => :post, :class => :button %></div>
<% end %>
<% else %>
- <h3 id="newcomment"><%= raw t(".login_to_leave_a_comment", :login_link => link_to(t(".login"), :controller => 'user', :action => 'login', :referer => request.fullpath)) %></h3>
+ <h3 id="newcomment"><%= raw t(".login_to_leave_a_comment", :login_link => link_to(t(".login"), :controller => 'users', :action => 'login', :referer => request.fullpath)) %></h3>
<% end %>
</div>
<li>
<%= link_to inbox_messages_path do %>
<span class='count-number'><%= number_with_delimiter(current_user.new_messages.size) %></span>
- <%= t('user.show.my messages') %>
+ <%= t('users.show.my messages') %>
<% end %>
</li>
<li>
- <%= link_to t('user.show.my profile'), user_path(current_user) %>
+ <%= link_to t('users.show.my profile'), user_path(current_user) %>
</li>
<li>
- <%= link_to t('user.show.my settings'), :controller => 'user', :action => 'account', :display_name => current_user.display_name %>
+ <%= link_to t('users.show.my settings'), :controller => 'users', :action => 'account', :display_name => current_user.display_name %>
</li>
<li class="divider"></li>
<li>
</p>
<ul class='secondary-actions clearfix deemphasize'>
- <li><%= link_to t('user.show.send message'), new_message_path(contact) %></li>
+ <li><%= link_to t('users.show.send message'), new_message_path(contact) %></li>
<li>
<% if current_user.is_friends_with?(contact) %>
- <%= link_to t('user.show.remove as friend'), remove_friend_path(:display_name => contact.display_name, :referer => request.fullpath), :method => :post %>
+ <%= link_to t('users.show.remove as friend'), remove_friend_path(:display_name => contact.display_name, :referer => request.fullpath), :method => :post %>
<% else %>
- <%= link_to t('user.show.add as friend'), make_friend_path(:display_name => contact.display_name, :referer => request.fullpath), :method => :post %>
+ <%= link_to t('users.show.add as friend'), make_friend_path(:display_name => contact.display_name, :referer => request.fullpath), :method => :post %>
<% end %>
</li>
</ul>
<td>
<p>
<% if user.creation_ip %>
- <%= raw t 'user.index.summary',
+ <%= raw t 'users.index.summary',
:name => link_to(h(user.display_name), user_path(user)),
:ip_address => link_to(user.creation_ip, :ip => user.creation_ip),
:date => l(user.creation_time, :format => :friendly)
%>
<% else %>
- <%= raw t 'user.index.summary_no_ip',
+ <%= raw t 'users.index.summary_no_ip',
:name => link_to(h(user.display_name), user_path(user)),
:date => l(user.creation_time, :format => :friendly)
%>
<h1><%= t '.my settings' %></h1>
<ul class='secondary-actions clearfix'>
<li><%= link_to t('.return to profile'), user_path(current_user) %></li>
- <li><%= link_to t('user.show.oauth settings'), :controller => 'oauth_clients', :action => 'index' %></li>
+ <li><%= link_to t('users.show.oauth settings'), :controller => 'oauth_clients', :action => 'index' %></li>
</ul>
<% end %>
<%= form_for current_user, :url => { :action => :account }, :method => :post, :html => { :multipart => true, :id => 'accountForm', :class => 'standard-form', :autocomplete => :off } do |f| %>
<fieldset>
<div class="form-row">
- <label class="standard-label"><%= t 'user.new.display name' %></label>
+ <label class="standard-label"><%= t 'users.new.display name' %></label>
<%= f.text_field :display_name %>
</div>
</fieldset>
<fieldset>
<div class="form-row">
- <label class="standard-label"><%= t 'user.new.password' %></label>
+ <label class="standard-label"><%= t 'users.new.password' %></label>
<%= f.password_field :pass_crypt, {:value => '', :autocomplete => :off} %>
</div>
<div class="form-row">
- <label class="standard-label"><%= t 'user.new.confirm password' %></label>
+ <label class="standard-label"><%= t 'users.new.confirm password' %></label>
<%= f.password_field :pass_crypt_confirmation, {:value => '', :autocomplete => :off} %>
</div>
</fieldset>
<% end %>
<% else %>
<%= t '.contributor terms.not yet agreed' %>
- <%= link_to t('.contributor terms.review link text'), :controller => 'user', :action => 'terms' %>
+ <%= link_to t('.contributor terms.review link text'), :controller => 'users', :action => 'terms' %>
<% end %>
</span>
</div>
<%= password_field_tag "password", "", :tabindex => 2 %>
</div>
<span class="form-help deemphasize">
- <%= link_to t('.lost password link'), :controller => 'user', :action => 'lost_password' %>
+ <%= link_to t('.lost password link'), :controller => 'users', :action => 'lost_password' %>
</span>
</fieldset>
<div id='login_openid_url' class='form-row'>
<label for='openid_url' class="standard-label"><%= raw t '.openid', :logo => openid_logo %></label>
<%= text_field_tag("openid_url", "", { :tabindex => 3, :class => "openid_url" }) %>
- <span class="minorNote">(<a href="<%= t 'user.account.openid.link' %>" target="_new"><%= t 'user.account.openid.link text' %></a>)</span>
+ <span class="minorNote">(<a href="<%= t 'users.account.openid.link' %>" target="_new"><%= t 'users.account.openid.link text' %></a>)</span>
</div>
<div class='form-row'>
<%= link_to t('.my comments' ), :controller => 'diary_entry', :action => 'comments', :display_name => current_user.display_name %>
</li>
<li>
- <%= link_to t('.my settings'), :controller => 'user', :action => 'account', :display_name => current_user.display_name %>
+ <%= link_to t('.my settings'), :controller => 'users', :action => 'account', :display_name => current_user.display_name %>
</li>
<% if current_user.blocks.exists? %>
<% if current_user and @user.id == current_user.id %>
<% if @user.home_lat.nil? or @user.home_lon.nil? %>
<div id="map" class="content_map">
- <p id="no_home_location"><%= raw(t '.if set location', :settings_link => (link_to t('.settings_link_text'), :controller => 'user', :action => 'account', :display_name => current_user.display_name)) %></p>
+ <p id="no_home_location"><%= raw(t '.if set location', :settings_link => (link_to t('.settings_link_text'), :controller => 'users', :action => 'account', :display_name => current_user.display_name)) %></p>
</div>
<% else %>
<% content_for :head do %>
flash: "Updated the client information successfully"
destroy:
flash: "Destroyed the client application registration"
- user:
+ users:
login:
title: "Login"
heading: "Login"
get "relations/search" => "search#search_relations"
get "nodes/search" => "search#search_nodes"
- get "user/:id" => "user#api_read", :id => /\d+/
- get "user/details" => "user#api_details"
- get "user/gpx_files" => "user#api_gpx_files"
- get "users" => "user#api_users", :as => :api_users
+ get "user/:id" => "users#api_read", :id => /\d+/
+ get "user/details" => "users#api_details"
+ get "user/gpx_files" => "users#api_gpx_files"
+ get "users" => "users#api_users", :as => :api_users
get "user/preferences" => "user_preferences#read"
get "user/preferences/:preference_key" => "user_preferences#read_one"
get "/history/feed" => "changeset#feed", :defaults => { :format => :atom }
get "/history/comments/feed" => "changeset#comments_feed", :as => :changesets_comments_feed, :defaults => { :format => "rss" }
get "/export" => "site#export"
- match "/login" => "user#login", :via => [:get, :post]
- match "/logout" => "user#logout", :via => [:get, :post]
+ match "/login" => "users#login", :via => [:get, :post]
+ match "/logout" => "users#logout", :via => [:get, :post]
get "/offline" => "site#offline"
get "/key" => "site#key"
get "/id" => "site#id"
get "/query" => "browse#query"
- get "/user/new" => "user#new"
- post "/user/new" => "user#create"
- get "/user/terms" => "user#terms"
- post "/user/save" => "user#save"
- get "/user/:display_name/confirm/resend" => "user#confirm_resend"
- match "/user/:display_name/confirm" => "user#confirm", :via => [:get, :post]
- match "/user/confirm" => "user#confirm", :via => [:get, :post]
- match "/user/confirm-email" => "user#confirm_email", :via => [:get, :post]
- post "/user/go_public" => "user#go_public"
- match "/user/reset-password" => "user#reset_password", :via => [:get, :post]
- match "/user/forgot-password" => "user#lost_password", :via => [:get, :post]
- get "/user/suspended" => "user#suspended"
+ get "/user/new" => "users#new"
+ post "/user/new" => "users#create"
+ get "/user/terms" => "users#terms"
+ post "/user/save" => "users#save"
+ get "/user/:display_name/confirm/resend" => "users#confirm_resend"
+ match "/user/:display_name/confirm" => "users#confirm", :via => [:get, :post]
+ match "/user/confirm" => "users#confirm", :via => [:get, :post]
+ match "/user/confirm-email" => "users#confirm_email", :via => [:get, :post]
+ post "/user/go_public" => "users#go_public"
+ match "/user/reset-password" => "users#reset_password", :via => [:get, :post]
+ match "/user/forgot-password" => "users#lost_password", :via => [:get, :post]
+ get "/user/suspended" => "users#suspended"
get "/index.html", :to => redirect(:path => "/")
get "/create-account.html", :to => redirect(:path => "/user/new")
get "/forgot-password.html", :to => redirect(:path => "/user/forgot-password")
# omniauth
- get "/auth/failure" => "user#auth_failure"
- match "/auth/:provider/callback" => "user#auth_success", :via => [:get, :post], :as => :auth_success
- match "/auth/:provider" => "user#auth", :via => [:get, :post], :as => :auth
+ get "/auth/failure" => "users#auth_failure"
+ match "/auth/:provider/callback" => "users#auth_success", :via => [:get, :post], :as => :auth_success
+ match "/auth/:provider" => "users#auth", :via => [:get, :post], :as => :auth
# permalink
get "/go/:code" => "site#permalink", :code => /[a-zA-Z0-9_@~]+[=-]*/
post "/user/:display_name/diary/:id/unsubscribe" => "diary_entry#unsubscribe", :as => :diary_entry_unsubscribe, :id => /\d+/
# user pages
- get "/user/:display_name" => "user#show", :as => "user"
- match "/user/:display_name/make_friend" => "user#make_friend", :via => [:get, :post], :as => "make_friend"
- match "/user/:display_name/remove_friend" => "user#remove_friend", :via => [:get, :post], :as => "remove_friend"
- match "/user/:display_name/account" => "user#account", :via => [:get, :post]
- get "/user/:display_name/set_status" => "user#set_status", :as => :set_status_user
- get "/user/:display_name/delete" => "user#delete", :as => :delete_user
+ get "/user/:display_name" => "users#show", :as => "user"
+ match "/user/:display_name/make_friend" => "users#make_friend", :via => [:get, :post], :as => "make_friend"
+ match "/user/:display_name/remove_friend" => "users#remove_friend", :via => [:get, :post], :as => "remove_friend"
+ match "/user/:display_name/account" => "users#account", :via => [:get, :post]
+ get "/user/:display_name/set_status" => "users#set_status", :as => :set_status_user
+ get "/user/:display_name/delete" => "users#delete", :as => :delete_user
# user lists
- match "/users" => "user#index", :via => [:get, :post]
- match "/users/:status" => "user#index", :via => [:get, :post]
+ match "/users" => "users#index", :via => [:get, :post]
+ match "/users/:status" => "users#index", :via => [:get, :post]
# geocoder
get "/search" => "geocoder#search"
def test_index_user_not_found
get :index, :params => { :format => "html", :display_name => "Some random user" }
assert_response :not_found
- assert_template "user/no_such_user"
+ assert_template "users/no_such_user"
get :index, :params => { :format => "html", :display_name => "Some random user", :list => "1" }, :xhr => true
assert_response :not_found
- assert_template "user/no_such_user"
+ assert_template "users/no_such_user"
end
##
get :index, :params => { :friends => true }
assert_response :redirect
- assert_redirected_to :controller => :user, :action => :login, :referer => friend_changesets_path
+ assert_redirected_to :controller => :users, :action => :login, :referer => friend_changesets_path
session[:user] = private_user.id
get :index, :params => { :nearby => true }
assert_response :redirect
- assert_redirected_to :controller => :user, :action => :login, :referer => nearby_changesets_path
+ assert_redirected_to :controller => :users, :action => :login, :referer => nearby_changesets_path
session[:user] = private_user.id
# are not logged in
get :new
assert_response :redirect
- assert_redirected_to :controller => :user, :action => :login, :referer => "/diary/new"
+ assert_redirected_to :controller => :users, :action => :login, :referer => "/diary/new"
end
def test_new_form
:params => { :display_name => user.display_name },
:session => { :user => user }
assert_response :redirect
- assert_redirected_to :controller => :user, :action => :suspended
+ assert_redirected_to :controller => :users, :action => :suspended
end
def test_edit
get :edit,
:params => { :display_name => entry.user.display_name, :id => entry.id }
assert_response :redirect
- assert_redirected_to :controller => :user, :action => :login, :referer => "/user/#{ERB::Util.u(entry.user.display_name)}/diary/#{entry.id}/edit"
+ assert_redirected_to :controller => :users, :action => :login, :referer => "/user/#{ERB::Util.u(entry.user.display_name)}/diary/#{entry.id}/edit"
# Verify that you get a not found error, when you pass a bogus id
get :edit,
:params => { :display_name => user.display_name },
:session => { :user => other_user }
assert_response :redirect
- assert_redirected_to :controller => :user, :action => :suspended
+ assert_redirected_to :controller => :users, :action => :suspended
# Now show the diary entry, and check the new comment is not present
get :show,
# Try a list of diary entries for an invalid user
get :index, :params => { :display_name => "No Such User" }
assert_response :not_found
- assert_template "user/no_such_user"
+ assert_template "users/no_such_user"
end
def test_index_friends
# Try a list of diary entries for your friends when not logged in
get :index, :params => { :friends => true }
assert_response :redirect
- assert_redirected_to :controller => :user, :action => :login, :referer => "/diary/friends"
+ assert_redirected_to :controller => :users, :action => :login, :referer => "/diary/friends"
# Try a list of diary entries for your friends when logged in
get :index, :params => { :friends => true }, :session => { :user => user }
# Try a list of diary entries for nearby users when not logged in
get :index, :params => { :nearby => true }
assert_response :redirect
- assert_redirected_to :controller => :user, :action => :login, :referer => "/diary/nearby"
+ assert_redirected_to :controller => :users, :action => :login, :referer => "/diary/nearby"
# Try a list of diary entries for nearby users when logged in
get :index, :params => { :nearby => true }, :session => { :user => nearby_user }
# Asking to send a message with a bogus user name should fail
get :new, :params => { :display_name => "non_existent_user" }
assert_response :not_found
- assert_template "user/no_such_user"
+ assert_template "users/no_such_user"
assert_select "h1", "The user non_existent_user does not exist"
end
def test_edit
get :edit
assert_response :redirect
- assert_redirected_to :controller => :user, :action => :login, :referer => "/edit"
+ assert_redirected_to :controller => :users, :action => :login, :referer => "/edit"
end
# Test the right editor gets used when the user hasn't set a preference
def test_welcome
get :welcome
assert_response :redirect
- assert_redirected_to :controller => :user, :action => :login, :referer => "/welcome"
+ assert_redirected_to :controller => :users, :action => :login, :referer => "/welcome"
get :welcome, :session => { :user => create(:user) }
assert_response :success
# First try to get it when not logged in
get :mine
- assert_redirected_to :controller => "user", :action => "login", :referer => "/traces/mine"
+ assert_redirected_to :controller => "users", :action => "login", :referer => "/traces/mine"
# Now try when logged in
get :mine, :session => { :user => user }
# Should get an error if the user does not exist
get :index, :params => { :display_name => "UnknownUser" }
assert_response :not_found
- assert_template "user/no_such_user"
+ assert_template "users/no_such_user"
end
# Check a multi-page index
# First with no auth
get :new
assert_response :redirect
- assert_redirected_to :controller => :user, :action => :login, :referer => new_trace_path
+ assert_redirected_to :controller => :users, :action => :login, :referer => new_trace_path
# Now authenticated as a user with gps.trace.visibility set
user = create(:user)
# First with no auth
get :edit, :params => { :display_name => public_trace_file.user.display_name, :id => public_trace_file.id }
assert_response :redirect
- assert_redirected_to :controller => :user, :action => :login, :referer => edit_trace_path(:display_name => public_trace_file.user.display_name, :id => public_trace_file.id)
+ assert_redirected_to :controller => :users, :action => :login, :referer => edit_trace_path(:display_name => public_trace_file.user.display_name, :id => public_trace_file.id)
# Now with some other user, which should fail
get :edit, :params => { :display_name => public_trace_file.user.display_name, :id => public_trace_file.id }, :session => { :user => create(:user) }
# We should get an error if no user is specified
get :new
assert_response :not_found
- assert_template "user/no_such_user"
+ assert_template "users/no_such_user"
assert_select "h1", "The user does not exist"
# We should get an error if the user doesn't exist
get :new, :params => { :display_name => "non_existent_user" }
assert_response :not_found
- assert_template "user/no_such_user"
+ assert_template "users/no_such_user"
assert_select "h1", "The user non_existent_user does not exist"
end
# We should get an error if no user is specified
post :create
assert_response :not_found
- assert_template "user/no_such_user"
+ assert_template "users/no_such_user"
assert_select "h1", "The user does not exist"
# We should get an error if the user doesn't exist
post :create, :params => { :display_name => "non_existent_user" }
assert_response :not_found
- assert_template "user/no_such_user"
+ assert_template "users/no_such_user"
assert_select "h1", "The user non_existent_user does not exist"
end
# Asking for a list of blocks with a bogus user name should fail
get :blocks_on, :params => { :display_name => "non_existent_user" }
assert_response :not_found
- assert_template "user/no_such_user"
+ assert_template "users/no_such_user"
assert_select "h1", "The user non_existent_user does not exist"
# Check the list of blocks for a user that has never been blocked
# Asking for a list of blocks with a bogus user name should fail
get :blocks_by, :params => { :display_name => "non_existent_user" }
assert_response :not_found
- assert_template "user/no_such_user"
+ assert_template "users/no_such_user"
assert_select "h1", "The user non_existent_user does not exist"
# Check the list of blocks given by one moderator
post :grant, :params => { :display_name => "non_existent_user", :role => role }
end
assert_response :not_found
- assert_template "user/no_such_user"
+ assert_template "users/no_such_user"
assert_select "h1", "The user non_existent_user does not exist"
# Granting a role to a user that already has it should fail
post :revoke, :params => { :display_name => "non_existent_user", :role => role }
end
assert_response :not_found
- assert_template "user/no_such_user"
+ assert_template "users/no_such_user"
assert_select "h1", "The user non_existent_user does not exist"
# Removing a role from a user that doesn't have it should fail
require "test_helper"
-class UserControllerTest < ActionController::TestCase
+class UsersControllerTest < ActionController::TestCase
def setup
stub_hostip_requests
end
def test_routes
assert_routing(
{ :path => "/api/0.6/user/1", :method => :get },
- { :controller => "user", :action => "api_read", :id => "1" }
+ { :controller => "users", :action => "api_read", :id => "1" }
)
assert_routing(
{ :path => "/api/0.6/user/details", :method => :get },
- { :controller => "user", :action => "api_details" }
+ { :controller => "users", :action => "api_details" }
)
assert_routing(
{ :path => "/api/0.6/user/gpx_files", :method => :get },
- { :controller => "user", :action => "api_gpx_files" }
+ { :controller => "users", :action => "api_gpx_files" }
)
assert_routing(
{ :path => "/api/0.6/users", :method => :get },
- { :controller => "user", :action => "api_users" }
+ { :controller => "users", :action => "api_users" }
)
assert_routing(
{ :path => "/login", :method => :get },
- { :controller => "user", :action => "login" }
+ { :controller => "users", :action => "login" }
)
assert_routing(
{ :path => "/login", :method => :post },
- { :controller => "user", :action => "login" }
+ { :controller => "users", :action => "login" }
)
assert_recognizes(
- { :controller => "user", :action => "login", :format => "html" },
+ { :controller => "users", :action => "login", :format => "html" },
{ :path => "/login.html", :method => :get }
)
assert_routing(
{ :path => "/logout", :method => :get },
- { :controller => "user", :action => "logout" }
+ { :controller => "users", :action => "logout" }
)
assert_routing(
{ :path => "/logout", :method => :post },
- { :controller => "user", :action => "logout" }
+ { :controller => "users", :action => "logout" }
)
assert_recognizes(
- { :controller => "user", :action => "logout", :format => "html" },
+ { :controller => "users", :action => "logout", :format => "html" },
{ :path => "/logout.html", :method => :get }
)
assert_routing(
{ :path => "/user/new", :method => :get },
- { :controller => "user", :action => "new" }
+ { :controller => "users", :action => "new" }
)
assert_routing(
{ :path => "/user/new", :method => :post },
- { :controller => "user", :action => "create" }
+ { :controller => "users", :action => "create" }
)
assert_routing(
{ :path => "/user/terms", :method => :get },
- { :controller => "user", :action => "terms" }
+ { :controller => "users", :action => "terms" }
)
assert_routing(
{ :path => "/user/save", :method => :post },
- { :controller => "user", :action => "save" }
+ { :controller => "users", :action => "save" }
)
assert_routing(
{ :path => "/user/username/confirm", :method => :get },
- { :controller => "user", :action => "confirm", :display_name => "username" }
+ { :controller => "users", :action => "confirm", :display_name => "username" }
)
assert_routing(
{ :path => "/user/username/confirm", :method => :post },
- { :controller => "user", :action => "confirm", :display_name => "username" }
+ { :controller => "users", :action => "confirm", :display_name => "username" }
)
assert_routing(
{ :path => "/user/username/confirm/resend", :method => :get },
- { :controller => "user", :action => "confirm_resend", :display_name => "username" }
+ { :controller => "users", :action => "confirm_resend", :display_name => "username" }
)
assert_routing(
{ :path => "/user/confirm", :method => :get },
- { :controller => "user", :action => "confirm" }
+ { :controller => "users", :action => "confirm" }
)
assert_routing(
{ :path => "/user/confirm", :method => :post },
- { :controller => "user", :action => "confirm" }
+ { :controller => "users", :action => "confirm" }
)
assert_routing(
{ :path => "/user/confirm-email", :method => :get },
- { :controller => "user", :action => "confirm_email" }
+ { :controller => "users", :action => "confirm_email" }
)
assert_routing(
{ :path => "/user/confirm-email", :method => :post },
- { :controller => "user", :action => "confirm_email" }
+ { :controller => "users", :action => "confirm_email" }
)
assert_routing(
{ :path => "/user/go_public", :method => :post },
- { :controller => "user", :action => "go_public" }
+ { :controller => "users", :action => "go_public" }
)
assert_routing(
{ :path => "/user/forgot-password", :method => :get },
- { :controller => "user", :action => "lost_password" }
+ { :controller => "users", :action => "lost_password" }
)
assert_routing(
{ :path => "/user/forgot-password", :method => :post },
- { :controller => "user", :action => "lost_password" }
+ { :controller => "users", :action => "lost_password" }
)
assert_routing(
{ :path => "/user/reset-password", :method => :get },
- { :controller => "user", :action => "reset_password" }
+ { :controller => "users", :action => "reset_password" }
)
assert_routing(
{ :path => "/user/reset-password", :method => :post },
- { :controller => "user", :action => "reset_password" }
+ { :controller => "users", :action => "reset_password" }
)
assert_routing(
{ :path => "/user/suspended", :method => :get },
- { :controller => "user", :action => "suspended" }
+ { :controller => "users", :action => "suspended" }
)
assert_routing(
{ :path => "/user/username", :method => :get },
- { :controller => "user", :action => "show", :display_name => "username" }
+ { :controller => "users", :action => "show", :display_name => "username" }
)
assert_routing(
{ :path => "/user/username/account", :method => :get },
- { :controller => "user", :action => "account", :display_name => "username" }
+ { :controller => "users", :action => "account", :display_name => "username" }
)
assert_routing(
{ :path => "/user/username/account", :method => :post },
- { :controller => "user", :action => "account", :display_name => "username" }
+ { :controller => "users", :action => "account", :display_name => "username" }
)
assert_routing(
{ :path => "/user/username/make_friend", :method => :get },
- { :controller => "user", :action => "make_friend", :display_name => "username" }
+ { :controller => "users", :action => "make_friend", :display_name => "username" }
)
assert_routing(
{ :path => "/user/username/make_friend", :method => :post },
- { :controller => "user", :action => "make_friend", :display_name => "username" }
+ { :controller => "users", :action => "make_friend", :display_name => "username" }
)
assert_routing(
{ :path => "/user/username/remove_friend", :method => :get },
- { :controller => "user", :action => "remove_friend", :display_name => "username" }
+ { :controller => "users", :action => "remove_friend", :display_name => "username" }
)
assert_routing(
{ :path => "/user/username/remove_friend", :method => :post },
- { :controller => "user", :action => "remove_friend", :display_name => "username" }
+ { :controller => "users", :action => "remove_friend", :display_name => "username" }
)
assert_routing(
{ :path => "/user/username/set_status", :method => :get },
- { :controller => "user", :action => "set_status", :display_name => "username" }
+ { :controller => "users", :action => "set_status", :display_name => "username" }
)
assert_routing(
{ :path => "/user/username/delete", :method => :get },
- { :controller => "user", :action => "delete", :display_name => "username" }
+ { :controller => "users", :action => "delete", :display_name => "username" }
)
assert_routing(
{ :path => "/users", :method => :get },
- { :controller => "user", :action => "index" }
+ { :controller => "users", :action => "index" }
)
assert_routing(
{ :path => "/users", :method => :post },
- { :controller => "user", :action => "index" }
+ { :controller => "users", :action => "index" }
)
assert_routing(
{ :path => "/users/status", :method => :get },
- { :controller => "user", :action => "index", :status => "status" }
+ { :controller => "users", :action => "index", :status => "status" }
)
assert_routing(
{ :path => "/users/status", :method => :post },
- { :controller => "user", :action => "index", :status => "status" }
+ { :controller => "users", :action => "index", :status => "status" }
)
end
# you are not logged in
get :account, :params => { :display_name => user.display_name }
assert_response :redirect
- assert_redirected_to :controller => :user, :action => "login", :referer => "/user/#{ERB::Util.u(user.display_name)}/account"
+ assert_redirected_to :action => "login", :referer => "/user/#{ERB::Util.u(user.display_name)}/account"
# Make sure that you are blocked when not logged in as the right user
get :account, :params => { :display_name => user.display_name }, :session => { :user => create(:user) }
# When not logged in a GET should ask us to login
get :make_friend, :params => { :display_name => friend.display_name }
- assert_redirected_to :controller => :user, :action => "login", :referer => make_friend_path(:display_name => friend.display_name)
+ assert_redirected_to :action => "login", :referer => make_friend_path(:display_name => friend.display_name)
# When not logged in a POST should error
post :make_friend, :params => { :display_name => friend.display_name }
# When not logged in a GET should ask us to login
get :remove_friend, :params => { :display_name => friend.display_name }
- assert_redirected_to :controller => :user, :action => "login", :referer => remove_friend_path(:display_name => friend.display_name)
+ assert_redirected_to :action => "login", :referer => remove_friend_path(:display_name => friend.display_name)
# When not logged in a POST should error
post :remove_friend, :params => { :display_name => friend.display_name }
get "/login"
assert_response :redirect
- assert_redirected_to "controller" => "user", "action" => "login", "cookie_test" => "true"
+ assert_redirected_to "controller" => "users", "action" => "login", "cookie_test" => "true"
follow_redirect!
assert_response :success
post "/login", :params => { "username" => user.email, "password" => "test", :referer => "/user/#{ERB::Util.u(user.display_name)}" }
assert_response :redirect
follow_redirect!
assert_response :success
- assert_template "user/show"
+ assert_template "users/show"
get "/user/#{ERB::Util.u(user.display_name)}/account"
assert_response :success
- assert_template "user/account"
+ assert_template "users/account"
# check that the form to allow new client application creations exists
assert_in_heading do
follow_redirect!
# We should now be at the login page
assert_response :success
- assert_template "user/login"
+ assert_template "users/login"
# We can now login
post "/login", :params => { "username" => user.email, "password" => "test" }
assert_response :redirect
get "/user/new", :headers => { "HTTP_ACCEPT_LANGUAGE" => locale.to_s }
follow_redirect!
assert_response :success
- assert_template "user/new"
+ assert_template "users/new"
end
end
end
end
assert_response :success
- assert_template "user/new"
+ assert_template "users/new"
assert_equal locale.to_s, response.headers["Content-Language"] unless locale == :root
assert_select "form > fieldset > div.form-row > input.field_with_errors#user_email"
assert_no_missing_translations
end
end
assert_response :success
- assert_template "user/new"
+ assert_template "users/new"
assert_select "form > fieldset > div.form-row > input.field_with_errors#user_display_name"
assert_no_missing_translations
end
# Check the page
assert_response :success
- assert_template "user/confirm"
+ assert_template "users/confirm"
ActionMailer::Base.deliveries.clear
end
# Check the page
assert_response :success
- assert_template "user/confirm"
+ assert_template "users/confirm"
ActionMailer::Base.deliveries.clear
# Go to the confirmation page
get "/user/#{display_name}/confirm", :params => { :confirm_string => confirm_string }
assert_response :success
- assert_template "user/confirm"
+ assert_template "users/confirm"
post "/user/#{display_name}/confirm", :params => { :confirm_string => confirm_string }
assert_response :redirect
# Check the page
assert_response :success
- assert_template "user/confirm"
+ assert_template "users/confirm"
ActionMailer::Base.deliveries.clear
end
assert_response :redirect
follow_redirect!
assert_response :success
- assert_template "user/new"
+ assert_template "users/new"
end
end
# Check the page
assert_response :success
- assert_template "user/confirm"
+ assert_template "users/confirm"
ActionMailer::Base.deliveries.clear
# Go to the confirmation page
get "/user/#{display_name}/confirm", :params => { :confirm_string => confirm_string }
assert_response :success
- assert_template "user/confirm"
+ assert_template "users/confirm"
post "/user/#{display_name}/confirm", :params => { :confirm_string => confirm_string }
assert_response :redirect
# Check the page
assert_response :success
- assert_template "user/confirm"
+ assert_template "users/confirm"
ActionMailer::Base.deliveries.clear
end
assert_response :redirect
follow_redirect!
assert_response :success
- assert_template "user/new"
+ assert_template "users/new"
end
end
# Check the page
assert_response :success
- assert_template "user/confirm"
+ assert_template "users/confirm"
ActionMailer::Base.deliveries.clear
# Go to the confirmation page
get "/user/#{display_name}/confirm", :params => { :confirm_string => confirm_string }
assert_response :success
- assert_template "user/confirm"
+ assert_template "users/confirm"
post "/user/#{display_name}/confirm", :params => { :confirm_string => confirm_string }
assert_response :redirect
# Check the page
assert_response :success
- assert_template "user/confirm"
+ assert_template "users/confirm"
ActionMailer::Base.deliveries.clear
end
assert_response :redirect
follow_redirect!
assert_response :success
- assert_template "user/new"
+ assert_template "users/new"
end
end
# Check the page
assert_response :success
- assert_template "user/confirm"
+ assert_template "users/confirm"
ActionMailer::Base.deliveries.clear
# Go to the confirmation page
get "/user/#{display_name}/confirm", :params => { :confirm_string => confirm_string }
assert_response :success
- assert_template "user/confirm"
+ assert_template "users/confirm"
post "/user/#{display_name}/confirm", :params => { :confirm_string => confirm_string }
assert_response :redirect
# Check the page
assert_response :success
- assert_template "user/confirm"
+ assert_template "users/confirm"
ActionMailer::Base.deliveries.clear
end
assert_response :redirect
follow_redirect!
assert_response :success
- assert_template "user/new"
+ assert_template "users/new"
end
end
# Check the page
assert_response :success
- assert_template "user/confirm"
+ assert_template "users/confirm"
ActionMailer::Base.deliveries.clear
# Go to the confirmation page
get "/user/#{display_name}/confirm", :params => { :confirm_string => confirm_string }
assert_response :success
- assert_template "user/confirm"
+ assert_template "users/confirm"
post "/user/#{display_name}/confirm", :params => { :confirm_string => confirm_string }
assert_response :redirect
# Check the page
assert_response :success
- assert_template "user/confirm"
+ assert_template "users/confirm"
ActionMailer::Base.deliveries.clear
end
assert_response :redirect
follow_redirect!
assert_response :success
- assert_template "user/new"
+ assert_template "users/new"
end
end
# Check the page
assert_response :success
- assert_template "user/confirm"
+ assert_template "users/confirm"
ActionMailer::Base.deliveries.clear
# Go to the confirmation page
get "/user/#{display_name}/confirm", :params => { :confirm_string => confirm_string }
assert_response :success
- assert_template "user/confirm"
+ assert_template "users/confirm"
post "/user/#{display_name}/confirm", :params => { :confirm_string => confirm_string }
assert_response :redirect
# Check the page
assert_response :success
- assert_template "user/confirm"
+ assert_template "users/confirm"
ActionMailer::Base.deliveries.clear
end
assert_response :redirect
follow_redirect!
assert_response :success
- assert_template "user/new"
+ assert_template "users/new"
end
end
# Check the page
assert_response :success
- assert_template "user/confirm"
+ assert_template "users/confirm"
ActionMailer::Base.deliveries.clear
# Go to the confirmation page
get "/user/#{display_name}/confirm", :params => { :confirm_string => confirm_string }
assert_response :success
- assert_template "user/confirm"
+ assert_template "users/confirm"
post "/user/#{display_name}/confirm", :params => { :confirm_string => confirm_string }
assert_response :redirect
follow_redirect!
# We should now be at the login page
assert_response :success
- assert_template "user/login"
+ assert_template "users/login"
# We can now login
post "/login", :params => { "username" => user.email, "password" => "test", :referer => "/diary/new" }
assert_response :redirect
get "/login", :params => { :referer => "/history" }
assert_response :redirect
- assert_redirected_to :controller => :user, :action => :login, :cookie_test => true, :referer => "/history"
+ assert_redirected_to :controller => :users, :action => :login, :cookie_test => true, :referer => "/history"
follow_redirect!
assert_response :success
- assert_template "user/login"
+ assert_template "users/login"
post "/login", :params => { :openid_url => "http://localhost:1123/john.doe", :referer => "/history" }
assert_response :redirect
assert_redirected_to auth_path(:provider => "openid", :openid_url => "http://localhost:1123/john.doe", :origin => "/login?referer=%2Fhistory", :referer => "/history")
get "/login", :params => { :referer => "/history" }
assert_response :redirect
- assert_redirected_to :controller => :user, :action => :login, :cookie_test => true, :referer => "/history"
+ assert_redirected_to :controller => :users, :action => :login, :cookie_test => true, :referer => "/history"
follow_redirect!
assert_response :success
- assert_template "user/login"
+ assert_template "users/login"
post "/login", :params => { :openid_url => user.auth_uid, :remember_me_openid => true, :referer => "/history" }
assert_response :redirect
assert_redirected_to auth_path(:provider => "openid", :openid_url => user.auth_uid, :origin => "/login?referer=%2Fhistory", :referer => "/history")
get "/login", :params => { :referer => "/history" }
assert_response :redirect
- assert_redirected_to :controller => :user, :action => :login, :cookie_test => true, :referer => "/history"
+ assert_redirected_to :controller => :users, :action => :login, :cookie_test => true, :referer => "/history"
follow_redirect!
assert_response :success
- assert_template "user/login"
+ assert_template "users/login"
post "/login", :params => { :openid_url => user.auth_uid, :referer => "/history" }
assert_response :redirect
assert_redirected_to auth_path(:provider => "openid", :openid_url => user.auth_uid, :origin => "/login?referer=%2Fhistory", :referer => "/history")
get "/login", :params => { :referer => "/history" }
assert_response :redirect
- assert_redirected_to :controller => :user, :action => :login, :cookie_test => true, :referer => "/history"
+ assert_redirected_to :controller => :users, :action => :login, :cookie_test => true, :referer => "/history"
follow_redirect!
assert_response :success
- assert_template "user/login"
+ assert_template "users/login"
post "/login", :params => { :openid_url => user.auth_uid, :referer => "/history" }
assert_response :redirect
assert_redirected_to auth_path(:provider => "openid", :openid_url => user.auth_uid, :origin => "/login?referer=%2Fhistory", :referer => "/history")
get "/login", :params => { :referer => "/history" }
assert_response :redirect
- assert_redirected_to :controller => :user, :action => :login, :cookie_test => true, :referer => "/history"
+ assert_redirected_to :controller => :users, :action => :login, :cookie_test => true, :referer => "/history"
follow_redirect!
assert_response :success
- assert_template "user/login"
+ assert_template "users/login"
post "/login", :params => { :openid_url => "http://localhost:1123/fred.bloggs", :referer => "/history" }
assert_response :redirect
assert_redirected_to auth_path(:provider => "openid", :openid_url => "http://localhost:1123/fred.bloggs", :origin => "/login?referer=%2Fhistory", :referer => "/history")
assert_response :redirect
follow_redirect!
assert_response :success
- assert_template "user/new"
+ assert_template "users/new"
assert_select "span.username", false
end
get "/login", :params => { :referer => "/history" }
assert_response :redirect
- assert_redirected_to "controller" => "user", "action" => "login", "cookie_test" => "true", "referer" => "/history"
+ assert_redirected_to "controller" => "users", "action" => "login", "cookie_test" => "true", "referer" => "/history"
follow_redirect!
assert_response :success
- assert_template "user/login"
+ assert_template "users/login"
get auth_path(:provider => "google", :origin => "/login?referer=%2Fhistory", :referer => "/history")
assert_response :redirect
assert_redirected_to auth_success_path(:provider => "google")
get "/login", :params => { :referer => "/history" }
assert_response :redirect
- assert_redirected_to "controller" => "user", "action" => "login", "cookie_test" => "true", "referer" => "/history"
+ assert_redirected_to "controller" => "users", "action" => "login", "cookie_test" => "true", "referer" => "/history"
follow_redirect!
assert_response :success
- assert_template "user/login"
+ assert_template "users/login"
get auth_path(:provider => "google", :origin => "/login?referer=%2Fhistory", :referer => "/history")
assert_response :redirect
assert_redirected_to auth_success_path(:provider => "google")
get "/login", :params => { :referer => "/history" }
assert_response :redirect
- assert_redirected_to "controller" => "user", "action" => "login", "cookie_test" => "true", "referer" => "/history"
+ assert_redirected_to "controller" => "users", "action" => "login", "cookie_test" => "true", "referer" => "/history"
follow_redirect!
assert_response :success
- assert_template "user/login"
+ assert_template "users/login"
get auth_path(:provider => "google", :origin => "/login?referer=%2Fhistory", :referer => "/history")
assert_response :redirect
assert_redirected_to auth_success_path(:provider => "google")
get "/login", :params => { :referer => "/history" }
assert_response :redirect
- assert_redirected_to "controller" => "user", "action" => "login", "cookie_test" => "true", "referer" => "/history"
+ assert_redirected_to "controller" => "users", "action" => "login", "cookie_test" => "true", "referer" => "/history"
follow_redirect!
assert_response :success
- assert_template "user/login"
+ assert_template "users/login"
get auth_path(:provider => "google", :origin => "/login?referer=%2Fhistory", :referer => "/history")
assert_response :redirect
assert_redirected_to auth_success_path(:provider => "google")
assert_response :redirect
follow_redirect!
assert_response :success
- assert_template "user/new"
+ assert_template "users/new"
assert_select "span.username", false
end
get "/login", :params => { :referer => "/history" }
assert_response :redirect
- assert_redirected_to "controller" => "user", "action" => "login", "cookie_test" => "true", "referer" => "/history"
+ assert_redirected_to "controller" => "users", "action" => "login", "cookie_test" => "true", "referer" => "/history"
follow_redirect!
assert_response :success
- assert_template "user/login"
+ assert_template "users/login"
get auth_path(:provider => "google", :origin => "/login?referer=%2Fhistory", :referer => "/history")
assert_response :redirect
assert_redirected_to auth_success_path(:provider => "google")
get "/login", :params => { :referer => "/history" }
assert_response :redirect
- assert_redirected_to "controller" => "user", "action" => "login", "cookie_test" => "true", "referer" => "/history"
+ assert_redirected_to "controller" => "users", "action" => "login", "cookie_test" => "true", "referer" => "/history"
follow_redirect!
assert_response :success
- assert_template "user/login"
+ assert_template "users/login"
get auth_path(:provider => "facebook", :origin => "/login?referer=%2Fhistory", :referer => "/history")
assert_response :redirect
assert_redirected_to auth_success_path(:provider => "facebook")
get "/login", :params => { :referer => "/history" }
assert_response :redirect
- assert_redirected_to "controller" => "user", "action" => "login", "cookie_test" => "true", "referer" => "/history"
+ assert_redirected_to "controller" => "users", "action" => "login", "cookie_test" => "true", "referer" => "/history"
follow_redirect!
assert_response :success
- assert_template "user/login"
+ assert_template "users/login"
get auth_path(:provider => "facebook", :origin => "/login?referer=%2Fhistory", :referer => "/history")
assert_response :redirect
assert_redirected_to auth_success_path(:provider => "facebook")
get "/login", :params => { :referer => "/history" }
assert_response :redirect
- assert_redirected_to "controller" => "user", "action" => "login", "cookie_test" => "true", "referer" => "/history"
+ assert_redirected_to "controller" => "users", "action" => "login", "cookie_test" => "true", "referer" => "/history"
follow_redirect!
assert_response :success
- assert_template "user/login"
+ assert_template "users/login"
get auth_path(:provider => "facebook", :origin => "/login?referer=%2Fhistory", :referer => "/history")
assert_response :redirect
assert_redirected_to auth_success_path(:provider => "facebook")
get "/login", :params => { :referer => "/history" }
assert_response :redirect
- assert_redirected_to "controller" => "user", "action" => "login", "cookie_test" => "true", "referer" => "/history"
+ assert_redirected_to "controller" => "users", "action" => "login", "cookie_test" => "true", "referer" => "/history"
follow_redirect!
assert_response :success
- assert_template "user/login"
+ assert_template "users/login"
get auth_path(:provider => "facebook", :origin => "/login?referer=%2Fhistory", :referer => "/history")
assert_response :redirect
assert_redirected_to auth_success_path(:provider => "facebook")
assert_response :redirect
follow_redirect!
assert_response :success
- assert_template "user/new"
+ assert_template "users/new"
assert_select "span.username", false
end
get "/login", :params => { :referer => "/history" }
assert_response :redirect
- assert_redirected_to "controller" => "user", "action" => "login", "cookie_test" => "true", "referer" => "/history"
+ assert_redirected_to "controller" => "users", "action" => "login", "cookie_test" => "true", "referer" => "/history"
follow_redirect!
assert_response :success
- assert_template "user/login"
+ assert_template "users/login"
get auth_path(:provider => "windowslive", :origin => "/login?referer=%2Fhistory", :referer => "/history")
assert_response :redirect
assert_redirected_to auth_success_path(:provider => "windowslive")
get "/login", :params => { :referer => "/history" }
assert_response :redirect
- assert_redirected_to "controller" => "user", "action" => "login", "cookie_test" => "true", "referer" => "/history"
+ assert_redirected_to "controller" => "users", "action" => "login", "cookie_test" => "true", "referer" => "/history"
follow_redirect!
assert_response :success
- assert_template "user/login"
+ assert_template "users/login"
get auth_path(:provider => "windowslive", :origin => "/login?referer=%2Fhistory", :referer => "/history")
assert_response :redirect
assert_redirected_to auth_success_path(:provider => "windowslive")
get "/login", :params => { :referer => "/history" }
assert_response :redirect
- assert_redirected_to "controller" => "user", "action" => "login", "cookie_test" => "true", "referer" => "/history"
+ assert_redirected_to "controller" => "users", "action" => "login", "cookie_test" => "true", "referer" => "/history"
follow_redirect!
assert_response :success
- assert_template "user/login"
+ assert_template "users/login"
get auth_path(:provider => "windowslive", :origin => "/login?referer=%2Fhistory", :referer => "/history")
assert_response :redirect
assert_redirected_to auth_success_path(:provider => "windowslive")
get "/login", :params => { :referer => "/history" }
assert_response :redirect
- assert_redirected_to "controller" => "user", "action" => "login", "cookie_test" => "true", "referer" => "/history"
+ assert_redirected_to "controller" => "users", "action" => "login", "cookie_test" => "true", "referer" => "/history"
follow_redirect!
assert_response :success
- assert_template "user/login"
+ assert_template "users/login"
get auth_path(:provider => "windowslive", :origin => "/login?referer=%2Fhistory", :referer => "/history")
assert_response :redirect
assert_redirected_to auth_success_path(:provider => "windowslive")
assert_response :redirect
follow_redirect!
assert_response :success
- assert_template "user/new"
+ assert_template "users/new"
assert_select "span.username", false
end
get "/login", :params => { :referer => "/history" }
assert_response :redirect
- assert_redirected_to "controller" => "user", "action" => "login", "cookie_test" => "true", "referer" => "/history"
+ assert_redirected_to "controller" => "users", "action" => "login", "cookie_test" => "true", "referer" => "/history"
follow_redirect!
assert_response :success
- assert_template "user/login"
+ assert_template "users/login"
get auth_path(:provider => "github", :origin => "/login?referer=%2Fhistory", :referer => "/history")
assert_response :redirect
assert_redirected_to auth_success_path(:provider => "github")
get "/login", :params => { :referer => "/history" }
assert_response :redirect
- assert_redirected_to "controller" => "user", "action" => "login", "cookie_test" => "true", "referer" => "/history"
+ assert_redirected_to "controller" => "users", "action" => "login", "cookie_test" => "true", "referer" => "/history"
follow_redirect!
assert_response :success
- assert_template "user/login"
+ assert_template "users/login"
get auth_path(:provider => "github", :origin => "/login?referer=%2Fhistory", :referer => "/history")
assert_response :redirect
assert_redirected_to auth_success_path(:provider => "github")
get "/login", :params => { :referer => "/history" }
assert_response :redirect
- assert_redirected_to "controller" => "user", "action" => "login", "cookie_test" => "true", "referer" => "/history"
+ assert_redirected_to "controller" => "users", "action" => "login", "cookie_test" => "true", "referer" => "/history"
follow_redirect!
assert_response :success
- assert_template "user/login"
+ assert_template "users/login"
get auth_path(:provider => "github", :origin => "/login?referer=%2Fhistory", :referer => "/history")
assert_response :redirect
assert_redirected_to auth_success_path(:provider => "github")
get "/login", :params => { :referer => "/history" }
assert_response :redirect
- assert_redirected_to "controller" => "user", "action" => "login", "cookie_test" => "true", "referer" => "/history"
+ assert_redirected_to "controller" => "users", "action" => "login", "cookie_test" => "true", "referer" => "/history"
follow_redirect!
assert_response :success
- assert_template "user/login"
+ assert_template "users/login"
get auth_path(:provider => "github", :origin => "/login?referer=%2Fhistory", :referer => "/history")
assert_response :redirect
assert_redirected_to auth_success_path(:provider => "github")
assert_response :redirect
follow_redirect!
assert_response :success
- assert_template "user/new"
+ assert_template "users/new"
assert_select "span.username", false
end
get "/login", :params => { :referer => "/history" }
assert_response :redirect
- assert_redirected_to "controller" => "user", "action" => "login", "cookie_test" => "true", "referer" => "/history"
+ assert_redirected_to "controller" => "users", "action" => "login", "cookie_test" => "true", "referer" => "/history"
follow_redirect!
assert_response :success
- assert_template "user/login"
+ assert_template "users/login"
get auth_path(:provider => "wikipedia", :origin => "/login?referer=%2Fhistory", :referer => "/history")
assert_response :redirect
assert_redirected_to auth_success_path(:provider => "wikipedia", :origin => "/login?referer=%2Fhistory", :referer => "/history")
get "/login", :params => { :referer => "/history" }
assert_response :redirect
- assert_redirected_to "controller" => "user", "action" => "login", "cookie_test" => "true", "referer" => "/history"
+ assert_redirected_to "controller" => "users", "action" => "login", "cookie_test" => "true", "referer" => "/history"
follow_redirect!
assert_response :success
- assert_template "user/login"
+ assert_template "users/login"
get auth_path(:provider => "wikipedia", :origin => "/login?referer=%2Fhistory", :referer => "/history")
assert_response :redirect
assert_redirected_to auth_success_path(:provider => "wikipedia", :origin => "/login?referer=%2Fhistory", :referer => "/history")
get "/login", :params => { :referer => "/history" }
assert_response :redirect
- assert_redirected_to "controller" => "user", "action" => "login", "cookie_test" => "true", "referer" => "/history"
+ assert_redirected_to "controller" => "users", "action" => "login", "cookie_test" => "true", "referer" => "/history"
follow_redirect!
assert_response :success
- assert_template "user/login"
+ assert_template "users/login"
get auth_path(:provider => "wikipedia", :origin => "/login?referer=%2Fhistory", :referer => "/history")
assert_response :redirect
assert_redirected_to auth_success_path(:provider => "wikipedia", :origin => "/login?referer=%2Fhistory", :referer => "/history")
get "/login", :params => { :referer => "/history" }
assert_response :redirect
- assert_redirected_to "controller" => "user", "action" => "login", "cookie_test" => "true", "referer" => "/history"
+ assert_redirected_to "controller" => "users", "action" => "login", "cookie_test" => "true", "referer" => "/history"
follow_redirect!
assert_response :success
- assert_template "user/login"
+ assert_template "users/login"
get auth_path(:provider => "wikipedia", :origin => "/login?referer=%2Fhistory", :referer => "/history")
assert_response :redirect
assert_redirected_to auth_success_path(:provider => "wikipedia", :origin => "/login?referer=%2Fhistory", :referer => "/history")
assert_response :redirect
follow_redirect!
assert_response :success
- assert_template "user/new"
+ assert_template "users/new"
assert_select "span.username", false
end
def try_password_login(username, password, remember_me = nil)
get "/login"
assert_response :redirect
- assert_redirected_to :controller => :user, :action => :login, :cookie_test => true
+ assert_redirected_to :controller => :users, :action => :login, :cookie_test => true
follow_redirect!
assert_response :success
assert_template "login"
def check_fail(action, user, role)
get "/login"
assert_response :redirect
- assert_redirected_to "controller" => "user", "action" => "login", "cookie_test" => "true"
+ assert_redirected_to "controller" => "users", "action" => "login", "cookie_test" => "true"
follow_redirect!
assert_response :success
post "/login", :params => { "username" => create(user).email, "password" => "test", :referer => "/" }
def check_success(action, user, role)
get "/login"
assert_response :redirect
- assert_redirected_to "controller" => "user", "action" => "login", "cookie_test" => "true"
+ assert_redirected_to "controller" => "users", "action" => "login", "cookie_test" => "true"
follow_redirect!
assert_response :success
post "/login", :params => { "username" => create(user).email, "password" => "test", :referer => "/" }
get "/login"
follow_redirect!
assert_response :success
- assert_template "user/login"
+ assert_template "users/login"
post "/login", :params => { :username => user.email, :password => "test", :referer => "/diary/new" }
assert_response :redirect
# but now we need to look at the terms
- assert_redirected_to :controller => :user, :action => :terms, :referer => "/diary/new"
+ assert_redirected_to :controller => :users, :action => :terms, :referer => "/diary/new"
follow_redirect!
assert_response :success
get "/login"
follow_redirect!
assert_response :success
- assert_template "user/login"
+ assert_template "users/login"
post "/login", :params => { :username => user.email, :password => "test", :referer => "/diary/new" }
assert_response :redirect
# but now we need to look at the terms
- assert_redirected_to :controller => :user, :action => :terms, :referer => "/diary/new"
+ assert_redirected_to :controller => :users, :action => :terms, :referer => "/diary/new"
# check that if we go somewhere else now, it redirects
# back to the terms page.
get "/traces/mine"
- assert_redirected_to :controller => :user, :action => :terms, :referer => "/traces/mine"
+ assert_redirected_to :controller => :users, :action => :terms, :referer => "/traces/mine"
get "/traces/mine", :params => { :referer => "/diary/new" }
- assert_redirected_to :controller => :user, :action => :terms, :referer => "/diary/new"
+ assert_redirected_to :controller => :users, :action => :terms, :referer => "/diary/new"
end
end
def test_view_issues_not_logged_in
visit issues_path
- assert page.has_content?(I18n.t("user.login.title"))
+ assert page.has_content?(I18n.t("users.login.title"))
end
def test_view_issues_normal_user
visit browse_note_path(note)
assert page.has_content?(note.comments.first.body)
- assert_not page.has_content?(I18n.t("user.show.report"))
+ assert_not page.has_content?(I18n.t("users.show.report"))
end
def test_can_report_user
sign_in_as(create(:user))
visit user_path(user)
- click_on I18n.t("user.show.report")
+ click_on I18n.t("users.show.report")
assert page.has_content? "Report"
assert page.has_content? I18n.t("reports.new.disclaimer.intro")
sign_in_as(create(:user))
visit user_path(user)
- click_on I18n.t("user.show.report")
+ click_on I18n.t("users.show.report")
assert page.has_content? "Report"
assert page.has_content? I18n.t("reports.new.disclaimer.intro")
visit user_path(user)
- click_on I18n.t("user.show.report")
+ click_on I18n.t("users.show.report")
assert page.has_content? "Report"
assert page.has_content? I18n.t("reports.new.disclaimer.intro")