class ChangePassForm(wtforms.Form):
password = wtforms.PasswordField(
- 'Password')
+ 'Password',
+ [wtforms.validators.Required(),
+ wtforms.validators.Length(min=5, max=1024)])
token = wtforms.HiddenField(
'',
[wtforms.validators.Required()])
EMAIL_FP_VERIFICATION_TEMPLATE = (
- u"http://{host}{uri}?"
- u"userid={userid}&token={fp_verification_key}")
+ u"{uri}?"
+ u"token={fp_verification_key}")
def send_fp_verification_email(user, request):
- user: a user object
- request: the request
"""
+ fp_verification_key = get_timed_signer_url('mail_verification_token') \
+ .dumps(user.id)
rendered_email = render_template(
request, 'mediagoblin/auth/fp_verification_email.txt',
{'username': user.username,
'verification_url': EMAIL_FP_VERIFICATION_TEMPLATE.format(
- host=request.host,
- uri=request.urlgen('mediagoblin.auth.verify_forgot_password'),
- userid=unicode(user.id),
- fp_verification_key=user.fp_verification_key)})
+ uri=request.urlgen('mediagoblin.auth.verify_forgot_password',
+ qualified=True),
+ fp_verification_key=fp_verification_key)})
# TODO: There is no error handling in place
send_email(
from mediagoblin import mg_globals
from mediagoblin import auth
+from mediagoblin.auth import tools as auth_tools
from mediagoblin.edit import forms
from mediagoblin.edit.lib import may_edit_media
from mediagoblin.decorators import (require_active_login, active_user_from_url,