示例#1
0
def withdraw(aid=False):
    if not session.get('user_id'):
        return redirect(url_for('login'))
    if request.method == 'POST':
        amount = request.form['amount']
        previous_amount = request.form['ws_acct_balance']
        ws_acct_id = request.form['ws_acct_id']
        ws_acct_balance = int(previous_amount) - int(amount)
        if ws_acct_balance <= 0:
            flash("Withdraw not allowed, please choose smaller amount",
                  "danger")
            url = '/withdraw/' + ws_acct_id
            return redirect(url)
        Account.objects(ws_acct_id=ws_acct_id).update_one(
            ws_acct_balance=ws_acct_balance,
            ws_message='WITHDRAW',
            ws_acct_lasttrdate=datetime.now())
        transactions = Transactions(
            ws_tnsc_id=get_random_alphaNumeric_string(8),
            ws_acct_id=ws_acct_id,
            ws_desc='Withdraw',
            ws_amt=amount,
            ws_trxn_date=datetime.now())
        transactions.save()
        flash("Amount withdrawn successfully", "success")
        url = '/accounts/' + ws_acct_id
        return redirect(url)
    if aid:
        account = Account.objects(ws_acct_id=aid).first()
        return render_template("account_operations/withdraw_money.html",
                               account=account,
                               info=True)
    return render_template("account_operations/withdraw_money.html",
                           info=False)
示例#2
0
def create_account():
    if request.method == "POST":
        customer_id = request.form["customerId"]
        check_cusid = Customer.objects(customer_id=customer_id).first()
        account_id = str(
            int(Account.objects.order_by('-customer_id').first().account_id) +
            2)
        account_type = request.form["account_type"]
        check_type = Account.objects(customer_id=customer_id,
                                     account_type=account_type).first()
        deposit_amount = request.form["depositAmount"]
        if (not check_cusid):
            message = "Customer Id doesnot Exist"
        elif (check_type):
            message = "Customer already has account of specific type"
            account = Account.objects(customer_id=customer_id,
                                      account_type=account_type).first()
            account.account_status = message
            account.save()

        else:
            message = "Account Created Successfully"
            account = Account(customer_id=customer_id,
                              account_id=account_id,
                              account_type=account_type,
                              deposit_amount=deposit_amount,
                              account_status=message).save()
        return render_template("create_account.html", message=message)
    return render_template("create_account.html")
示例#3
0
def deposit(aid=False):
    if not session.get('user_id'):
        return redirect(url_for('login'))
    if request.method == 'POST':
        amount = request.form['amount']
        previous_amount = request.form['ws_acct_balance']
        ws_acct_id = request.form['ws_acct_id']
        ws_acct_balance = int(previous_amount) + int(amount)
        Account.objects(ws_acct_id=ws_acct_id).update_one(
            ws_acct_balance=ws_acct_balance,
            ws_message='DEPOSIT',
            ws_acct_lasttrdate=datetime.now())
        transactions = Transactions(
            ws_tnsc_id=get_random_alphaNumeric_string(8),
            ws_acct_id=ws_acct_id,
            ws_desc='Deposit',
            ws_amt=amount,
            ws_trxn_date=datetime.now())
        transactions.save()
        url = '/accounts/' + ws_acct_id
        flash("Amount deposited successfully", "success")
        return redirect(url)
    if aid:
        account = Account.objects(ws_acct_id=aid).first()
        return render_template("account_operations/deposit.html",
                               account=account,
                               info=True)
    return render_template("account_operations/deposit.html", info=False)
def get_account(abort_if_invalid=True, username="") -> Account:
    """Gets credentials from the header's 'Authorization' key"""

    if abort_if_invalid:
        if request.authorization is None:
            abort(403, "No credentials provided")

        username = request.authorization['username']
        password = request.authorization['password']
        if username == "" or password == "":
            abort(
                403,
                "No credentials provided. Please ensure you have a registered account"
            )

        account = Account.find_account(username, password)
        if account is None:
            abort(
                403,
                "Invalid account credentials. Please ensure you have a valid registered account"
            )
    else:
        account = Account.find_account(username)

    return account
