예제 #1
0
 def confirm_email(self):
     if current_user.is_confirmed:
         return jsonify(
             judge=False,
             error=_('Your account has been confirmed,don\'t need again'))
     else:
         self.register_email(current_user.email)
         set_email_send(current_user.id)
         return jsonify(
             judge=True,
             error=_('An email has been sent to your.Please receive'))
예제 #2
0
 def wrapper(*args, **kw):
     time = redis_data.hget('user:%s' % str(current_user.id),
                            'send_email_time')
     print(time)
     try:
         time = time.split('.')[0]
         time = datetime.strptime(time, '%Y-%m-%d %H:%M:%S')
         print(time)
         if datetime.now() < time + timedelta(seconds=360):
             return jsonify(judge=False, error="你获取的验证链接还未过期,请尽快验证")
     except TypeError:
         set_email_send(current_user.id)
     except ValueError:
         set_email_send(current_user.id)
     return func(*args, **kw)
예제 #3
0
 def wrapper(*args, **kw):
     time = redis_data.hget('user:%s' % str(current_user.id),
                            'send_email_time')
     if time:
         try:
             time = datetime.strptime(time, '%Y-%m-%d %H:%M:%S')
             if datetime.utcnow() < time + timedelta(seconds=360):
                 return HTTPResponse(
                     HTTPResponse.USER_EMAIL_WAIT).to_response()
         except TypeError:
             set_email_send(current_user.id)
         except ValueError:
             set_email_send(current_user.id)
     else:
         set_email_send(current_user.id)
     return func(*args, **kw)
예제 #4
0
 def email_models(self):
     set_email_send(current_user.id)