mirror of
https://github.com/internetee/registry.git
synced 2025-05-17 01:47:18 +02:00
Allow changing auth info on contact update #2833
This commit is contained in:
parent
ba5d1b8e4d
commit
2598b4aa2f
5 changed files with 40 additions and 24 deletions
|
@ -244,9 +244,9 @@ class Contact < ActiveRecord::Base
|
|||
@generate_auth_info_disabled = true
|
||||
end
|
||||
|
||||
def auth_info=(pw)
|
||||
self[:auth_info] = pw if new_record?
|
||||
end
|
||||
# def auth_info=(pw)
|
||||
# self[:auth_info] = pw if new_record?
|
||||
# end
|
||||
|
||||
def code=(code)
|
||||
self[:code] = code if new_record? # cannot change code later
|
||||
|
|
|
@ -515,6 +515,22 @@ describe 'EPP Contact', epp: true do
|
|||
Setting.client_status_editing_enabled = true
|
||||
end
|
||||
|
||||
it 'should update auth info' do
|
||||
xml = @epp_xml.update({
|
||||
id: { value: 'FIRST0:SH8013' },
|
||||
chg: {
|
||||
authInfo: { pw: { value: 'newpassword' } }
|
||||
}
|
||||
})
|
||||
puts Nokogiri xml
|
||||
response = epp_plain_request(xml, :xml)
|
||||
response[:results][0][:msg].should == 'Command completed successfully'
|
||||
response[:results][0][:result_code].should == '1000'
|
||||
|
||||
contact = Contact.find_by(code: 'FIRST0:SH8013')
|
||||
contact.auth_info.should == 'newpassword'
|
||||
end
|
||||
|
||||
it 'should add value voice value' do
|
||||
xml = @epp_xml.update({
|
||||
id: { value: 'FIRST0:SH8013' },
|
||||
|
|
|
@ -321,10 +321,10 @@ describe Contact do
|
|||
end
|
||||
|
||||
it 'should generate a new password' do
|
||||
@contact = Fabricate.build(:contact, code: '123asd', auth_info: 'qwe321')
|
||||
@contact.auth_info.should == 'qwe321'
|
||||
@contact = Fabricate.build(:contact, code: '123asd', auth_info: nil)
|
||||
@contact.auth_info.should == nil
|
||||
@contact.save.should == true
|
||||
@contact.auth_info.should_not == 'qwe321'
|
||||
@contact.auth_info.should_not be_nil
|
||||
end
|
||||
|
||||
it 'should not allow same code' do
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue