1 class AccountsController < ApplicationController
7 before_action :authorize_web
8 before_action :set_locale
10 authorize_resource :class => false
12 before_action :check_database_readable
13 before_action :check_database_writable, :only => [:update]
14 before_action :allow_thirdparty_images, :only => [:edit, :update]
17 @tokens = current_user.oauth_tokens.authorized
19 append_content_security_policy_directives(
20 :form_action => %w[accounts.google.com *.facebook.com login.live.com github.com meta.wikimedia.org]
23 if errors = session.delete(:user_errors)
24 errors.each do |attribute, error|
25 current_user.errors.add(attribute, error)
32 @tokens = current_user.oauth_tokens.authorized
34 append_content_security_policy_directives(
35 :form_action => %w[accounts.google.com *.facebook.com login.live.com github.com meta.wikimedia.org]
38 if params[:user][:auth_provider].blank? ||
39 (params[:user][:auth_provider] == current_user.auth_provider &&
40 params[:user][:auth_uid] == current_user.auth_uid)
41 update_user(current_user, params)
42 if current_user.errors.count.zero?
43 redirect_to edit_account_path
48 session[:new_user_settings] = params
49 redirect_to auth_url(params[:user][:auth_provider], params[:user][:auth_uid]), :status => :temporary_redirect