@@ -189,19 +189,21 @@ adhoc_command_create_account(Config) ->
189189 re :run (xdata_field (<<" uri" >>, ResultXDataFields2 ),
190190 <<" xmpp:foobar@" , Server /binary , " \\ ?register;preauth=(.+)" >>)),
191191 ResultXDataFields3 = test_create_account (Config , <<>>, <<" 1" >>),
192- Inviter = ? config (user , Config ),
193- ? match ({match , [Inviter , _ ]},
192+ ? match ({match , _ },
194193 re :run (xdata_field (<<" uri" >>, ResultXDataFields3 ),
195- <<" xmpp:(.+) " , " @ " , Server /binary , " \\ ?roster ;preauth=([a-zA-Z0-9]+);ibr=y " >>,
194+ <<" xmpp:" , Server /binary , " \\ ?register ;preauth=([a-zA-Z0-9]+)" >>,
196195 [{capture , all_but_first , binary }])),
197- Token = token_from_uri (xdata_field (<<" uri" >>, ResultXDataFields3 , <<>>)),
196+ Token3 = token_from_uri (xdata_field (<<" uri" >>, ResultXDataFields3 , <<>>)),
198197 # invite_token {account_name = <<>>, type = account_subscription } =
199- mod_invites :get_invite (Server , Token ),
198+ mod_invites :get_invite (Server , Token3 ),
200199 ResultXDataFields4 = test_create_account (Config , <<" foobar" >>, <<" 1" >>),
201- ? match ({match , [ Inviter , _ ] },
200+ ? match ({match , _ },
202201 re :run (xdata_field (<<" uri" >>, ResultXDataFields4 ),
203- <<" xmpp:(.+) " , " @" , Server /binary , " \\ ?roster ;preauth=([a-zA-Z0-9]+);ibr=y " >>,
202+ <<" xmpp:foobar @" , Server /binary , " \\ ?register ;preauth=([a-zA-Z0-9]+)" >>,
204203 [{capture , all_but_first , binary }])),
204+ Token4 = token_from_uri (xdata_field (<<" uri" >>, ResultXDataFields4 , <<>>)),
205+ # invite_token {account_name = <<" foobar" >>, type = account_subscription } =
206+ mod_invites :get_invite (Server , Token4 ),
205207 update_module_opts (Server , mod_invites , OldOpts ),
206208 User = jid :nodeprep (? config (user , Config )),
207209 mod_invites :remove_user (User , Server ),
@@ -217,7 +219,12 @@ token_valid(Config) ->
217219 # invite_token {token = AccountToken } =
218220 create_account_invite (Server , Inviter ),
219221 ? match (true , mod_invites :is_token_valid (Server , AccountToken , Inviter )),
220- ? match (false , mod_invites :is_token_valid (Server , <<" madeUptoken" >>)),
222+ try mod_invites :is_token_valid (Server , <<" madeUptoken" >>) of
223+ break -> broken
224+ catch
225+ _ :E ->
226+ ? match (not_found , E )
227+ end ,
221228 ? match (false ,
222229 mod_invites :is_token_valid (Server , AccountToken , {<<" someoneElse" >>, Server })),
223230 mod_invites :expire_tokens (<<" foo" >>, Server ),
@@ -386,15 +393,19 @@ ibr_subscription(Config0) ->
386393 NewAccount = <<" new_friend" >>,
387394 NewAccountJID = jid :make (NewAccount , Server ),
388395 gen_mod :stop_module_keep_config (Server , mod_vcard_xupdate ),
396+ OldOpts = gen_mod :get_module_opts (Server , mod_invites ),
397+ NewOpts = gen_mod :set_opt (access_create_account , account_invite , OldOpts ),
398+ update_module_opts (Server , mod_invites , NewOpts ),
399+
389400 self_presence (Config0 , available ),
390401
391402 # invite_token {token = Token } =
392403 mod_invites :create_account_invite (Server , {User , Server }, NewAccount , true ),
393404
394405 Config1 = set_opts ([{user , NewAccount },
395- {password , <<" mySecret" >>},
396- {resource , <<" invite_tests" >>},
397- {receiver , undefined }], Config0 ),
406+ {password , <<" mySecret" >>},
407+ {resource , <<" invite_tests" >>},
408+ {receiver , undefined }], Config0 ),
398409 Config = connect (Config1 ),
399410
400411 ? match (# iq {type = result }, send_pars (Config , Token )),
@@ -429,6 +440,7 @@ ibr_subscription(Config0) ->
429440 mod_roster :del_roster (User , Server , jid :tolower (NewAccountJID )),
430441 mod_roster :del_roster (NewAccount , Server , jid :tolower (UserJID )),
431442
443+ update_module_opts (Server , mod_invites , OldOpts ),
432444 disconnect (Config0 ),
433445 disconnect (Config ).
434446
0 commit comments