Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Privacy
Imprint
Contact
Login methods
Sign in
Toggle navigation
Menu
Open sidebar
ARSnova
arsnova-click-v2-frontend
Commits
719620eb
Commit
719620eb
authored
Dec 27, 2019
by
Christopher Mark Fullarton
Browse files
Improves login view if multiple login methods are possible
parent
f7ad04fb
Changes
2
Hide whitespace changes
Inline
Side-by-side
src/app/root/login/login.component.html
View file @
719620eb
...
...
@@ -35,9 +35,6 @@
<ng-container
*ngIf=
"hasTokenLogin"
>
<h6
*ngIf=
"hasMultipleLoginMethods"
class=
"mt-5"
>
{{'component.login.login-via-token' | translate}}
</h6>
<div
class=
"input-group"
>
<input
(keydown.enter)=
"login('token')"
...
...
src/app/root/login/login.component.ts
View file @
719620eb
...
...
@@ -19,9 +19,8 @@ export class LoginComponent implements OnInit, OnDestroy {
public
username
=
''
;
public
password
=
''
;
public
token
=
''
;
public
hasUsernamePasswordLogin
:
boolean
=
environment
.
loginMechanism
.
includes
(
LoginMechanism
.
UsernamePassword
);
public
hasTokenLogin
:
boolean
=
environment
.
loginMechanism
.
includes
(
LoginMechanism
.
Token
);
public
hasMultipleLoginMethods
:
boolean
=
environment
.
loginMechanism
.
length
>
1
;
public
hasUsernamePasswordLogin
:
boolean
;
public
hasTokenLogin
:
boolean
;
public
isLoggingIn
:
string
;
private
_authorizationFailed
=
false
;
...
...
@@ -44,7 +43,9 @@ export class LoginComponent implements OnInit, OnDestroy {
private
userService
:
UserService
,
private
router
:
Router
,
private
route
:
ActivatedRoute
,
private
headerLabelService
:
HeaderLabelService
,
private
footerBarService
:
FooterBarService
,
private
storageServie
:
StorageService
,
private
headerLabelService
:
HeaderLabelService
,
private
footerBarService
:
FooterBarService
,
private
storageServie
:
StorageService
,
)
{
this
.
userService
.
logout
();
this
.
headerLabelService
.
headerLabel
=
'
component.login.login
'
;
...
...
@@ -59,6 +60,13 @@ export class LoginComponent implements OnInit, OnDestroy {
}
this
.
_isLoading
=
false
;
this
.
return
=
decodeURI
(
params
[
'
return
'
]
||
'
%2F
'
);
this
.
hasTokenLogin
=
environment
.
loginMechanism
.
includes
(
LoginMechanism
.
Token
)
&&
this
.
return
.
includes
(
'
/quiz/create
'
);
this
.
hasUsernamePasswordLogin
=
environment
.
loginMechanism
.
includes
(
LoginMechanism
.
UsernamePassword
)
&&
!
this
.
hasTokenLogin
;
if
(
!
this
.
hasTokenLogin
&&
!
this
.
hasUsernamePasswordLogin
)
{
this
.
router
.
navigate
([
'
/
'
]);
}
});
}
...
...
@@ -72,6 +80,10 @@ export class LoginComponent implements OnInit, OnDestroy {
let
authenticated
=
false
;
this
.
isLoggingIn
=
method
;
this
.
username
=
this
.
username
.
trim
();
this
.
password
=
this
.
password
.
trim
();
this
.
token
=
this
.
token
.
trim
();
if
(
this
.
hasTokenLogin
&&
this
.
token
)
{
const
tokenHash
=
this
.
userService
.
hashToken
(
this
.
token
);
authenticated
=
await
this
.
userService
.
authenticateThroughLoginToken
(
tokenHash
);
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment