Exemplo n.º 1
0
 def get(self, **kwargs):
     kwargs['user'] = User.get(kwargs['userid'])
     history = JobHistoryModel.all()
     history.filter("CreatedBy =", User.get(kwargs['userid']))
     history.order("-Created").fetch(20);
     kwargs['history'] = history
     return self.render_response('adminuser.html', **kwargs)
Exemplo n.º 2
0
    def get(self, user_key=None):
        '''
        Send e-mail to user ordered a delivery and the admin
        '''
        user = User.get(user_key)
        profile = Profile.all().filter('user ='******'already verified')
        
        context = {
            'user': user,
            'profile': profile,
        }
        
        body = render_template('mail/verify.html', **context)
        message = mail.EmailMessage()

        message.to = user.email
        message.body = body
        message.subject = SUBJECT_REGISTRATION
        message.sender = SENDER
        message.reply_to = REPLY_TO
        message.send()
        return Response(body)
Exemplo n.º 3
0
 def post(self, **kwargs):
     userid = self.request.form.get('userid')
     user = User.get(userid)
     user.disabled = not user.disabled
     user.put()
     self.set_message('success', 'The users account was successfully changed. ', flash=True, life=5)
     return redirect_to('home')
Exemplo n.º 4
0
    def get(self, user_key=None):
        '''
        Send e-mail to user ordered a delivery and the admin
        '''
        user = User.get(user_key)
        profile = Profile.all().filter('user ='******'already verified')

        context = {
            'user': user,
            'profile': profile,
        }

        body = render_template('mail/verify.html', **context)
        message = mail.EmailMessage()

        message.to = user.email
        message.body = body
        message.subject = SUBJECT_REGISTRATION
        message.sender = SENDER
        message.reply_to = REPLY_TO
        message.send()
        return Response(body)
Exemplo n.º 5
0
def add_history(description, user, jobid=None, clientid=None, userid=None):
    jhm = JobHistoryModel()
    jhm.Description = description
    jhm.CreatedBy = user
    if jobid:
        jhm.Job = JobModel.get(jobid)
    if clientid: 
        jhm.Client = ClientModel.get(clientid)
    if userid:
        jhm.User = User.get(userid)
    jhm.put()
Exemplo n.º 6
0
 def get(self,  **kwargs):
     if str(self.auth_current_user.key()) == kwargs['userid'] or self.auth_current_user.is_admin or self.auth_current_user.is_staff:
         form = self.form
         user = User.get(kwargs['userid'])
         kwargs['user'] = user
         history = JobHistoryModel.all()
         history.filter("CreatedBy =", User.get(kwargs['userid']))
         history.order("-Created").fetch(20);
         kwargs['history'] = history
         if user.assigned_to:
             kwargs['client'] = ClientModel.get(user.assigned_to) 
         if user: 
             obj = { 'username' : user.username, 'key' : str(user.key()), 'email' : user.email }
             logging.log(logging.INFO, 'editing user: '******'form'] = form
             
         return self.render_response('edituser.html', **kwargs)
     else:
         return self.redirect_to(url_for('account/login'))
Exemplo n.º 7
0
 def post(self, **kwargs):
     if str(self.auth_current_user.key()) == kwargs['userid'] or self.auth_current_user.is_admin or self.auth_current_user.is_staff:
         username = self.form.username.data
         email = self.form.email.data
         password = self.form.password.data
         password_confirm = self.form.password_confirm.data
         if password != password_confirm:
             self.set_message('error', "Password confirmation didn't match.", life = None)
             return self.get(**kwargs)
         olduser = User.get(kwargs['userid'])
         olduser.email = email
         if password is not None and len(password) > 0:
             olduser.set_password(password)
             self.set_message('success', 'The users password was changed. ', flash=True, life=5)
             add_history("user password was changed", self.auth_current_user, None, olduser.assigned_to, olduser.key())
         olduser.put()
         add_history("user was modified", self.auth_current_user, None, olduser.assigned_to, olduser.key())
         self.set_message('success', 'The user was successfully updated. ', flash=True, life=5)
         return self.get(**kwargs)
     else:
         return self.redirect_to(url_for('auth/login'))
Exemplo n.º 8
0
Arquivo: models.py Projeto: ac001/moe
 def editor(self):
     if self.editor_key:
         return User.get(db.Key(self.editor_key))
Exemplo n.º 9
0
Arquivo: models.py Projeto: ac001/moe
 def author(self):
     if self.author_key:
         return User.get(db.Key(self.author_key))