示例#5
0
def account_search():
    if session.get('userId') and session.get('roleId')=="2222":
        form = Account_Search_Form()
        if(request.method=='POST'):
            ws_acc_id=form.ws_acc_id.data
            print(ws_acc_id)
            ws_cust_id=form.ws_cust_id.data
            if ws_acc_id != None :
                account=Account.objects(ws_acct_id=ws_acc_id).first()
                if account:
                    return render_template('single_account_details.html',account = account)
                else:
                    flash("Invalid Account Id","danger")
            elif ws_cust_id != None :
                print("cust id")
                account=Account.objects(ws_cust_id=ws_cust_id)
                if account:
                    return render_template('account_details.html',account = account)
                else:
                    flash("Invalid Customer Id","danger")
            
            else :
                flash('Enter one of the ID','danger')    
        return render_template('Account_search.html',form=form)
    else:
        flash("Sorry You are not authorised to access this page","danger")
        return redirect("/")
示例#6
0
def test_create_package(db_session):
    account = Account.find_account(user1.email, "password")
    account.packages.append(pkg1)
    account.packages.append(pkg2)
    account.save()

    account = Account.find_account(user1.email, "password")
    assert len(account.to_dict(True)['packages']) == 2
示例#7
0
def account_status():
    count = Account.objects().count()
    if count == 0:
        flash("Currently No Accounts Created Untill Now", "danger")
        return redirect(url_for(index))
    accounts = Account.objects()
    return render_template("status_detail/account_status.html",
                           accounts=accounts)
示例#8
0
    def setUp(self):
        self.browser = webdriver.Firefox()

        category = Category(name="salary", type="income")
        category.save()

        account = Account(name="savings")
        account.save()

        income = Income(category=category, account=account, notes="October 2015 salary", amount=100000, date=datetime.datetime.now())
        income.save()
示例#9
0
    def setUp(self):
        self.browser = webdriver.Firefox()
        self.browser.implicitly_wait(3)

        category = Category(name="others", type="expense")
        category.save()

        account = Account(name="savings")
        account.save()

        expense = Expense(category=category, account=account, notes="gift", amount=1000, date=datetime.datetime.now())
        expense.save()
示例#10
0
def create_account():
    data = request.get_json()
    account = Account(**data)
    if Account.find_account(data['username']) is not None:
        abort(400, f"Username '{data['username']}' is already taken")
    elif Account.find_account(data['email']) is not None:
        abort(400, f"Email '{data['email']}' is already taken")

    try:
        return account.save().to_dict()
    except Exception as e:
        current_app.logger.error(e)
        abort(400, "could not create account")
示例#11
0
def create_account():
    if session.get('userId') and session.get('roleId')=="1111":
        form = Create_Account_Form()
        if(request.method=='POST'):
            if form.validate_on_submit():
                ws_cust_id=form.ws_cust_id.data
                ws_acc_id=generate_Account_Id()
                ws_acct_type=form.ws_acct_type.data
                ws_acct_balance=form.ws_acct_balance.data
                status='Active'
                x = datetime.now()
                d=x.strftime("%x")
                y = datetime.now()
                t=y.strftime("%X")
                dt = d + " " + t 
                print("##############"+dt+"##############")  
                ws_acct_lastUdate =datetime.strptime(dt,'%m/%d/%y %H:%M:%S')  
                message='customer created successfully'
                Account(ws_cust_id=ws_cust_id,ws_acct_id=ws_acc_id,ws_acct_type=ws_acct_type,ws_acct_balance=ws_acct_balance,ws_acct_crdate=date.today()).save()
                Account_Status(ws_cust_id=ws_cust_id,ws_acct_id=ws_acc_id,ws_acct_type=ws_acct_type,ws_acct_status=status,ws_message=message,ws_acct_lastUdate=ws_acct_lastUdate).save()
                flash('Thank  for creating account.we will get  back to you soon', 'success')
                return redirect(url_for('create_account'))
            
        
        return render_template('create_account.html',form=form)
    else:
        flash("Sorry You are not authorised to access this page","danger")
        return redirect("/")
