def get(self): if self.request.get("token"): r = PasswordResetToken.get_by_id(self.request.get("token")) if r: user = User.get_by_id(r.email) self.tv["current_user"] = user.to_object() self.tv["token"] = self.request.get("token") self.render("frontend/reset-password.html") else: self.redirect('/password/reset?error='+ urllib.quote('Invalid Token.')) else: self.render("frontend/reset-password.html")
def post(self): if self.request.get("password_original") == self.request.get("password_retype"): if self.request.get("email"): user = User.get_by_id(self.request.get("email")) user.password = hash_password(self.request.get("email"), self.request.get("password_original")) user.put() self.login(user) r = PasswordResetToken.get_by_id(self.request.get("token")) r.key.delete() self.redirect(self.uri_for('www-dashboard')) else: self.redirect('/password/reset?error='+ urllib.quote('Password does not match!.')) return