mirror of
https://github.com/cwinfo/powerdns-admin.git
synced 2024-12-04 19:15:30 +00:00
Fix migration script and LGTM
This commit is contained in:
parent
7739bf7cfc
commit
4bdd433079
@ -17,12 +17,10 @@ depends_on = None
|
||||
|
||||
|
||||
def upgrade():
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
op.add_column('user', sa.Column('confirmed', sa.Boolean(), nullable=True))
|
||||
# ### end Alembic commands ###
|
||||
with op.batch_alter_table('user') as batch_op:
|
||||
batch_op.add_column(sa.Column('confirmed', sa.Boolean()))
|
||||
|
||||
|
||||
def downgrade():
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
op.drop_column('user', 'confirmed')
|
||||
# ### end Alembic commands ###
|
||||
with op.batch_alter_table('user') as batch_op:
|
||||
batch_op.drop_column('confirmed')
|
||||
|
@ -26,7 +26,7 @@ class User(db.Model):
|
||||
lastname = db.Column(db.String(64))
|
||||
email = db.Column(db.String(128))
|
||||
otp_secret = db.Column(db.String(16))
|
||||
confirmed = db.Column(db.Boolean, default=False)
|
||||
confirmed = db.Column(db.SmallInteger, default=0)
|
||||
role_id = db.Column(db.Integer, db.ForeignKey('role.id'))
|
||||
|
||||
def __init__(self,
|
||||
|
@ -446,7 +446,7 @@ def confirm_email(token):
|
||||
return render_template('email_confirmation.html', status=2)
|
||||
else:
|
||||
# Confirm email is valid
|
||||
user.update_confirmed(confirmed=True)
|
||||
user.update_confirmed(confirmed=1)
|
||||
current_app.logger.info(
|
||||
"User email {} confirmed successfully".format(email))
|
||||
return render_template('email_confirmation.html', status=1)
|
||||
|
@ -13,6 +13,7 @@ def confirm_token(token, expiration=86400):
|
||||
email = serializer.loads(token,
|
||||
salt=current_app.config['SALT'],
|
||||
max_age=expiration)
|
||||
except:
|
||||
except Exception as e:
|
||||
current_app.logger.debug(e)
|
||||
return False
|
||||
return email
|
||||
|
@ -157,6 +157,7 @@
|
||||
bgcolor="#3498db"> <a
|
||||
href="{{ verification_link }}"
|
||||
target="_blank"
|
||||
rel="noopener noreferrer"
|
||||
style="border: solid 1px #3498db; border-radius: 5px; box-sizing: border-box; cursor: pointer; display: inline-block; font-size: 14px; font-weight: bold; margin: 0; padding: 12px 25px; text-decoration: none; text-transform: capitalize; background-color: #3498db; border-color: #3498db; color: #ffffff;">Verify
|
||||
Email Address</a> </td>
|
||||
</tr>
|
||||
@ -194,7 +195,7 @@
|
||||
<span class="apple-link"
|
||||
style="color: #999999; font-size: 12px; text-align: center;">This email was sent
|
||||
from <a href="{{ SETTING.get('site_url') }}"
|
||||
target="_blank">{{ SITE_NAME }}</a></span>
|
||||
target="_blank" rel="noopener noreferrer">{{ SITE_NAME }}</a></span>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
|
Loading…
Reference in New Issue
Block a user