示例#12
0
def account_delete():
    if session.get('userId') and session.get('roleId')=="1111":
        form = Account_Delete_Form()   
        if request.method =='POST' :
            acct_id = form.ws_acct_id.data
            delete_account= Account.objects(ws_acct_id=acct_id).first()
            delete_account_status=Account_Status.objects(ws_acct_id=acct_id).first()
            x = datetime.now()
            d=x.strftime("%x")
            y = datetime.now()
            t=y.strftime("%X")
            dt = d + " " + t 
            if delete_account_status:
                delete_account_status.ws_acct_status='inactive'
                delete_account_status.ws_message='account deleted'
                delete_account_status.ws_acct_lastUdate=datetime.strptime(dt,'%m/%d/%y %H:%M:%S') 
                delete_account_status.save()
            else:
                print(delete_account.ws_cust_id)
                account_status=Account_Status(ws_cust_id=delete_account.ws_cust_id,ws_acct_type=delete_account.ws_acct_type,ws_acct_id=acct_id,ws_acct_status='inactive',ws_message='account deleted',ws_acct_lastUdate=datetime.strptime(dt,'%m/%d/%y %H:%M:%S'))
                account_status.save()
            delete_account.delete()
            flash('your Account is deleted', 'success')
            return render_template('layout.html')
        return render_template('account_delete.html',form=form, accounts =accounts,acc_id=acc_id)
    else:
        flash("Sorry You are not authorised to access this page","danger")
        return redirect("/")
示例#13
0
def withdraw_amount():
    if session.get('userId') and session.get('roleId')=="2222":
        account=Account.objects(ws_acct_id=request.form["acct_id"]).first()
        # return account["ws_acct_type"]
        if not request.form["withdraw_amount"].isnumeric():
            flash("Please enter only digits","danger")
            return render_template('view_withdraw.html',account=account)
        withdraw_amount=int(request.form["withdraw_amount"])
        if(account["ws_acct_balance"]<int(withdraw_amount)):
            flash("You dont have enough balance to withdraw given amount","danger")
            return render_template('view_withdraw.html',account=account)
        else:
            account.ws_acct_balance=account.ws_acct_balance-withdraw_amount
            ws_cust_id=account.ws_cust_id
            ws_acct_id=account.ws_acct_id
            ws_transaction_id=generate_Transaction_Id()
            ws_description='withdraw'
            ws_amount=withdraw_amount
            x = datetime.now()
            d=x.strftime("%x")
            y = datetime.now()
            t=y.strftime("%X")
            dt = d + " " + t 
            ws_trxn_date=datetime.strptime(dt,'%m/%d/%y %H:%M:%S')
            Transaction(ws_cust_id=ws_cust_id,ws_acct_id=ws_acct_id,ws_transaction_id=ws_transaction_id,ws_description=ws_description,ws_amount=ws_amount,ws_trxn_date=ws_trxn_date).save()
            account.save()
            flash("Amount withdrawn successfully","success")
            return redirect('/view_single/'+request.form["acct_id"])
        # return render_template('single_account_details.html',account = account)
    else:
        flash("Sorry You are not authorised to access this page","danger")
        return redirect("/")
示例#14
0
文件: routes.py 项目: vrushang98/RBMS
def deposit_amount():
    if session.get('userId') and session.get('roleId') == "2222":
        print("inside acct delete", request.form["acct_id"])
        account = Account.objects(ws_acct_id=request.form["acct_id"]).first()

        if not request.form["deposit_amount"].isnumeric():
            flash("Please enter only digits", "danger")
            return render_template('view_deposit.html', account=account)
        print(type(request.form["deposit_amount"]))
        deposit_amount = int(request.form["deposit_amount"])
        account.ws_acct_balance = account.ws_acct_balance + deposit_amount
        ws_cust_id = account.ws_cust_id
        ws_acct_id = account.ws_acct_id
        ws_transaction_id = generate_Transaction_Id()
        ws_description = 'Deposit'
        ws_amount = deposit_amount
        x = datetime.now()
        d = x.strftime("%x")
        y = datetime.now()
        t = y.strftime("%X")
        dt = d + " " + t
        ws_trxn_date = datetime.strptime(dt, '%m/%d/%y %H:%M:%S')
        Transaction(ws_cust_id=ws_cust_id,
                    ws_acct_id=ws_acct_id,
                    ws_transaction_id=ws_transaction_id,
                    ws_description=ws_description,
                    ws_amount=ws_amount,
                    ws_trxn_date=ws_trxn_date).save()
        account.save()
        flash("Amount deposited successfully", "success")
        return redirect('/view_single/' + request.form["acct_id"])

    else:
        flash("Sorry You are not authorised to access this page", "danger")
        return redirect("/")
