-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
47e286f
commit 316a95a
Showing
7 changed files
with
200 additions
and
34 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
{% extends "base.html" %} | ||
|
||
{% block content %} | ||
<div class="column is-4 is-offset-4"> | ||
<h3 class="title">Login</h3> | ||
<div class="box"> | ||
<form method="POST" action="/login"> | ||
<div class="field"> | ||
<div class="control"> | ||
<input class="input is-large" type="email" name="email" placeholder="Your Email" autofocus=""> | ||
</div> | ||
</div> | ||
|
||
<div class="field"> | ||
<div class="control"> | ||
<input class="input is-large" type="password" name="password" placeholder="Your Password"> | ||
</div> | ||
</div> | ||
<div class="field"> | ||
<label class="checkbox"> | ||
<input type="checkbox" name="remember"> | ||
Remember me | ||
</label> | ||
</div> | ||
<button class="button is-block is-info is-large is-fullwidth">Login</button> | ||
</form> | ||
</div> | ||
</div> | ||
{% endblock %} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
{% extends "base.html" %} | ||
|
||
{% block content %} | ||
<div class="column is-4 is-offset-4"> | ||
<h3 class="title">Sign Up</h3> | ||
<div class="box"> | ||
<form method="POST" action="/signup"> | ||
<div class="field"> | ||
<div class="control"> | ||
<input class="input is-large" type="email" name="email" placeholder="Email" autofocus=""> | ||
</div> | ||
</div> | ||
|
||
<div class="field"> | ||
<div class="control"> | ||
<input class="input is-large" type="text" name="name" placeholder="Name" autofocus=""> | ||
</div> | ||
</div> | ||
|
||
<div class="field"> | ||
<div class="control"> | ||
<input class="input is-large" type="password" name="password" placeholder="Password"> | ||
</div> | ||
</div> | ||
|
||
<button class="button is-block is-info is-large is-fullwidth">Sign Up</button> | ||
</form> | ||
</div> | ||
</div> | ||
{% endblock %} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
import sqlite3 | ||
import uuid | ||
from flask_login import UserMixin | ||
|
||
class User(UserMixin): | ||
def __init__(self, id, user_name, email, password): | ||
self.id = email | ||
self.user_name = user_name | ||
self.email = email | ||
self.password = password | ||
self.authenticated = True | ||
|
||
def is_active(self): | ||
return True | ||
|
||
def is_anonymous(self): | ||
return False | ||
|
||
def is_authenticated(self): | ||
return self.authenticated | ||
|
||
def is_active(self): | ||
return True | ||
|
||
def get_id(self): | ||
return self.id | ||
|
||
class UserModel: | ||
def __init__(self, db_name="users.db"): | ||
self.conn = sqlite3.connect(db_name, check_same_thread=False) | ||
self.create_table() | ||
|
||
def create_table(self): | ||
c = self.conn.cursor() | ||
c.execute(""" | ||
CREATE TABLE IF NOT EXISTS users ( | ||
id TEXT NOT NULL, | ||
user_name TEXT NOT NULL, | ||
email TEXT UNIQUE NOT NULL PRIMARY KEY, | ||
password TEXT NOT NULL | ||
) | ||
""") | ||
self.conn.commit() | ||
|
||
def insert_user(self, user_name, email, password): | ||
cursor = self.conn.cursor() | ||
uuid_str = str(uuid.uuid4()) | ||
try: | ||
cursor.execute("INSERT INTO users (id, user_name, email, password) VALUES (?, ?, ?, ?)", (uuid_str, user_name, email, password)) | ||
self.conn.commit() | ||
print("User added successfully!") | ||
except sqlite3.IntegrityError: | ||
print("Error: Email already exists.") | ||
|
||
def get_user_by_email(self, email): | ||
cursor = self.conn.cursor() | ||
cursor.execute("SELECT id, user_name, email, password FROM users WHERE email=?", (email,)) | ||
result = cursor.fetchone() | ||
print(result) | ||
if result: | ||
return User(result[0], result[1], result[2], result[3]) | ||
return None | ||
|
||
def get_all_users(self): | ||
cursor = self.conn.cursor() | ||
cursor.execute("SELECT id, user_name, email FROM users") | ||
return cursor.fetchall() | ||
|
||
def close(self): | ||
self.conn.close() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
global GENERATE_EMAIL_PROMPT_PREFIX | ||
global GENERATE_SUMMARY_PROMPT_PREIX | ||
GENERATE_EMAIL_PROMPT_PREFIX = "can you take this data and summarize in professional manner for an email on the team status for my manager?\n" + "Data: " | ||
GENERATE_SUMMARY_PROMPT_PREIX = "can you provide a short summary of what the team as a whole accomplished this week as well as an individual breakdown based on the following list of team members and work using the following" + "Format: \n" + "{ \n" + "'team'" + ": [{" + "\n 'name'" + ": '', " + "\n 'accomplishments'" + ": '' " + " ," + "\n 'commits'" + ": '' \n" + "}]," + "\n'report'" + ": {" + "\n 'summary'" + ": " + "\n 'highlights'" + ": [{" + "\n 'title'" + ": '' ," + "\n 'description'" + ": '' "+ "\n }], \n" + " 'conclusion'" + ": ''" + "\n}" + "\n}" + "\n" + "Data:" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,6 +6,7 @@ requires = [ | |
"Flask", | ||
"click", | ||
"openai", | ||
"Flask-Login", | ||
"python-Levenshtein", | ||
"pytest" | ||
] | ||
|