Allow creating contact with custom pw #2833

This commit is contained in:
Martin Lensment 2015-08-13 13:59:57 +03:00
parent 16acf33cd7
commit ba5d1b8e4d
2 changed files with 16 additions and 1 deletions

View file

@ -236,6 +236,7 @@ class Contact < ActiveRecord::Base
def generate_auth_info
return if @generate_auth_info_disabled
return if auth_info.present?
self.auth_info = SecureRandom.hex(11)
end

View file

@ -51,7 +51,8 @@ describe 'EPP Contact', epp: true do
},
voice: { value: '+372.1234567' },
fax: nil,
email: { value: 'test@example.example' }
email: { value: 'test@example.example' },
authInfo: nil
}
create_xml = @epp_xml.create(defaults.deep_merge(overwrites), extension)
epp_plain_request(create_xml, options)
@ -80,6 +81,7 @@ describe 'EPP Contact', epp: true do
@contact.ident.should == '37605030299'
@contact.street.should == '123 Example'
@contact.legal_documents.count.should == 1
@contact.auth_info.length.should > 0
log = ApiLog::EppLog.last
log.request_command.should == 'create'
@ -89,6 +91,18 @@ describe 'EPP Contact', epp: true do
log.api_user_registrar.should == 'registrar1'
end
it 'creates a contact with custom auth info' do
response = create_request({
authInfo: { pw: { value: 'custompw' } }
})
response[:msg].should == 'Command completed successfully'
response[:result_code].should == '1000'
@contact = Contact.last
@contact.auth_info.should == 'custompw'
end
it 'successfully saves ident type with legal document' do
extension = {
ident: {