示例#15
0
def account_delete_search():
    if session.get('userId') and session.get('roleId')=="1111":
        if request.method=="POST":
            form = Account_Delete_Form()
            accounts = Account.objects(ws_cust_id=request.form["cust_id"]).all()
            acc_id = []
            if accounts:
            
                acct_type=accounts[0]['ws_acct_type']
                # accounts[0]['ws_acct_type']

                for account in accounts:
                    acc_id.append((account.ws_acct_id,account.ws_acct_id))
                
                form.ws_acct_id.choices = acc_id
                form.ws_acct_type.data=acct_type
                return render_template('account_delete.html',form=form, accounts =accounts,acc_id=acc_id)
                #form.ws_acct_type.default = form.ws_acc_id.data 
        
            else:
                flash("Invalid Customer Id","danger")
        return render_template("account_delete_search.html")
    else:
        flash("Sorry You are not authorised to access this page","danger")
        return redirect("/")
示例#16
0
def withdraw():
    if session.get('userId') and session.get('roleId')=="2222":
        account=Account.objects(ws_acct_id=request.form["acct_id"]).first()

        return render_template('view_withdraw.html',account=account)
    else:
        flash("Sorry You are not authorised to access this page","danger")
        return redirect("/")
示例#17
0
def generate_Account_Id():
    st="30"
    num2=random.randint(1000000,9999999)
    acct_id=int(st+str(num2))
    account=Account.objects(ws_acct_id=acct_id).first()
    if account:
        generate_Account_Id()
    return str(acct_id)
示例#18
0
def accounts(aid):
    print(aid, flush=True)
    if aid:
        accounts = Account.objects(ws_acct_id=aid)
    else:
        return redirect(url_for(index))
    return render_template("account_operations/accounts.html",
                           accounts=accounts)
示例#19
0
def view_single(id):
    if session.get('userId') and session.get('roleId')=="2222":
        
        account=Account.objects(ws_acct_id=id).first()
        return render_template('single_account_details.html',account = account)
        
    else:
        flash("Sorry You are not authorised to access this page","danger")
        return redirect("/")
示例#20
0
def create_account():
    if session.get('ROLE') != "acc_exec":
        flash("Action Not Allowed", category="danger")
        return redirect('main.home')
    else:
        form = AccountDetailsForm()
        form.acc_no.data = Account.generate_acc_no()
        if form.validate_on_submit():
            account = Account(acc_no=form.acc_no.data,
                              acc_balance=form.acc_balance.data,
                              acc_type=form.acc_type.data,
                              cust_id=form.cust_id.data)
            db.session.add(account)
            db.session.commit()
            flash("Account Successfully Created!!!", category="success")
            return redirect(url_for('main.home'))
        return render_template("accounts/create_account.html",
                               form=form,
                               title="Create Account")
示例#21
0
def search_delete_account():
    if request.method == "POST":
        account_id = request.form["accountid"]

        customer_id = request.form["customerid"]
        check_id = Account.objects(account_id=account_id).first()

        check_cusid = Account.objects(customer_id=customer_id).all()

        if check_id or check_cusid:
            if not check_cusid and not check_id:
                return render_template("search_account.html")
            elif not check_cusid:
                return render_template("delete_account.html", form=check_id)
            else:

                return render_template("delete_account.html",
                                       form_list=check_cusid)
    return render_template("search_account.html")
示例#22
0
def validate_account():
    error_message = "could not find account or password is incorrect"

    data = request.get_json()

    account = Account.find_account(data['username'], data['password'])
    if account is None:
        abort(404, error_message)

    return account.to_dict()
示例#23
0
def index():
    c_count = UserStore.objects(role='CASHIER').count()
    e_count = UserStore.objects(role='EXECUTIVE').count()
    customer_count = Customer.objects().count()
    account_count = Account.objects().count()
    return render_template("home.html",
                           c_count=c_count,
                           e_count=e_count,
                           customer_count=customer_count,
                           account_count=account_count)
