Exemple #1
0
 def get_form(self):
     from forms import CreateArticle
     self.session = get_session(self.request)
     self.session['csrf'] = get_csrf_token(self.session)
     schema = CreateArticle().bind(request=self.request)
     submit = deform.Button(name='submit', css_class='blog-form__button')
     self.form = deform.Form(schema, buttons=(submit, ))
     return self.form
Exemple #2
0
 def get_form(self):
     from forms import CreateArticle
     self.session = get_session(self.request)
     self.session['csrf'] = get_csrf_token(self.session)
     schema = CreateArticle().bind(request=self.request)
     submit = deform.Button(name='submit',
                            css_class='blog-form__button')
     self.form = deform.Form(schema, buttons=(submit,))
     return self.form
Exemple #3
0
def deferred_csrf_default(node, kw):
    request = kw.get('request')
    session = get_session(request)
    csrf_token = get_csrf_token(session)
    return csrf_token
Exemple #4
0
 def validate_csrf_token(node, value):
     request = kw.get('request')
     session = get_session(request)
     csrf_token = get_csrf_token(session)
     if value != csrf_token:
         raise colander.Invalid(node, 'Bad CSRF token')
Exemple #5
0
def deferred_csrf_default(node, kw):
    request = kw.get('request')
    session = get_session(request)
    csrf_token = get_csrf_token(session)
    return csrf_token
Exemple #6
0
 def validate_csrf_token(node, value):
     request = kw.get('request')
     session = get_session(request)
     csrf_token = get_csrf_token(session)
     if value != csrf_token:
         raise colander.Invalid(node, 'Bad CSRF token')