예제 #1
0
 def post(self):
     action = self.request.get("action")
     if action == "reset":
         self.account.set_hash_and_key()
     elif action == "addemail":
         email = self.request.get("email")
         if not Email.find_existing(email):
             e = Email(email=self.request.get("email"), account=self.account)
             e.send_activation_email()
             e.put()
     elif action == "removeemail":
         e = Email.get_by_id(int(self.request.get("email-id")))
         if e.account.key() == self.account.key():
             if e.hash() in self.account.hashes:
                 self.account.hashes.remove(e.hash())
                 self.account.put()
             e.delete()
     else:
         if self.request.get("source_enabled", None):
             self.account.source_enabled = True
             self.account.source_name = self.request.get("source_name", None)
             self.account.source_url = self.request.get("source_url", None)
             self.account.source_icon = self.request.get("source_icon", None)
         else:
             self.account.source_enabled = False
     self.account.put()
     self.redirect("/settings")
예제 #2
0
파일: main.py 프로젝트: Feanorka/notify-io
 def post(self):
     action = self.request.get('action')
     if action == 'reset':
         self.account.set_hash_and_key()
     elif action == 'addemail':
         email = self.request.get('email')
         if not Email.find_existing(email):
             e = Email(email=self.request.get('email'), account=self.account)
             e.send_activation_email()
             e.put()
     elif action == 'removeemail':
         e = Email.get_by_id(int(self.request.get('email-id')))
         if e.account.key() == self.account.key():
             if e.hash() in self.account.hashes:
                 self.account.hashes.remove(e.hash())
                 self.account.put()
             e.delete()
     else:
         if self.request.get('source_enabled', None):
             self.account.source_enabled = True
             self.account.source_name = self.request.get('source_name', None)
             self.account.source_url = self.request.get('source_url', None)
             self.account.source_icon = self.request.get('source_icon', None)
         else:
             self.account.source_enabled = False
     self.account.put()
     self.redirect('/settings')
예제 #3
0
 def post(self):
     action = self.request.get('action')
     if action == 'reset':
         self.account.set_hash_and_key()
     elif action == 'addemail':
         email = self.request.get('email')
         if not Email.find_existing(email):
             e = Email(email=self.request.get('email'),
                       account=self.account)
             e.send_activation_email()
             e.put()
     elif action == 'removeemail':
         e = Email.get_by_id(int(self.request.get('email-id')))
         if e.account.key() == self.account.key():
             if e.hash() in self.account.hashes:
                 self.account.hashes.remove(e.hash())
                 self.account.put()
             e.delete()
     else:
         if self.request.get('source_enabled', None):
             self.account.source_enabled = True
             self.account.source_name = self.request.get(
                 'source_name', None)
             self.account.source_url = self.request.get('source_url', None)
             self.account.source_icon = self.request.get(
                 'source_icon', None)
         else:
             self.account.source_enabled = False
     self.account.put()
     self.redirect('/settings')
예제 #4
0
    def get(self, email_id):
        user = users.get_current_user()
        title = "Email details"
        email = Email.get_by_id(int(email_id))

        params = {"email": email, "user": user, "title": title}
        self.render_template("email_details.html", params=params)
예제 #5
0
    def post(self, email_id):
        title = "Delete email"
        email = Email.get_by_id(int(email_id))
        user = users.get_current_user()

        if user.email() == email.sender and user.email() == email.recipient:
            email.key.delete()
        elif user.email() == email.sender:
            email.deletedBySender = True
            email.put()
        else:
            email.deletedByRecipient = True
            email.put()

        if email.deletedBySender == True and email.deletedByRecipient == True:
            email.key.delete()

        self.render_template("message_deleted.html")
예제 #6
0
파일: main.py 프로젝트: luckie86/Bmail
 def get(self, email_id):
     email = Email.get_by_id(int(email_id))
     params = {"email": email}
     return self.render_template("sent-details.html", params)
예제 #7
0
파일: main.py 프로젝트: luckie86/Bmail
 def post(self, email_id):
     email = Email.get_by_id(int(email_id))
     email.deleted = True
     email.put()
     return self.redirect("/received")
예제 #8
0
    def get(self, email_id):
        title = "Delete email"
        email = Email.get_by_id(int(email_id))

        params = {"email": email, "title": title}
        self.render_template("delete_email.html", params=params)