示例#24
0
def create_account():
    if not session.get('user_id'):
        return redirect(url_for('login'))
    if request.method == 'POST':
        ws_cust_id = request.form['ws_cust_id']
        ws_acct_id = get_random_alphaNumeric_string(9)
        ws_acct_type = request.form['ws_acct_type']
        ws_acct_balance = int(request.form['ws_acct_balance'])
        if ws_acct_balance <= 0:
            flash("Account creation Failed due to negative amount!", "danger")
            return redirect(url_for('create_account'))
        ws_acct_crdate = datetime.now()
        ws_acct_lasttrdate = datetime.now()
        ws_acct_duration = 0
        ws_status = 'CREATED'
        account = Account.objects(ws_cust_id=ws_cust_id,
                                  ws_acct_type=ws_acct_type)
        if account:
            flash(
                "Current User already have this type of account please try other",
                "danger")
            return redirect(url_for('create_account'))
        account = Account(ws_cust_id=ws_cust_id,
                          ws_acct_id=ws_acct_id,
                          ws_acct_type=ws_acct_type,
                          ws_acct_balance=ws_acct_balance,
                          ws_acct_crdate=ws_acct_crdate,
                          ws_message='CREATED',
                          ws_acct_lasttrdate=ws_acct_lasttrdate,
                          ws_acct_duration=ws_acct_duration,
                          ws_status=ws_status)
        account.save()
        transactions = Transactions(
            ws_tnsc_id=get_random_alphaNumeric_string(8),
            ws_acct_id=ws_acct_id,
            ws_desc='Deposit',
            ws_amt=ws_acct_balance,
            ws_trxn_date=datetime.now())
        transactions.save()
        flash("Account creation initiated successfully!", "success")
        return redirect('/accounts/' + ws_acct_id)
    return render_template("account_management/create_account.html")
示例#25
0
def create_account():

        if not session.get('username'):
          return redirect(url_for('login'))
        if request.method == "POST":
    
            customer_id = request.form["CustomerId"]
            account_id = request.form['AccountId']
            account_type    = request.form["Account"]
            deposit_amount  = request.form["DepositAmount"]
            temp = User.objects(customer_ssn_id=customer_id)
            if temp:
                account = Account(account_id=account_id,customer_ssn_id=customer_id, account_type=account_type, deposit_amount= deposit_amount)
                account.save()
                flash("You are successfully registered!","success")
                return redirect(url_for('index'))
            else:
                flash("Oops!!No such customer exist!!Register first","danger")
                return redirect(url_for('register'))
                
        return render_template("acccountcreate.html")
示例#26
0
def create_account():
    if not session.get('username'):
        return redirect(url_for('login'))
    form = AccountForm()

    customer_Id = form.customerId.data
    account_type = form.account_type.data
    deposit = form.deposit.data
    customer = Customer()

    if customer_Id:
        classess = list(
            Customer.objects.aggregate(*[{
                '$lookup': {
                    'from': 'account',
                    'localField': 'customerId',
                    'foreignField': 'customerId',
                    'as': 'r1'
                }
            }, {
                '$match': {
                    'customerId': customer_Id
                }
            }]))
        print(classess)
        if classess:
            acc = Account(customerId=customer_Id,
                          account_type=account_type,
                          deposit=deposit)
            acc.save()
            flash("Account created", 'success')
            return redirect(url_for('create_account'))
        else:
            flash("account not found")

    return render_template("create_account.html",
                           title="Create Account",
                           account_management=True,
                           form=form)
