mirror of
https://github.com/simple-login/app.git
synced 2024-11-16 08:58:30 +01:00
remove >3 characters on alias prefix
This commit is contained in:
parent
6e387444f5
commit
ca05cd359a
4 changed files with 14 additions and 11 deletions
|
@ -37,7 +37,7 @@ def new_custom_alias():
|
||||||
alias_prefix = data["alias_prefix"]
|
alias_prefix = data["alias_prefix"]
|
||||||
alias_suffix = data["alias_suffix"]
|
alias_suffix = data["alias_suffix"]
|
||||||
|
|
||||||
# make sure alias_prefix is more than 3 chars
|
# make sure alias_prefix is not empty
|
||||||
alias_prefix = alias_prefix.strip()
|
alias_prefix = alias_prefix.strip()
|
||||||
alias_prefix = convert_to_id(alias_prefix)
|
alias_prefix = convert_to_id(alias_prefix)
|
||||||
if not alias_prefix: # should be checked on frontend
|
if not alias_prefix: # should be checked on frontend
|
||||||
|
|
|
@ -39,7 +39,7 @@
|
||||||
</div>
|
</div>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
||||||
{% block script %}
|
{% block script %}
|
||||||
|
|
|
@ -18,16 +18,17 @@
|
||||||
<input type="hidden" name="form-name" value="non-custom-domain-name">
|
<input type="hidden" name="form-name" value="non-custom-domain-name">
|
||||||
|
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label class="form-label font-weight-bold">SimpleLogin domain</label>
|
<label class="form-label font-weight-bold">With SimpleLogin domain</label>
|
||||||
<small class="text-muted">
|
<small class="text-muted">
|
||||||
You can use letter, number or dash. Alias must have at least 3 characters
|
You can use letter, number or dash. Alias prefix cannot be empty.
|
||||||
</small>
|
</small>
|
||||||
|
|
||||||
<div class="row mt-4">
|
<div class="row mt-4">
|
||||||
<div class="col">
|
<div class="col">
|
||||||
<input name="email-prefix" class="form-control" pattern="[0-9|A-Z|a-z|-]{3,}"
|
<input name="email-prefix" class="form-control" pattern="[0-9|A-Z|a-z|-]{1,}"
|
||||||
title="Only letter, number or dash can be used and alias must have at least 3 characters."
|
title="Only letter, number or dash can be used."
|
||||||
autofocus>
|
placeholder="alias prefix"
|
||||||
|
autofocus required>
|
||||||
</div>
|
</div>
|
||||||
<div class="col align-self-center">
|
<div class="col align-self-center">
|
||||||
<input type="hidden" name="email-suffix" value="{{ email_suffix }}">
|
<input type="hidden" name="email-suffix" value="{{ email_suffix }}">
|
||||||
|
@ -35,10 +36,12 @@
|
||||||
.{{ email_suffix }}@{{ EMAIL_DOMAIN }}
|
.{{ email_suffix }}@{{ EMAIL_DOMAIN }}
|
||||||
</h4>
|
</h4>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<div class="col">
|
||||||
|
<button class="btn btn-primary btn-sm">Create</button>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<button class="btn btn-primary">Create</button>
|
|
||||||
</form>
|
</form>
|
||||||
|
|
||||||
{% if custom_domains %}
|
{% if custom_domains %}
|
||||||
|
|
|
@ -28,8 +28,8 @@ def custom_alias():
|
||||||
email_prefix = convert_to_id(email_prefix)
|
email_prefix = convert_to_id(email_prefix)
|
||||||
email_suffix = request.form.get("email-suffix")
|
email_suffix = request.form.get("email-suffix")
|
||||||
|
|
||||||
if len(email_prefix) < 3:
|
if not email_prefix:
|
||||||
error = "email must be at least 3 letters"
|
error = "alias prefix cannot be empty"
|
||||||
else:
|
else:
|
||||||
full_email = f"{email_prefix}.{email_suffix}@{EMAIL_DOMAIN}"
|
full_email = f"{email_prefix}.{email_suffix}@{EMAIL_DOMAIN}"
|
||||||
# check if email already exists
|
# check if email already exists
|
||||||
|
|
Loading…
Reference in a new issue