-
-% Génère un nouveau captchat dans ?DOSSIER_CAPTCHA
-generation_captcha(_) ->
- {Mot_crypt, Nom_fichier} = captcha:create(5, ?DOSSIER_CAPTCHA),
- simple_xml_to_string(xml_reponse_generation_captcha(?DOSSIER_CAPTCHA_RELATIF "/" ++ Nom_fichier, Mot_crypt)).
-
-\r
-% Un nouvel utilisateur doit être créé.
-% Action est un xmlElement().
-nouveau_user_captcha(Action) ->
- simple_xml_to_string(\r
- case {xmerl_xpath:string("captchaCrypt", Action), xmerl_xpath:string("captchaInput", Action)} of\r
- {[#xmlElement{content = [#xmlText{value = C1}]}], [#xmlElement{content = [#xmlText{value = C2}]}]} ->\r
- C2_crypt = common:crypt(C2),\r
- if C1 =:= C2_crypt ->\r
- Cookie = generer_cookie(),\r
- User = euphorik_minichat:nouveau_user("Paul", Cookie),\r
- xml_reponse_login_ok(User);\r
- true ->
- xml_reponse_login_pas_ok("Captcha incorrect")\r
- end;
- _ ->
- xml_reponse_login_pas_ok("XML malformé")\r
- end
- ).
-