def ResetPassword(request, username): if request.method == 'GET': user = User.objects.get(username=username) reset_password = User.objects.make_random_password( length=10, allowed_chars= 'abcdefghjkmnpqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ23456789') #remeber to send the password to the phone no. of the user. Once the email is set, the user can make choices. data = { 'subject': 'Password Reset', 'message': 'Dear customer, your new password is:' + reset_password + '. Have the best re-charging experience ever! ', 'recipient': request.user.email, 'phone': request.user.username } if request.user.email is not None or request.user.email is not ' ': user.set_password(reset_password) user.save() message_as_email(data) else: message_as_sms(data) return Response({'success': True})
def glue_to(self, user=None, create=False): if user is None: self._obj.hierarchy = 'master' reset_password = User.objects.make_random_password(length=10, allowed_chars='abcdefghjkmnpqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ23456789') print reset_password #send to the user data = { 'subject': 'Password Reset', 'message': 'Dear customer, your new password is:' + reset_password + '. Have the best re-charging experience ever! ', 'phone': self._obj.username } if self._obj.email is not None or self._obj.email is not ' ': self._obj.set_password(reset_password) message_as_email(data) else: message_as_sms(data) else: self._obj.hierarchy = 'slave' self._obj.set_unusable_password() #send notification that the user can only log in with the master self._obj.glue = user self._obj.ack = False if create: self._obj.save()
def glue_to(self, user=None, create=False): if user is None: self._obj.hierarchy = 'master' reset_password = User.objects.make_random_password( length=10, allowed_chars= 'abcdefghjkmnpqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ23456789') print reset_password #send to the user data = { 'subject': 'Password Reset', 'message': 'Dear customer, your new password is:' + reset_password + '. Have the best re-charging experience ever! ', 'phone': self._obj.username } if self._obj.email is not None or self._obj.email is not ' ': self._obj.set_password(reset_password) message_as_email(data) else: message_as_sms(data) else: self._obj.hierarchy = 'slave' self._obj.set_unusable_password() #send notification that the user can only log in with the master self._obj.glue = user self._obj.ack = False if create: self._obj.save()
def task_request(obj, domain, method): if method == 'register': try: gw = RemotingService(domain+'sync/', amf_version=AMF3) service = gw.getService('SyncService') http_data = service.register(obj) return http_data except Exception, e: # set the admin phone nos as global variable in the settings and make message_as_sms() loop over the nos. data = {'subject': 'Offline Registration Error', 'message': e, 'phone': '08137474080'} message_as_email(data) return
def pre_save(self, obj): new_password = self.request.DATA.get('new_password') old_password = self.request.DATA.get('old_password') print obj.password if check_password(old_password, obj.password): obj.set_password(new_password) #send to user data = { 'subject': 'Password Change', 'message': 'Dear customer, your new password is:' + new_password + '. Have the best re-charging experience ever! ', 'phone': obj.username } # make sure the email of the user is already set message_as_email(data)
def task_request(obj, domain, method): if method == 'register': try: gw = RemotingService(domain + 'sync/', amf_version=AMF3) service = gw.getService('SyncService') http_data = service.register(obj) return http_data except Exception, e: # set the admin phone nos as global variable in the settings and make message_as_sms() loop over the nos. data = { 'subject': 'Offline Registration Error', 'message': e, 'phone': '08137474080' } message_as_email(data) return
def ResetPassword(request, username): if request.method == 'GET': user = User.objects.get(username=username) reset_password = User.objects.make_random_password(length=10, allowed_chars='abcdefghjkmnpqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ23456789') #remeber to send the password to the phone no. of the user. Once the email is set, the user can make choices. data = { 'subject': 'Password Reset', 'message': 'Dear customer, your new password is:' + reset_password + '. Have the best re-charging experience ever! ', 'recipient': request.user.email, 'phone': request.user.username } if request.user.email is not None or request.user.email is not ' ': user.set_password(reset_password) user.save() message_as_email(data) else: message_as_sms(data) return Response({'success': True})
# set the admin phone nos as global variable in the settings and make message_as_sms() loop over the nos. data = {'subject': 'Offline Registration Error', 'message': e, 'phone': '08137474080'} message_as_email(data) return elif method == 'update_user': try: gw = RemotingService(domain+'sync/', amf_version=AMF3) service = gw.getService('SyncService') http_data = service.update_user(obj) return http_data except Exception, e: # set the admin phone nos as global variable in the settings and make message_as_sms() loop over the nos. data = {'subject': 'Offline Registration Error', 'message': e, 'phone': '08137474080'} message_as_email(data) return elif method == 'update_wallet': try: gw = RemotingService(domain+'sync/', amf_version=AMF3) service = gw.getService('SyncService') http_data = service.update_wallet(obj) return http_data except Exception, e: # set the admin phone nos as global variable in the settings and make message_as_sms() loop over the nos. data = {'subject': 'Offline Registration Error', 'message': e, 'phone': '08137474080'} message_as_email(data) return
elif method == 'update_user': try: gw = RemotingService(domain + 'sync/', amf_version=AMF3) service = gw.getService('SyncService') http_data = service.update_user(obj) return http_data except Exception, e: # set the admin phone nos as global variable in the settings and make message_as_sms() loop over the nos. data = { 'subject': 'Offline Registration Error', 'message': e, 'phone': '08137474080' } message_as_email(data) return elif method == 'update_wallet': try: gw = RemotingService(domain + 'sync/', amf_version=AMF3) service = gw.getService('SyncService') http_data = service.update_wallet(obj) return http_data except Exception, e: # set the admin phone nos as global variable in the settings and make message_as_sms() loop over the nos. data = { 'subject': 'Offline Registration Error', 'message': e, 'phone': '08137474080'