Exemplo n.º 1
0
 def POST(self, user_id):
     user_form = userForm(web.input())
     if user_form.valid:
         user = user_form.d
         if not user.is_active:
             auth.delete_session(user_id)
         auth.update_user(user_id, **user)
         applog.info(edit_user_text % user.title, "users", user_id)
         raise web.seeother("/a/users")
     else:
         raise web.seeother(web.ctx.env.get("HTTP_REFERER", "/a/users"))
Exemplo n.º 2
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"))
Exemplo n.º 3
0
 def GET(self, user_id, method):
     user = auth.get_user(user_id=user_id, is_deleted=True)
     if user.id != auth.get_user().id:
         auth.update_user(user.id, is_deleted=method == "delete")
         if method == "delete":
             flash.set(_(undo_user_text) %
                       link_to("users", user, "undelete"))
             applog.info(_(deleted_user_text) %
                         user.title, "users", user.id, "warn")
         else:
             flash.set(_(undelete_user_text))
             applog.info(undeleted_user_text %
                         user.title, "users", user.id, "warn")
         auth.delete_session(user.id)
     else:
         flash.set(_(cannot_delete_self_text), "error")
     raise web.seeother("/a/users")