Skip to content

Commit

Permalink
added the login using google too
Browse files Browse the repository at this point in the history
  • Loading branch information
Kbassem10 committed Oct 11, 2024
1 parent ad2a64d commit 7d5d07e
Show file tree
Hide file tree
Showing 6 changed files with 32 additions and 132 deletions.
11 changes: 9 additions & 2 deletions app.py
Original file line number Diff line number Diff line change
Expand Up @@ -534,8 +534,15 @@ def authorize():
{"user_mail": user_mail}
).fetchall()
if existing_mail:
error_existing = "Mail is already in use. Please choose another one."
return render_template("login.html", error=error_existing, form=CSRFForm())
user = db.session.execute(
text("SELECT user_id FROM users WHERE LOWER(user_mail) = :user_mail"),
{"user_mail": user_mail}
).fetchone()[0]

session["logged_in"] = True
session["user_id"] = user
session.permanent = True
return redirect("/home")

session["user_mail"] = user_mail
session["user_mail_verify"] = user_mail_verify
Expand Down
Binary file added static/user_photo/3.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
124 changes: 0 additions & 124 deletions templates/ai_chatbot.html

This file was deleted.

17 changes: 17 additions & 0 deletions templates/login.html
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,23 @@
<a class="sign-up-label" href="/register_page">
Don't have an account?<span class="sign-up-link">Sign up</span>
</a>
<br>
<a href="/register_google" class="google-link" text-decoration:none;">
<div class="google-login-button">
<svg stroke="currentColor" fill="currentColor" stroke-width="0" version="1.1" x="0px" y="0px" class="google-icon" viewBox="0 0 48 48" height="1em" width="1em" xmlns="http://www.w3.org/2000/svg">
<path fill="#FFC107" d="M43.611,20.083H42V20H24v8h11.303c-1.649,4.657-6.08,8-11.303,8c-6.627,0-12-5.373-12-12
c0-6.627,5.373-12,12-12c3.059,0,5.842,1.154,7.961,3.039l5.657-5.657C34.046,6.053,29.268,4,24,4C12.955,4,4,12.955,4,24
c0,11.045,8.955,20,20,20c11.045,0,20-8.955,20-20C44,22.659,43.862,21.35,43.611,20.083z"></path>
<path fill="#FF3D00" d="M6.306,14.691l6.571,4.819C14.655,15.108,18.961,12,24,12c3.059,0,5.842,1.154,7.961,3.039l5.657-5.657
C34.046,6.053,29.268,4,24,4C16.318,4,9.656,8.337,6.306,14.691z"></path>
<path fill="#4CAF50" d="M24,44c5.166,0,9.86-1.977,13.409-5.192l-6.19-5.238C29.211,35.091,26.715,36,24,36
c-5.202,0-9.619-3.317-11.283-7.946l-6.522,5.025C9.505,39.556,16.227,44,24,44z"></path>
<path fill="#1976D2" d="M43.611,20.083H42V20H24v8h11.303c-0.792,2.237-2.231,4.166-4.087,5.571
c0.001-0.001,0.002-0.001,0.003-0.002l6.19,5.238C36.971,39.205,44,34,44,24C44,22.659,43.862,21.35,43.611,20.083z"></path>
</svg>
<span>Login with Google</span>
</div>
</a>
</div>

<script>
Expand Down
8 changes: 4 additions & 4 deletions templates/register.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@

{% block body %}
<div class="form-container">

<div class="message-container">
{% if error %}
<div class="error-message">
{{ error }} <a href="/login_page">Sign in</a>
</div>
{% endif %}

{% if error_existing %}
<div class="error-message">
{{ error_existing }}</a>
Expand All @@ -29,12 +29,12 @@
<span class="checkmark">Show password</span>
</label>
<p class="page-link"></p>
<button class="form-btn">
<button class="form-btn">
<i class="fas fa-user-plus"></i> Register
</button>

</form>
<a href="/register_google" style="color: white; text-decoration:none;">
<a href="/register_google" class="google-link" text-decoration:none;">
<div class="google-login-button">
<svg stroke="currentColor" fill="currentColor" stroke-width="0" version="1.1" x="0px" y="0px" class="google-icon" viewBox="0 0 48 48" height="1em" width="1em" xmlns="http://www.w3.org/2000/svg">
<path fill="#FFC107" d="M43.611,20.083H42V20H24v8h11.303c-1.649,4.657-6.08,8-11.303,8c-6.627,0-12-5.373-12-12
Expand Down
4 changes: 2 additions & 2 deletions templates/version.html
Original file line number Diff line number Diff line change
Expand Up @@ -51,10 +51,10 @@ <h1>Imhotep Financial Manager</h1>

<h2>Version 4.3</h2>
<p>
5/10/2024<br>
11/10/2024<br>
1. updated the error of auto load on the show trans.<br>
2. improved the security and the performance.<br>
3. added the register with google.<br>
3. added the register with google and login using google.<br>
4. added error handling and fixed bug of change favorite currency and another bug of refresh the currency prices.<br>
5. added pagination for faster loads.<br>
6. fixed a bug on delete and edit show_trans/<br>
Expand Down

0 comments on commit 7d5d07e

Please sign in to comment.