Skip to content
Snippets Groups Projects
Unverified Commit 028376fe authored by azul's avatar azul
Browse files

fix: alternate email dialogue

fixes #8796

Cleaned up UserController#update earlier but missed that it was
used to change fallback email addresses. Now it is back. This
time including an integration test.
parent a20a1c16
No related branches found
No related tags found
1 merge request!53fix: alternate email dialogue
Pipeline #
......@@ -31,6 +31,12 @@ class UsersController < ApplicationController
def edit
end
def update
@user.update_attributes user_params
flash[:notice] = I18n.t(:changes_saved) if @user.valid?
respond_with @user, location: edit_user_path(@user)
end
def deactivate
@user.account.disable
flash[:notice] = I18n.t("actions.user_disabled_message", username: @user.username)
......@@ -62,7 +68,7 @@ class UsersController < ApplicationController
if admin?
params.require(:user).permit(:effective_service_level)
else
params.require(:user).permit(:password, :password_confirmation)
params.require(:user).permit(:contact_email)
end
end
......
......@@ -2,12 +2,13 @@
-# edit user form, used by both show and edit actions.
-#
-# We render a bunch of forms here. Which we use depends upon config settings
-# user_actions and admin_actions. They both include an array of actions
-# user_actions and admin_actions. They both include an array of actions
-# allowed to users and admins.
-# Possible forms are:
-# 'change_password'
-# 'change_pgp_key'
-# 'change_service_level'
-# 'contact_email'
-# 'destroy_account'
- actions = APP_CONFIG[admin? ? :admin_actions : :user_actions] || []
- actions.each do |action|
......
require 'test_helper'
class AlternateEmailTest < BrowserIntegrationTest
test "change alternate email" do
username, password = submit_signup
click_on 'Account Settings'
within(".edit_user") do
fill_in 'user_contact_email', with: 'test@leap.se'
click_on 'Save'
end
assert page.has_content?('Changes saved successfully')
assert_equal 'test@leap.se',
page.find('#user_contact_email').value
end
test "change alternate email to invalid" do
username, password = submit_signup
click_on 'Account Settings'
within(".edit_user") do
fill_in 'user_contact_email', with: 'test@invalid'
click_on 'Save'
assert page.has_content?('is invalid')
end
end
end
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment