예제 #1
0
파일: forms.py 프로젝트: Bytesu/WanMuJia
 def send_email(self):
     if (self.email_type == VENDOR_EMAIL_CONFIRM or self.email_type == USER_EMAIL_CONFIRM) \
             and not self.email_confirmed:
         token = md5_with_time_salt(self.role.data, self.id.data)
         redis_set(CONFIRM_EMAIL, token, {'role': self.role.data, 'id': self.id.data,
                                          'email': self.email.data, 'action': 'confirm'}, serialize=True)
         url = url_for('service.verify', token=token, _external=True)
         send_email(self.email.data, EMAIL_CONFIRM_SUBJECT, self.email_type, url=url)
예제 #2
0
 def send_email(self):
     if self.email_type == USER_RESET_PASSWORD:
         token = md5_with_time_salt(self.email.data)
         redis_set(CONFIRM_EMAIL,
                   token, {
                       'email': self.email.data,
                       'action': 'reset_password'
                   },
                   serialize=True)
         url = url_for('service.verify', token=token, _external=True)
         send_email(self.email.data,
                    EMAIL_CONFIRM_SUBJECT,
                    self.email_type,
                    url=url)
예제 #3
0
 def send_email(self):
     if (self.email_type == VENDOR_EMAIL_CONFIRM or self.email_type == USER_EMAIL_CONFIRM) \
             and not self.email_confirmed:
         token = md5_with_time_salt(self.role.data, self.id.data)
         redis_set(CONFIRM_EMAIL,
                   token, {
                       'role': self.role.data,
                       'id': self.id.data,
                       'email': self.email.data,
                       'action': 'confirm'
                   },
                   serialize=True)
         url = url_for('service.verify', token=token, _external=True)
         send_email(self.email.data,
                    EMAIL_CONFIRM_SUBJECT,
                    self.email_type,
                    url=url)
예제 #4
0
파일: forms.py 프로젝트: xeonpc/WanMuJia
 def update(self):
     if self.type == USER_USERNAME_SETTING:
         if self.username.data != current_user.username and current_user.username_revisable:
             current_user.username = self.username.data
             current_user.username_revisable = False
     elif self.type == USER_PASSWORD_SETTING:
         current_user.password = self.password.data
         db.session.commit()
         logout_user()
         identity_changed.send(current_app._get_current_object(), identity=AnonymousIdentity())
         return
     else:  # email
         current_user.email = self.email.data
         current_user.email_confirmed = False
         token = md5_with_time_salt(self.email.data)
         redis_set(CONFIRM_EMAIL, token,
                   {'email': self.email.data, 'role': 'user', 'action': 'confirm', 'id': current_user.id},
                   serialize=True)
         url = url_for('service.verify', token=token, _external=True)
         send_email(self.email.data, EMAIL_CONFIRM_SUBJECT, USER_EMAIL_CONFIRM, url=url)
     db.session.commit()
예제 #5
0
파일: forms.py 프로젝트: Bytesu/WanMuJia
 def send_email(self):
     if self.email_type == USER_RESET_PASSWORD:
         token = md5_with_time_salt(self.email.data)
         redis_set(CONFIRM_EMAIL, token, {'email': self.email.data, 'action': 'reset_password'}, serialize=True)
         url = url_for('service.verify', token=token, _external=True)
         send_email(self.email.data, EMAIL_CONFIRM_SUBJECT, self.email_type, url=url)
예제 #6
0
def invite_distributor():
    if request.method == 'POST':
        token = md5_with_time_salt(current_user.id)
        redis_set(DISTRIBUTOR_REGISTER, token, current_user.id)
        return url_for('distributor.verify', token=token, _external=True)
    return render_template('vendor/invitation.html', vendor=current_user)
예제 #7
0
파일: views.py 프로젝트: Bytesu/WanMuJia
def invite_distributor():
    if request.method == 'POST':
        token = md5_with_time_salt(current_user.id)
        redis_set(DISTRIBUTOR_REGISTER, token, current_user.id)
        return url_for('distributor.verify', token=token, _external=True)
    return render_template('vendor/invitation.html', vendor=current_user)