mirror of
https://github.com/simple-login/app.git
synced 2024-09-27 20:31:30 +02:00
Simplified method
This commit is contained in:
parent
4d07bc9d31
commit
9066116b7e
@ -8,6 +8,7 @@ from flask_wtf import FlaskForm
|
||||
from sqlalchemy import and_, func, case
|
||||
from wtforms import StringField, validators, ValidationError
|
||||
|
||||
# Need to import directly from config to allow modification from the tests
|
||||
from app import config
|
||||
from app.dashboard.base import dashboard_bp
|
||||
from app.db import Session
|
||||
@ -49,9 +50,7 @@ def email_validator():
|
||||
return _check
|
||||
|
||||
|
||||
def create_contact(
|
||||
user: User, alias: Alias, contact_address: str, fail_if_already_exist: bool = True
|
||||
) -> Contact:
|
||||
def create_contact(user: User, alias: Alias, contact_address: str) -> Contact:
|
||||
if not contact_address:
|
||||
raise ErrAddressInvalid("Empty address")
|
||||
try:
|
||||
@ -64,9 +63,7 @@ def create_contact(
|
||||
|
||||
contact = Contact.get_by(alias_id=alias.id, website_email=contact_email)
|
||||
if contact:
|
||||
if fail_if_already_exist:
|
||||
raise ErrContactAlreadyExists(contact)
|
||||
return contact
|
||||
|
||||
if config.DISABLE_CREATE_CONTACTS_FOR_FREE_USERS and (
|
||||
not user.is_premium() and user.flags & User.FLAG_FREE_DISABLE_CREATE_ALIAS > 0
|
||||
|
@ -1,6 +1,7 @@
|
||||
from flask import url_for
|
||||
import arrow
|
||||
|
||||
# Need to import directly from config to allow modification from the tests
|
||||
from app import config
|
||||
from app.db import Session
|
||||
from app.email_utils import is_reverse_alias
|
||||
|
Loading…
Reference in New Issue
Block a user