示例#27
0
def transfer():
    if not session.get('user_id'):
        return redirect(url_for('login'))
    if request.method == 'POST':
        print(request.form, flush=True)
        sr_acct_id = request.form['sr_acct_id']
        tr_acct_id = request.form['tr_acct_id']
        if sr_acct_id == tr_acct_id:
            flash("Source and Target cannot be  same !", "danger")
            return redirect('/transfer')
        amount = int(request.form['amount'])
        account1 = Account.objects(ws_acct_id=sr_acct_id).first()
        account2 = Account.objects(ws_acct_id=tr_acct_id).first()
        if account1 and account2:
            if account1.ws_acct_balance >= amount:
                sr_acct_balance = account1.ws_acct_balance - amount
                tr_acct_balance = account2.ws_acct_balance + amount
                Account.objects(ws_acct_id=sr_acct_id).update_one(
                    ws_acct_balance=sr_acct_balance,
                    ws_message='TRANSFER',
                    ws_acct_lasttrdate=datetime.now())
                Account.objects(ws_acct_id=tr_acct_id).update_one(
                    ws_acct_balance=tr_acct_balance,
                    ws_message='TRANSFER',
                    ws_acct_lasttrdate=datetime.now())
                transactions1 = Transactions(
                    ws_tnsc_id=get_random_alphaNumeric_string(8),
                    ws_acct_id=sr_acct_id,
                    ws_desc='Transfer from here',
                    ws_amt=amount,
                    ws_trxn_date=datetime.now(),
                    ws_src_typ=account1.ws_acct_type,
                    ws_tgt_typ=account2.ws_acct_type)
                transactions1.save()
                transactions2 = Transactions(
                    ws_tnsc_id=get_random_alphaNumeric_string(8),
                    ws_acct_id=tr_acct_id,
                    ws_desc='Transfer to here',
                    ws_amt=amount,
                    ws_trxn_date=datetime.now(),
                    ws_src_typ=account1.ws_acct_type,
                    ws_tgt_typ=account2.ws_acct_type)
                transactions2.save()
                flash("Amount transfer completed successfully !", "success")
                return redirect('/transfer')
            else:
                flash("Transfer not allowed, please choose smaller amount !",
                      "danger")
                return redirect('/transfer')
        else:
            if account1:
                flash("Destination Account Doest exists !", "danger")
                return redirect('/transfer')
            else:
                flash("Source Account Doest exists !", "danger")
                return redirect('/transfer')
    return render_template("account_operations/transfer_money.html")
示例#28
0
def delete_account():
    if not session.get('user_id'):
        return redirect(url_for('login'))
    if request.method == 'POST':
        ws_acct_id = request.form['ws_acct_id']
        ws_acct_type = request.form['ws_acct_type']
        account = Account.objects(
            ws_acct_id=ws_acct_id,
            ws_acct_type=ws_acct_type).update_one(ws_status='DELETED')
        if account == 0:
            flash("No Account  Available with Given Information !", "danger")
        else:
            flash("Account deletion initiated successfully", "success")
        return redirect(url_for('delete_account'))
    return render_template("account_management/delete_account.html")
示例#29
0
def delete_account2():
    if request.method == "POST":
        account_id = request.form["accountid"]
        account_type = request.form["accounttype"]
        account = Account.objects(account_id=account_id,
                                  account_type=account_type).delete()
        if account == 0:
            return render_template(
                "delete_account.html",
                message="AccountId is and Account type is not matching")
        else:
            return render_template("executive.html",
                                   mes="data deleted successfully")

    return render_template("delete_account.html")
示例#30
0
def account_search():
    if request.method == 'POST':
        ws_cust_id = request.form['cid']
        ws_acct_id = request.form['aid']
        if ws_acct_id:
            account = Account.objects(ws_acct_id=ws_acct_id).first()
            if account:
                url = 'accounts/' + ws_acct_id
                return redirect(url)
            else:
                flash("No account exists with given Account Id !", "danger")
        elif ws_cust_id:
            account = Account.objects(ws_cust_id=ws_cust_id).first()
            if account:
                ws_acct_id = account.ws_acct_id
                url = 'accounts/' + ws_acct_id
                return redirect(url)
            else:
                flash("No account exists with given Account Id !", "danger")
        else:
            flash(
                "Search possible only by filling either  Account Id or Customer ID !",
                "danger")
    return render_template("status_detail/account_search.html")
示例#31
0
def delete_account():
    data = request.get_json()

    account = Account.find_account(data['username'], data['password'])
    if account is None:
        abort(401, "invalid account credentials")

    folder = Path(current_app.config['PACKAGE_FOLDER'])
    for p in account.packages:
        pkg_folder = folder.joinpath(p.name)
        if pkg_folder.exists():
            rmtree(pkg_folder, True)

    account.delete()
    return "", 200
示例#32
0
文件: views.py 项目: fmeina/covid_app
def register():
    if current_user.is_authenticated:
        return redirect(url_for('core.index'))
    form = RegistrationForm()
    if form.validate_on_submit():
        user = Account(email=form.email.data,
                       login=form.login.data,
                       password=form.password.data)
        data_login = user.login
        data_email = user.email
        data_password = user.password
        db.engine.execute(
            "INSERT INTO accounts(login, email, password) VALUES(%s, %s, %s)",
            data_login, data_email, data_password)
        db.session.commit()
        flash('Thanks for registering! Now you can login!')
        return redirect(url_for('users.login'))
    return render_template('register.html', form=form)