Reintroduce email support for login (fixes #165; reverts #e208d30513f7cfafb6405324fee5b88902dcf2fb) - 2
Change-Id: Ia145f1e47295e2e5df0248604262024f87583bab
diff --git a/t/plugin/auth.t b/t/plugin/auth.t
index 4ea6a2f..db19a36 100644
--- a/t/plugin/auth.t
+++ b/t/plugin/auth.t
@@ -50,12 +50,12 @@
$t->get_ok('/')
->status_is(200)
- ->element_exists('form[action=/user/login] input[name=handle]')
+ ->element_exists('form[action=/user/login] input[name=handle_or_email]')
->element_exists('aside.active')
->element_exists_not('aside.off')
;
-$t->post_ok('/user/login' => form => { handle => 'test', pwd => 'fail' })
+$t->post_ok('/user/login' => form => { handle_or_email => 'test', pwd => 'fail' })
->status_is(302)
->header_is('Location' => '/');
@@ -63,11 +63,11 @@
->status_is(200)
->element_exists('div.notify-error')
->text_is('div.notify-error', 'Bad CSRF token')
- ->element_exists('input[name=handle][value=test]')
+ ->element_exists('input[name=handle_or_email][value=test]')
->element_exists_not('div.button.top a')
;
-$t->post_ok('/user/login' => form => { handle => 'test', pwd => 'pass' })
+$t->post_ok('/user/login' => form => { handle_or_email => 'test', pwd => 'pass' })
->status_is(302)
->header_is('Location' => '/');
@@ -80,7 +80,7 @@
;
$t->post_ok('/user/login' => form => {
- handle => 'test',
+ handle_or_email => 'test',
pwd => 'ldaperr',
csrf_token => $csrf
})
@@ -92,13 +92,13 @@
->status_is(200)
->element_exists('div.notify-error')
->text_is('div.notify-error', '2022: LDAP Authentication failed due to unknown user or password!')
- ->element_exists('input[name=handle][value=test]')
+ ->element_exists('input[name=handle_or_email][value=test]')
->element_exists_not('div.button.top a')
->tx->res->dom->at('input[name=csrf_token]')->attr('value')
;
$t->post_ok('/user/login' => form => {
- handle => 'test',
+ handle_or_email => 'test',
pwd => 'unknown',
csrf_token => $csrf
})
@@ -110,13 +110,13 @@
->status_is(200)
->element_exists('div.notify-error')
->text_is('div.notify-error', 'Access denied')
- ->element_exists('input[name=handle][value=test]')
+ ->element_exists('input[name=handle_or_email][value=test]')
->element_exists_not('div.button.top a')
->tx->res->dom->at('input[name=csrf_token]')->attr('value')
;
$t->post_ok('/user/login' => form => {
- handle => 'test',
+ handle_or_email => 'test',
pwd => 'pass',
csrf_token => $csrf
})
@@ -175,7 +175,7 @@
is($fwd, '/?q=Baum&ql=poliqarp', 'Redirect is valid');
$t->post_ok('/user/login' => form => {
- handle => 'test',
+ handle_or_email => 'test',
pwd => 'pass',
csrf_token => $csrf,
fwd => 'http://bad.example.com/test'
@@ -191,7 +191,7 @@
;
$t->post_ok('/user/login' => form => {
- handle => 'test',
+ handle_or_email => 'test',
pwd => 'pass',
csrf_token => $csrf,
fwd => $fwd