Esempio n. 1
0
def addpass():
    user=flask_login.current_user
    gname=user.name
    hint=user.hint
    username=user.email
    password=user.password
    name=gname+hint
    namedb=gname+hint+".db"
    nameenc=gname+hint+".enc"
    if request.method == "POST":
        appname=request.form.get('add_app-name')
        addemail=request.form.get('add_email')
        addpassword=request.form.get('add_password')
        if appname != "" and addemail != "" and addpassword != "":
            name=gname+hint
            namedb=gname+hint+".db"
            nameenc=gname+hint+".enc"
            try:
                d=Decrypt(username,password)
                d.decrypt_vault(nameenc,namedb)
            except:
                pass
            nname=gname+hint+".db"
            a=writetodb(nname)
            a.newwrite(appname,addemail,addpassword,"0")
            e = Encryt(username,password)
            e.encrypt_vault(name,namedb)
            return redirect (url_for('main.passwords'))
        else:
            flash("Please Fill Out All Feilds.") 
            return redirect(url_for('addpass',random=r()))     
    return render_template('addpasswords.html',random=r())
Esempio n. 2
0
def cards():
    user=flask_login.current_user
    gname=user.name
    hint=user.hint
    username=user.email
    password=user.password
    name=gname+hint
    namedb=gname+hint+".db"
    nameenc=gname+hint+".enc"
    try:
        d=Decrypt(username,password)
        d.decrypt_vault(nameenc,namedb)
        a=sqlitedb(namedb)
        data=a.readfromcards()
        e = Encryt(username,password)
        e.encrypt_vault(name,namedb)
        return render_template('cards.html',data=data,random=r())
    except:
        flash("No Cards Currently Present. Add A Card to View!!")
        return redirect(url_for('main.addcards'))
Esempio n. 3
0
def editpassword():
    user=flask_login.current_user
    gname=user.name
    hint=user.hint
    username=user.email
    password=user.password
    name=gname+hint
    namedb=gname+hint+".db"
    nameenc=gname+hint+".enc"

    if request.method=="POST":
        oldappname=request.form.get('old_app-name')
        oldemail=request.form.get('old_email')
        appname=request.form.get('add_app-name')
        uemail=request.form.get('add_email')
        upassword=request.form.get('add_password')
        
        if request.form.get('save') != None:
            if oldappname != "" and oldemail != "" and appname != "" and uemail != "" and upassword != "":
                try:
                    d=Decrypt(username,password)
                    d.decrypt_vault(nameenc,namedb)
                except:
                    pass
                a=writetodb(namedb)
                if a.update(appname,uemail,upassword,"0",oldappname,oldemail) == 0:
                    e = Encryt(username,password)
                    e.encrypt_vault(name,namedb)
                    flash("The App Name or UserName Specified Doesnot Exist.")
                    return redirect (url_for('main.editpassword',random=r()))
                e = Encryt(username,password)
                e.encrypt_vault(name,namedb)
                flash("Updated Succesfully.")
                return redirect (url_for('main.passwords'))
            else:
                flash("Please Specify All The Feilds")
                return redirect (url_for('main.editpassword',random =r()))
        elif request.form.get('delete') !=None:
            if oldappname != "" and oldemail != "":
                d=Decrypt(username,password)
                d.decrypt_vault(nameenc,namedb)
                a=writetodb(namedb)
                if a.delete(oldappname,oldemail) == 0:
                    e = Encryt(username,password)
                    e.encrypt_vault(name,namedb)
             
                    flash("The App Name or UserName Specified Does'nt Exist.")
                    return redirect (url_for('main.editpassword',random=r()))

                e = Encryt(username,password)
                e.encrypt_vault(name,namedb)
                flash("Deleted Succesfully.")
                return redirect (url_for('main.passwords'))
            else:
              
                flash("To Delete Please Fill Specify The First Two Feilds.")
                return redirect (url_for('main.editpassword',random=r()))
        else:
            flash("An unknown error occured!.")
            return redirect (url_for('main.passwords'))
    return render_template('editpassword.html',random=r())