Esempio n. 1
0
 def POST(self):
     user_form = userForm(web.input())
     if user_form.valid:
         user = user_form.d
         email = user.pop("email")
         password = temp_password()
         user.update(password=password)
         user = auth.create_user(email, **user)
         mailer.send(
             user.email,
             render_email.register(user, password),
             send_now=True,
             is_secure=True,
         )
         applog.info(new_user_text % user.title, "users", user.id)
     raise web.seeother(web.ctx.env.get("HTTP_REFERER", "/a/users"))
Esempio n. 2
0
 def POST(self):
     form = passwordResetForm()
     if form.validates():
         try:
             user = auth.get_user(email=form.d.email, with_password=True)
             token_url = "%s%s/%s$%s" % (web.ctx.home, "/password_reset",
                                         user.id, make_token(user))
             mailer.send(
                 user.email,
                 render_email.password_reset(user, token_url),
                 send_now=True,
                 is_secure=True,
             )
             flash.set(_(sent_text))
             raise web.seeother("/")
         except IndexError:
             form.note = _(email_doesnt_exist_text)
     return render.auth.reset_token(form)