Beispiel #1
0
 def feedback():
     error = None
     feedb = models.feed(collection3, session['username'])
     email = models.mail()
     x = feedb.view_details()
     if request.method == 'POST':
         sub = request.form["sub"]
         con = request.form["con"]
         if sub == '' or con == '':
             error = 'Please fill out both fields.'
             return render_template('feedback.html', items=x, error=error)
         c = collection3.find({
             "username": session['username'],
             "subject": sub,
             "desc": con
         })
         if len(list(c)) != 0:
             error = "Same Feedback cannot be submitted"
             return render_template('feedback.html', items=x, error=error)
         feedb.insert_details(sub, con)
         email.send_email(session['username'], session['email'], sub, con)
         x = feedb.view_details()
         return render_template('feedback.html', items=x)
     else:
         return render_template('feedback.html', items=x)
Beispiel #2
0
def registration(request):
    '''
    Sign-in new user.
    Send email to user and automatically log-in to site.
    '''
    if request.method == 'POST':
        form = SignupForm(None, request.POST)
        if form.is_valid():
            form.save(request.POST) #create new user
            #send mail to user
            mail(request.POST['email'], 'email_confirmation.html', None, mailfrom=DEFAULT_FROM_EMAIL, subject="Registration Confirm")
            #log-in to user
            user = authenticate(username = request.POST['username'], password = request.POST['password'] )
            auth_login(request, user )
            return redirect("/main")
    else:
        form = SignupForm()
    
    c = {'form': form}
    c.update(csrf(request))
    return render_to_response('registration.html', c, RequestContext(request))
Beispiel #3
0
def send_testmail(request):
    url = 'http://%s%s' % (Site.objects.get_current().domain, reverse('confirm_registration', args=[str(uuid4())]))
    user = User.objects.get(username = "******")
    mail("*****@*****.**", 'email_confirmation.html', {'user': user, 'email': user.email, 'url':url}, subject="Registration Confirm")
    return HttpResponse("Mail Verification Success")
Beispiel #4
0
#from pymongo import MongoClient
#import dns
#import hashlib
#from datetime import date
#client=MongoClient("mongodb+srv://admin-Ayush:[email protected]/user?retryWrites=true&w=majority")
#collection=client.user.project
#name='Ayush Kuruvilla'
#password=hashlib.sha256('master@4123'.encode('utf-8')).hexdigest()
#cur=collection.find({'username': name})
#if len(list(cur))==0:
#    print('fail')
#for x in collection.find({'username': name}):
#    if(x['username']=="admin" and x['password']==hashlib.sha256('admin123'.encode('utf-8')).hexdigest()):
#            print('lol')
#    else:
#            print('hello')
#from validate_email import validate_email
#is_valid = validate_email(email_address='*****@*****.**', check_format=True, check_blacklist=True, check_dns=True, dns_timeout=10, check_smtp=True, smtp_timeout=10, smtp_helo_host='my.host.name', smtp_from_address='*****@*****.**', smtp_debug=False)
#print(is_valid)
import models
ob=models.mail()
l=ob.send_email('Ayush', "*****@*****.**", "ahem", "ahem")
print(l)