mirror of
https://github.com/cryptoadvance/specter-desktop.git
synced 2026-08-13 12:33:29 +02:00
Chore: Narrowing down authentication problems with a Cypress test (#2205)
* killing info on auth page * use explicit url for endpoint * cypress test for changing auth and logging in
This commit is contained in:
parent
995e8ab7f0
commit
b48ad80e00
3 changed files with 26 additions and 11 deletions
|
|
@ -18,6 +18,24 @@ describe('Completely empty specter-home', () => {
|
|||
cy.get('#btn_plugins').click()
|
||||
cy.contains("Plugins in Production")
|
||||
})
|
||||
|
||||
it('Setup password protection', () => {
|
||||
cy.get('[data-cy="settings-btn"]').click()
|
||||
cy.contains('Authentication').click()
|
||||
cy.get('[data-cy="authentication-selection"]').select('Password Protection')
|
||||
cy.get('[data-cy="admin-password-input"]').type('satoshi')
|
||||
cy.get('[data-cy="save-auth-settings-btn"]').click()
|
||||
cy.contains('Admin password successfully updated')
|
||||
})
|
||||
|
||||
it('Login with password and deactivate password protection again', () => {
|
||||
cy.get('[data-cy="admin-password"]').type('satoshi')
|
||||
cy.get('[data-cy="login-btn"]').click()
|
||||
cy.get('[data-cy="settings-btn"]').click()
|
||||
cy.contains('Authentication').click()
|
||||
cy.get('[data-cy="authentication-selection"]').select('None')
|
||||
cy.get('[data-cy="save-auth-settings-btn"]').click()
|
||||
})
|
||||
})
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -10,11 +10,11 @@
|
|||
{% if specter.config['auth']['method'] == 'usernamepassword' %}
|
||||
<input id="username" class="form-control" placeholder="{{ _('Username') }}" name="username" type="text" value=""><br><br>
|
||||
{% endif %}
|
||||
<input id="password" class="form-control" placeholder="{{ _('Password') }}" name="password" type="password" value="">
|
||||
<input id="password" class="form-control" placeholder="{{ _('Password') }}" name="password" type="password" value="" data-cy="admin-password">
|
||||
<input type="hidden" name="next" value="{{ data.next }}">
|
||||
<input type="hidden" class="csrf-token" name="csrf_token" value="{{ csrf_token() }}"/>
|
||||
<div class="row">
|
||||
<button type="submit" id="login-btn" class="button text-white bg-accent">{{ _("Login") }}</button>
|
||||
<button type="submit" id="login-btn" class="button text-white bg-accent" data-cy="login-btn">{{ _("Login") }}</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
{% extends "base.jinja" %}
|
||||
|
||||
{% block main %}
|
||||
<form action="?" method="POST">
|
||||
<form action="{{ url_for('settings_endpoint.auth') }}" method="POST">
|
||||
<input type="hidden" class="csrf-token" name="csrf_token" value="{{ csrf_token() }}"/>
|
||||
<input type="hidden" name="next" value="{{ next }}">
|
||||
|
||||
|
|
@ -12,7 +12,7 @@
|
|||
<div class="mt-8 space-y-3">
|
||||
{% if method == "none" or current_user.is_admin %}
|
||||
<div class="floating-wrapper">
|
||||
<select name="method" class="floating-input" onchange="toggleUsernamePassword(this)">
|
||||
<select name="method" class="floating-input" onchange="toggleUsernamePassword(this)" data-cy="authentication-selection">
|
||||
<option value="none" {% if method=="none" %} selected="selected"{% endif %}>{{ _("None") }}</option>
|
||||
<option value="passwordonly" {% if method=="passwordonly" %} selected="selected"{% endif %}>{{ _("Password Protection") }}</option>
|
||||
<option value="usernamepassword" {% if method=="usernamepassword" %} selected="selected"{% endif %}>{{ _("Multiple Users") }}</option>
|
||||
|
|
@ -26,8 +26,7 @@
|
|||
<svg class="flex-shrink-0 inline w-6 h-6 mr-3" version="1.1" viewBox="0 0 64 64" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"><!--Generated by IJSVG (https://github.com/iconjar/IJSVG)--><path d="M32.0022,55.9844l-1.04907e-06,-2.84217e-14c-13.2548,-5.79387e-07 -24,-10.7452 -24,-24c5.79387e-07,-13.2548 10.7452,-24 24,-24c13.2548,5.79387e-07 24,10.7452 24,24l2.13163e-14,-1.04907e-06c0,13.2548 -10.7452,24 -24,24Zm1.5,-32l3.82016e-08,-2.71086e-09c-1.79133,0.127116 -3.35165,-1.21031 -3.5,-3l6.50646e-08,-7.8524e-07c0.148296,-1.78972 1.70866,-3.12717 3.5,-3l-5.85322e-09,4.15529e-10c1.79134,-0.127171 3.3517,1.21028 3.5,3l-5.57104e-08,6.72365e-07c-0.148295,1.78976 -1.70872,3.12723 -3.5001,3Zm1.4206,6.7635l-2.7853,10.5093l-8.37179e-08,3.15667e-07c-0.270677,1.02062 0.262417,2.08281 1.2425,2.4757l-5.91015e-08,-2.36708e-08c0.379505,0.151996 0.628277,0.519688 0.6282,0.9285v0.323l8.52651e-14,4.05e-07c0,0.551933 -0.447167,0.999503 -0.9991,1h-2.9891l-4.04477e-08,1.96948e-10c-1.65938,0.00807986 -3.01111,-1.33056 -3.01919,-2.98993c-0.00127082,-0.260991 0.0314695,-0.521035 0.0973943,-0.773566l2.7852,-10.5094l2.79671e-08,-1.05468e-07c0.270652,-1.02067 -0.262537,-2.08289 -1.2427,-2.4757l-2.20542e-08,-8.83296e-09c-0.379505,-0.151996 -0.628276,-0.519688 -0.6282,-0.9285v-0.3229l-1.77636e-14,-9.40042e-08c-8.33514e-08,-0.552011 0.447289,-0.999614 0.9993,-1h2.9887l1.06497e-07,-5.28143e-10c1.65943,-0.00822943 3.01133,1.33033 3.01956,2.98976c0.00129458,0.261047 -0.0314356,0.52115 -0.0973639,0.773738Z" fill="currentColor" fill-rule="evenodd"></path></svg>
|
||||
<span class="sr-only">Info</span>
|
||||
<div>
|
||||
<span class="font-medium">Info: </span>
|
||||
{{ _("Note: If you set Authentication to \"None\", Specter will unlink the Service integrations ") }}
|
||||
{{ _("If you set Authentication to \"None\", Specter will unlink the Service integrations ") }}
|
||||
"{{ specter.service_manager.services_sorted | selectattr('encrypt_data') | map(attribute='name') | join('", "') }}"
|
||||
{{ _(" as a security precaution.") }}
|
||||
</div>
|
||||
|
|
@ -40,7 +39,7 @@
|
|||
|
||||
<div id="passwordonly" class="{% if method != 'passwordonly' %}hidden{% endif %}">
|
||||
<div class="floating-wrapper">
|
||||
<input class="floating-input peer"id="specter_password_only" type="password" name="specter_password_only" placeholder=" ">
|
||||
<input class="floating-input peer"id="specter_password_only" type="password" name="specter_password_only" placeholder=" " data-cy="admin-password-input">
|
||||
<label class="floating-label"for="specter_password_only">{{ _("Specter Password") }}</label>
|
||||
</div>
|
||||
|
||||
|
|
@ -48,7 +47,6 @@
|
|||
<svg class="flex-shrink-0 inline w-6 h-6 mr-3" version="1.1" viewBox="0 0 64 64" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"><!--Generated by IJSVG (https://github.com/iconjar/IJSVG)--><path d="M32.0022,55.9844l-1.04907e-06,-2.84217e-14c-13.2548,-5.79387e-07 -24,-10.7452 -24,-24c5.79387e-07,-13.2548 10.7452,-24 24,-24c13.2548,5.79387e-07 24,10.7452 24,24l2.13163e-14,-1.04907e-06c0,13.2548 -10.7452,24 -24,24Zm1.5,-32l3.82016e-08,-2.71086e-09c-1.79133,0.127116 -3.35165,-1.21031 -3.5,-3l6.50646e-08,-7.8524e-07c0.148296,-1.78972 1.70866,-3.12717 3.5,-3l-5.85322e-09,4.15529e-10c1.79134,-0.127171 3.3517,1.21028 3.5,3l-5.57104e-08,6.72365e-07c-0.148295,1.78976 -1.70872,3.12723 -3.5001,3Zm1.4206,6.7635l-2.7853,10.5093l-8.37179e-08,3.15667e-07c-0.270677,1.02062 0.262417,2.08281 1.2425,2.4757l-5.91015e-08,-2.36708e-08c0.379505,0.151996 0.628277,0.519688 0.6282,0.9285v0.323l8.52651e-14,4.05e-07c0,0.551933 -0.447167,0.999503 -0.9991,1h-2.9891l-4.04477e-08,1.96948e-10c-1.65938,0.00807986 -3.01111,-1.33056 -3.01919,-2.98993c-0.00127082,-0.260991 0.0314695,-0.521035 0.0973943,-0.773566l2.7852,-10.5094l2.79671e-08,-1.05468e-07c0.270652,-1.02067 -0.262537,-2.08289 -1.2427,-2.4757l-2.20542e-08,-8.83296e-09c-0.379505,-0.151996 -0.628276,-0.519688 -0.6282,-0.9285v-0.3229l-1.77636e-14,-9.40042e-08c-8.33514e-08,-0.552011 0.447289,-0.999614 0.9993,-1h2.9887l1.06497e-07,-5.28143e-10c1.65943,-0.00822943 3.01133,1.33033 3.01956,2.98976c0.00129458,0.261047 -0.0314356,0.52115 -0.0973639,0.773738Z" fill="currentColor" fill-rule="evenodd"></path></svg>
|
||||
<span class="sr-only">Info</span>
|
||||
<div>
|
||||
<span class="font-medium">Info: </span>
|
||||
{{ _("Default password is 'admin'") }}
|
||||
</div>
|
||||
</div>
|
||||
|
|
@ -66,7 +64,6 @@
|
|||
<svg class="flex-shrink-0 inline w-6 h-6 mr-3" version="1.1" viewBox="0 0 64 64" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"><!--Generated by IJSVG (https://github.com/iconjar/IJSVG)--><path d="M32.0022,55.9844l-1.04907e-06,-2.84217e-14c-13.2548,-5.79387e-07 -24,-10.7452 -24,-24c5.79387e-07,-13.2548 10.7452,-24 24,-24c13.2548,5.79387e-07 24,10.7452 24,24l2.13163e-14,-1.04907e-06c0,13.2548 -10.7452,24 -24,24Zm1.5,-32l3.82016e-08,-2.71086e-09c-1.79133,0.127116 -3.35165,-1.21031 -3.5,-3l6.50646e-08,-7.8524e-07c0.148296,-1.78972 1.70866,-3.12717 3.5,-3l-5.85322e-09,4.15529e-10c1.79134,-0.127171 3.3517,1.21028 3.5,3l-5.57104e-08,6.72365e-07c-0.148295,1.78976 -1.70872,3.12723 -3.5001,3Zm1.4206,6.7635l-2.7853,10.5093l-8.37179e-08,3.15667e-07c-0.270677,1.02062 0.262417,2.08281 1.2425,2.4757l-5.91015e-08,-2.36708e-08c0.379505,0.151996 0.628277,0.519688 0.6282,0.9285v0.323l8.52651e-14,4.05e-07c0,0.551933 -0.447167,0.999503 -0.9991,1h-2.9891l-4.04477e-08,1.96948e-10c-1.65938,0.00807986 -3.01111,-1.33056 -3.01919,-2.98993c-0.00127082,-0.260991 0.0314695,-0.521035 0.0973943,-0.773566l2.7852,-10.5094l2.79671e-08,-1.05468e-07c0.270652,-1.02067 -0.262537,-2.08289 -1.2427,-2.4757l-2.20542e-08,-8.83296e-09c-0.379505,-0.151996 -0.628276,-0.519688 -0.6282,-0.9285v-0.3229l-1.77636e-14,-9.40042e-08c-8.33514e-08,-0.552011 0.447289,-0.999614 0.9993,-1h2.9887l1.06497e-07,-5.28143e-10c1.65943,-0.00822943 3.01133,1.33033 3.01956,2.98976c0.00129458,0.261047 -0.0314356,0.52115 -0.0973639,0.773738Z" fill="currentColor" fill-rule="evenodd"></path></svg>
|
||||
<span class="sr-only">Info</span>
|
||||
<div>
|
||||
<span class="font-medium">Info: </span>
|
||||
{{ _("Default username is 'admin', password 'admin'.") }}
|
||||
</div>
|
||||
</div>
|
||||
|
|
@ -80,7 +77,7 @@
|
|||
|
||||
<div class="floating-wrapper grow">
|
||||
<input class="floating-input peer" id="specter_password" type="password" name="specter_password" type="text" placeholder=" ">
|
||||
<label class="floating-label" for"specter_password">{{ _("Specter Password") }}</label>
|
||||
<label class="floating-label" for="specter_password">{{ _("Specter Password") }}</label>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
|
@ -111,7 +108,7 @@
|
|||
</div>
|
||||
|
||||
<div class="mt-8">
|
||||
<button type="submit" id="submit-btn" class="button bg-accent text-white" name="action" value="save">{{ _("Save") }}</button>
|
||||
<button type="submit" id="submit-btn" class="button bg-accent text-white" name="action" value="save" data-cy="save-auth-settings-btn">{{ _("Save") }}</button>
|
||||
</div>
|
||||
</form>
|
||||
{% endblock %}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue