pytwask.auth package

Submodules

pytwask.auth.forms module

This module defines all the authentication-related forms.

Courtesy of http://flask.pocoo.org/snippets/64/

class pytwask.auth.forms.ChangePasswordForm(formdata=<object object>, **kwargs)

Bases: flask_wtf.form.FlaskForm

The form for changing the user password.

new_password = <UnboundField(PasswordField, ('New password',), {'validators': [<wtforms.validators.DataRequired object>, <wtforms.validators.EqualTo object>]})>
new_password2 = <UnboundField(PasswordField, ('Confirm new password',), {'validators': [<wtforms.validators.DataRequired object>]})>
old_password = <UnboundField(PasswordField, ('Old password',), {'validators': [<wtforms.validators.DataRequired object>]})>
submit = <UnboundField(SubmitField, ('Submit',), {})>
class pytwask.auth.forms.SignInForm(formdata=<object object>, **kwargs)

Bases: flask_wtf.form.FlaskForm

The form for signing into an existing user.

password = <UnboundField(PasswordField, ('Password',), {'validators': [<wtforms.validators.DataRequired object>]})>
remember_me = <UnboundField(BooleanField, ('Keep me logged in',), {})>
submit = <UnboundField(SubmitField, ('Sign in',), {})>
username = <UnboundField(StringField, ('Username',), {'validators': [<wtforms.validators.DataRequired object>]})>
class pytwask.auth.forms.SignUpForm(formdata=<object object>, **kwargs)

Bases: flask_wtf.form.FlaskForm

The form for signing up a new user.

password = <UnboundField(PasswordField, ('Password',), {'validators': [<wtforms.validators.DataRequired object>, <wtforms.validators.EqualTo object>]})>
password2 = <UnboundField(PasswordField, ('Confirm password',), {'validators': [<wtforms.validators.DataRequired object>]})>
submit = <UnboundField(SubmitField, ('Sign up',), {})>
username = <UnboundField(StringField, ('Username',), {'validators': [<wtforms.validators.DataRequired object>]})>

pytwask.auth.views module

This module defines all the authentication-related views.

pytwask.auth.views.index()

This view renders the main index page. It also handles sign-ins.

pytwask.auth.views.is_safe_url(target)

Check the target URL will lead to the same host server.

Parameters:target (str) – The target redirect URL.
Returns:True if the target URL is safe; False otherwise.
Return type:bool
pytwask.auth.views.signout()

This view handles signouts.

pytwask.auth.views.signup()

This view renders the sign-up page.

pytwask.auth.views.user_settings()

This view renders the user settings page. It allows the user to

  • change password;
  • view his/her followers;
  • view his/her followings.

Module contents

The blueprint which contains all the views related to authentication.