mirror of
https://github.com/simple-login/app.git
synced 2025-02-24 15:53:22 +08:00
better notify_admin message
This commit is contained in:
parent
9a8282107f
commit
3e0bc27bad
6 changed files with 10 additions and 16 deletions
|
@ -109,9 +109,7 @@ def facebook_callback():
|
|||
|
||||
flash(f"Welcome to SimpleLogin {user.name}!", "success")
|
||||
|
||||
notify_admin(
|
||||
f"new user signs up {user.email}", f"{user.name} signs up at {arrow.now()}"
|
||||
)
|
||||
notify_admin(f"new user {user.name} {user.email} signs up via facebook")
|
||||
|
||||
# The activation link contains the original page, for ex authorize page
|
||||
if "facebook_next_url" in session:
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import arrow
|
||||
from flask import request, session, redirect, url_for, flash
|
||||
from flask import request, session, redirect, url_for, flash
|
||||
from flask_login import login_user
|
||||
from requests_oauthlib import OAuth2Session
|
||||
|
@ -9,7 +9,7 @@ from app.email_utils import notify_admin
|
|||
from app.extensions import db
|
||||
from app.log import LOG
|
||||
from app.models import User
|
||||
from app.utils import random_string, encode_url
|
||||
from app.utils import encode_url
|
||||
|
||||
_authorization_base_url = "https://github.com/login/oauth/authorize"
|
||||
_token_url = "https://github.com/login/oauth/access_token"
|
||||
|
@ -93,9 +93,7 @@ def github_callback():
|
|||
|
||||
flash(f"Welcome to SimpleLogin {user.name}!", "success")
|
||||
|
||||
notify_admin(
|
||||
f"new user signs up {user.email}", f"{user.name} signs up at {arrow.now()}"
|
||||
)
|
||||
notify_admin(f"new user {user.name} {user.email} signs up via github")
|
||||
|
||||
# The activation link contains the original page, for ex authorize page
|
||||
if "next" in request.args:
|
||||
|
|
|
@ -108,9 +108,7 @@ def google_callback():
|
|||
|
||||
flash(f"Welcome to SimpleLogin {user.name}!", "success")
|
||||
|
||||
notify_admin(
|
||||
f"new user signs up {user.email}", f"{user.name} signs up at {arrow.now()}"
|
||||
)
|
||||
notify_admin(f"new user {user.name} {user.email} signs up via google")
|
||||
|
||||
# The activation link contains the original page, for ex authorize page
|
||||
if "google_next_url" in session:
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
import arrow
|
||||
from flask import request, flash, render_template, redirect, url_for
|
||||
from flask_login import current_user
|
||||
from flask_wtf import FlaskForm
|
||||
|
@ -45,8 +44,7 @@ def register():
|
|||
|
||||
send_activation_email(user, next_url)
|
||||
notify_admin(
|
||||
f"new user signs up {user.email}",
|
||||
f"{user.name} signs up at {arrow.now()}",
|
||||
f"new user {user.name} {user.email} signs up via email/password"
|
||||
)
|
||||
|
||||
return render_template("auth/register_waiting_activation.html")
|
||||
|
|
|
@ -74,8 +74,7 @@ def pricing():
|
|||
db.session.commit()
|
||||
flash("Thanks for your subscription!", "success")
|
||||
notify_admin(
|
||||
f"user {current_user.email} has finished subscription",
|
||||
f"plan: {plan}",
|
||||
f"user {current_user.email} has finished subscription {plan}"
|
||||
)
|
||||
return redirect(url_for("dashboard.index"))
|
||||
|
||||
|
|
|
@ -231,6 +231,9 @@ class User(db.Model, ModelMixin, UserMixin):
|
|||
names = self.name.split(" ")
|
||||
return "".join([n[0].upper() for n in names if n])
|
||||
|
||||
def __repr__(self):
|
||||
return f"<User {self.id} {self.name} {self.email}>"
|
||||
|
||||
|
||||
def _expiration_1h():
|
||||
return arrow.now().shift(hours=1)
|
||||
|
|
Loading…
Reference in a new issue