コード例 #1
0
    def register_nurse(self):
        # Create the user object
        user = {
            "_id": uuid.uuid4().hex,
            "email": request.form.get('email'),
            "id_num": request.form.get('id_num'),
            "courses": request.form.get('courses'),
            "name": request.form.get('name'),
            "roles": request.form.get('roles'),
            "work_years": request.form.get('work_years'),
            "employment_percentage": request.form.get('employment_percentage'),
        }

        # Encrypt the password
        user['id_num'] = pbkdf2_sha256.encrypt(user['id_num'])
        return self.start_session(user)

    # def get_nurse(self, nurse_name):
    #     pass


# def signup(self):
#
#     # Create the user object
#     user = {"_id": uuid.uuid4().hex,
#             "email": request.form.get('email'),
#             "password": request.form.get('password'),
#             }
#
#     # Encrypt the password
#     user['password'] = pbkdf2_sha256.encrypt(user['password'])
#     return self.start_session(user)
コード例 #2
0
def update_user(username, firstname, lastname, email, dob, password, country):
    print("previous user name" + lastname)
    # print("countryname"+country)
    # print("dob is"+dob)
    if country == '':
        c_id = ''
    else:
        if Country.objects.filter(country_name__iexact=country).exists():
            country = Country.objects.get(country_name__iexact=country)
            c_id = country.id
        else:
            query1 = Country(country_name=country)
            query1.save()
            # print(query1)
            country = Country.objects.get(country_name__iexact=country)

            # print(country)
            c_id = country.id
    hashed_password = pbkdf2_sha256.encrypt(password,
                                            rounds=200000,
                                            salt_size=16)
    query = User.objects.filter(username=username).update(
        password=hashed_password,
        firstname=firstname,
        lastname=lastname,
        email=email,
        dob=dob,
        country_id=c_id)

    return query
コード例 #3
0
ファイル: wallet_password.py プロジェクト: Flawlesse/ISP_Labs
def encrypt(password) -> str:
    "Returns encrypted string for given password."
    return pbkdf2_sha256.encrypt(
        password,
        rounds=26000,
        salt_size=32,
    )
コード例 #4
0
def add_user(firstname, username, password, email):
    hashed_password = pbkdf2_sha256.encrypt(password,
                                            rounds=200000,
                                            salt_size=16)
    query = User(username=username,
                 firstname=firstname,
                 password=hashed_password,
                 email=email)
    query.save()
コード例 #5
0
 def reset(self):
     if request.form['password'] == request.form['verifypassword']:
         mongo.db.users.update_one({
             "_id": request.form['id']
         }, {
             '$set': {
                 "password": pbkdf2_sha256.encrypt(request.form.get('password'))
             }
         })
         return {"message": "Password changed!"}, 200
     return jsonify({"error": "You didnt verify your old password"}), 400
コード例 #6
0
    def create(cls, email, nickname, password):
        pw_hash = pbkdf2_sha256.encrypt(password, rounds=200000, salt_size=16)

        user = User(int(r.incr('next_user_id')), email.lower(), nickname,
                    pw_hash)
        r.hmset('user:{}'.format(user.UserId), {
            'email': user.Email,
            'nickname': user.Nickname,
            'hash': user.Hash
        })
        r.zadd('users', user.Email, user.UserId)
        return user
コード例 #7
0
def create_user():
    user = User(username=request.form.get('username'),
                password=pbkdf2_sha256.encrypt(request.form.get('password'),
                                               rounds=200000,
                                               salt_size=16),
                vector=np.zeros(300),
                nb_click=0)

    DB.get_instance().add(user)
    DB.get_instance().commit()

    session['username'] = user.username
    session.modified = True

    return redirect(url_for('index'))
コード例 #8
0
ファイル: views.py プロジェクト: SabikAbtahee/BYTE-PRO
    def adduser(self, request):
        if (request.method == "POST"):
            # request.POST.get('is_private', False)
            name = request.POST.get("name", False)
            username = request.POST.get('username', False)
            password = request.POST.get("password", False)
            email = request.POST.get("email", False)
            confirmPassword = request.POST.get("confirmPassword", False)

            enc_password = pbkdf2_sha256.encrypt(password,
                                                 rounds=1200,
                                                 salt_size=32)
            print(enc_password)
            print(pbkdf2_sha256.decrypt(enc_password))

            user1 = Database.models.UsersAll(name=name,
                                             userName=username,
                                             password=enc_password,
                                             email=email)
            user1.save()
コード例 #9
0
 def createAccount(self, name, password, mac, connection):
     name = name.lower()
     print "Attemping to create account: %s, %s" % (name, password)
     if self.jsonAccInfo.has_key(name):
         print "Account already exists: %s, %s" % (name, password)
         self.sendAccountExists(connection)
         return
     elif not self.canMakeNewAccount(mac):
         print "Too many accounts have been created on this computer."
         self.sendServerMessage('tmaotc', connection,
                                self.getAccountLimitPerComp())
         return
     elif self.isTotalAccountLimitReached():
         print "The game's total account limit has already been reached."
         self.sendServerMessage('tmait', connection, self.getAccountLimit())
         return
     print "Hashing password..."
     hash = pbkdf2_sha256.encrypt(password, rounds=200000, salt_size=16)
     self.jsonAccInfo[name] = {"password": hash, "mac": mac}
     self.flushData(self.jsonAccInfo)
     self.sendAccountCreated(connection)
     print "Created account: %s, %s" % (name, password)
コード例 #10
0
 def generate_hash_password(password):
     return pbkdf2_sha256.encrypt(password, rounds=200000, salt_size=16)
コード例 #11
0
ファイル: main.py プロジェクト: rogerior/preeduction
def hash_password(password):
    return pbkdf2_sha256.encrypt(password, rounds=25600)
コード例 #12
0
    "role": "nurse"
}, {
    "_id": "30000000000",
    "name": "nurit",
    "work_years": "30",
    "role": "nurse"
}, {
    "_id": "40000000000",
    "name": "einat",
    "work_years": "3",
    "role": "nurse"
}]
users_dict = [
    {
        "email": "*****@*****.**",
        "password": pbkdf2_sha256.encrypt("039762364")
    },
    {
        "email": "*****@*****.**",
        "password": pbkdf2_sha256.encrypt("200079580")
    },
    {
        "email": "*****@*****.**",
        "password": pbkdf2_sha256.encrypt("044")
    },
    {
        "email": "*****@*****.**",
        "password": pbkdf2_sha256.encrypt("144")
    },
    {
        "email": "*****@*****.**",