Beispiel #1
0
def changepassword(oldpass,newpass):
    oldpass = crypt.decrypt(oldpass)
    user  = str(db_connect.getUser(email))
    res = ""
    if user.password==oldpass :
        db_connect.deleteUser(email)
        user['password'] = crypt.encrypt(newpass)
        db_connect.add_user(User.fromdict(user))
        res = "Password Changed..!!"
    else:
        res = "Wrong Password"
    return res
Beispiel #2
0
def signup():
    jsonData = request.get_json()
    print(jsonData)
    password = jsonData['password']
    password = crypt.encrypt(password)
    us = User(jsonData['name'],jsonData['email'],jsonData['mobile'],password)
    status = db_connect.add_user(us)
    return str(status)
Beispiel #3
0
def admin_reg():
    data = request.form
    password = crypt.encrypt(data['password'])
    u  = User(data['name'],data['email'],data['mobile'],password,type="admin")
    if(db_connect.add_user(u)==1):
        return redirect(url_for("admin"))
    else:
        abort(406)
Beispiel #4
0
def validate(email):
    user = db_connect.getUser(email,"")
    db_connect.deleteUser(email)
    db_connect.add_user(User.fromdict(user))
    return redirect(url_for("users"))
Beispiel #5
0
 def invalidateUser(self):
     self.isvalid = False
     db.add_user(self)