Hey,

Here's my example app:

https://github.com/ngaranko/r2d2

This app makes use of my boss_form package, which is very alpha and not 
developed that much.
But should help understanding on how to use csrf_tokens.

As for your initial issue:
 you're not passing context in `hello` function, it should be something 
like:

```
 hello('GET', [], Context) ->
    {ok, [{world} | Context]}.
```

-Nick

On Thursday, 11 December 2014 11:11:21 UTC+1, İbrahim Yılmaz wrote:
>
> Hi guys!
>
> Mystery solved. 
>
> I've copied an old project directory and renamed it that causes the 
> problem.
>
> I've create a new project via "make" file then problem solved. :)
>
> BTW I'm still looking for an example to use CSRF validation in form posts.
>
> Cheers!
>
> On Wednesday, December 10, 2014 5:57:11 PM UTC+2, İbrahim Yılmaz wrote:
>>
>> Hi guys!
>>
>> I've two problems with my simple application.
>>
>> I've read the documents twice, but had no luck to using boss_csrf_filter 
>> and passing variables to templates.
>>
>> First I've done the configuration for using CSRF filter in *boss.config* 
>> file as the following :
>>
>> {controller_filter_config, [boss_csrf_filter]},  
>>
>>     {session_adapter, mock},
>>     {session_key, "_myapp_session"},
>>     {session_exp_time, 525600},
>>     {session_cookie_http_only, false},
>>     {session_cookie_secure, false},
>>     {session_domain, ".myappdomain.com"},
>>
>>
>> Then, I've add to variable in template (which is under 
>> *src/view/world/hello.html*)
>>
>> <div class="row">
>> <div class="12u">
>> <textarea name="message" id="message" placeholder="placeholder" 
>> required></textarea>
>>  *{{ csrf_token }}*
>>  </div>
>>  </div>
>>
>>
>> Everthing seems fine, but no any hidden input element appearing. Should I 
>> check/configure anything else?
>>
>> The second problem is with my app is passing variables to templates. My 
>> is controller something like the following code :
>>
>> -module(myapp_world_controller, [Req]).
>> -compile(export_all).
>>
>> hello('GET', []) ->
>>     {ok, [{world}]}.
>>
>> postcontact('POST', []) ->
>>
>> *                                   {redirect, "/",[{contactformsend, 
>> "ok"}]}.*
>>
>> The code is redirecting without any value. So, the following code is not 
>> working (the same template file with I've mentioned above) :
>>
>> {% if contactformsend %}
>>
>> <script>
>>
>>     alert("Hi there is!");
>>
>> </script>
>>
>> {% endif %}
>>
>> What I am doing wrong? How can I fix the problems?
>>
>> Cheers,
>>
>> Ibrahim.
>>
>

-- 
You received this message because you are subscribed to the Google Groups 
"ChicagoBoss" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
Visit this group at http://groups.google.com/group/chicagoboss.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/chicagoboss/9e5bb5d7-c7a7-4547-8c26-a8d2b43553a8%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to