def addRecruiter(email, name, organization): print('creating Recruiter ' + email + ' ' + name + ' ' + organization) account = models.Account() account.username = email account.password = dataplus.hash(dataplus.getUniqueId()) account.account_type = 'FR' account.account_state = 'I' account.email_verified = True account.save() rec = models.Recruiter() rec.account = account rec.key = dataplus.getUniqueId() rec.email = email rec.name = name rec.organization = organization rec.telephone = '' #default values rec.verified = True #only through invites rec.verified_on = datetime.datetime(1981, 1, 9) #default date min value ;) rec.results_last_sent_on = datetime.datetime(1981, 1, 9) #Jes' bday -- default min date rec.save() models.RecruiterData(recruiter=rec).save() models.Token.getNew(email, type='RecPropaganda') return rec
def addRecruiter(email, password, name, organization, telephone, token, through_invite): account = models.Account() account.username = email account.password = dataplus.hash(password) account.account_type = 'FR' account.account_state = 'A' account.email_verified = False if through_invite: account.email_verified = True account.save() rec = models.Recruiter() rec.account = account rec.key = dataplus.getUniqueId() rec.email = email rec.name = name rec.organization = organization rec.telephone = telephone #default values rec.verified = True #only through invites rec.verified_on = datetime.datetime(1981, 1, 9) #default date min value ;) rec.results_last_sent_on = datetime.datetime(1981, 1, 9) #Jes' bday -- default min date rec.save() models.RecruiterData(recruiter=rec).save() #delete the token token.delete() return rec
def addRecruiter(email, name, organization): print("creating Recruiter " + email + " " + name + " " + organization) account = models.Account() account.username = email account.password = dataplus.hash(dataplus.getUniqueId()) account.account_type = "FR" account.account_state = "I" account.email_verified = True account.save() rec = models.Recruiter() rec.account = account rec.key = dataplus.getUniqueId() rec.email = email rec.name = name rec.organization = organization rec.telephone = "" # default values rec.verified = True # only through invites rec.verified_on = datetime.datetime(1981, 1, 9) # default date min value ;) rec.results_last_sent_on = datetime.datetime(1981, 1, 9) # Jes' bday -- default min date rec.save() models.RecruiterData(recruiter=rec).save() models.Token.getNew(email, type="RecPropaganda") return rec
def create(cls, username, password, account_type): acct = Account(username=username, password=dataplus.hash(password), account_type=account_type, account_state='A', email_verified=False) acct.save() return acct
def create(cls, username, password, account_type): acct = Account( username=username, password=dataplus.hash(password), account_type=account_type, account_state="A", email_verified=False, ) acct.save() return acct
def login(request, username, password, success_url=''): account = dataplus.returnIfExists( models.Account.objects.filter(username=username, password=dataplus.hash(password))) redirect_url = '/login.htm?flashId=login_failed' if account and account.account_type in ['FR', 'PU']: request.session['username'] = account.username request.session['account_type'] = account.account_type request.session['account_state'] = account.account_state if success_url: redirect_url = success_url elif request.GET.get('redir', ''): redirect_url = request.GET.get('redir', '').replace('__amp__', '&') else: redirect_url = { 'FR': '/recruiters/', 'PU': '/dashboard.htm' }[account.account_type] return HttpResponseRedirect(redirect_url)
def addRecruiter(email, password, name, organization, telephone, token, through_invite): account = models.Account() account.username = email account.password = dataplus.hash(password) account.account_type = 'FR' account.account_state = 'A' account.email_verified = False if through_invite: account.email_verified = True account.save() rec = models.Recruiter() rec.account = account rec.key = dataplus.getUniqueId() rec.email = email rec.name = name rec.organization = organization rec.telephone = telephone #default values rec.verified = True #only through invites rec.verified_on = datetime.datetime(1981, 1, 9) #default date min value ;) rec.results_last_sent_on = datetime.datetime( 1981, 1, 9) #Jes' bday -- default min date rec.save() models.RecruiterData(recruiter=rec).save() #delete the token token.delete() return rec
def setPassword(self, new_password): self.password = dataplus.hash(new_password) self.save()
def login(request, username, password, success_url=''): account = dataplus.returnIfExists(models.Account.objects.filter(username=username, password=dataplus.hash(password))) redirect_url = '/login.htm?flashId=login_failed' if account and account.account_type in ['FR','PU']: request.session['username'] = account.username request.session['account_type'] = account.account_type request.session['account_state'] = account.account_state if success_url: redirect_url = success_url elif request.GET.get('redir',''): redirect_url = request.GET.get('redir','').replace('__amp__', '&') else: redirect_url = {'FR': '/recruiters/', 'PU':'/dashboard.htm'}[account.account_type] return HttpResponseRedirect(redirect_url)