def reset_password(self): p = Password_Generator() passwd = p.gen() # check email email = self.signup_email if self.profile.email in ['', None]: email = self.profile.email # mailout passwort reset_msg = Message("Hello", sender="*****@*****.**", recipients=[email]) reset_msg.body = """Your new Passwort is: %s""" % (passwd) mail.send(reset_msg) self.password = passwd return passwd
def request_user_account(username, password, email, send_activation_code=True): user = create_user(username, password, email) # send activation email if send_activation_code: # email activation link # TODO: send this with some message_queue to avoid hanging app activation_msg = Message("Hello", sender="*****@*****.**", recipients=[user.signup_email]) activation_msg.body = """Click this link: http://localhost:5000/users/%s/activation/%s """ % (user.username, user.activation_key) mail.send(activation_msg) # signal Admin (dashboard the new user added) user_requested.send(app._get_current_object(), user=user)