Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
I
imageboard-web
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Trirst
imageboard-web
Commits
9177f51f
Commit
9177f51f
authored
Jun 24, 2021
by
Trirst
Browse files
Options
Downloads
Patches
Plain Diff
Expose authentication's states to UI
parent
3362b1f5
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/components/UserAuthentication.vue
+50
-38
50 additions, 38 deletions
src/components/UserAuthentication.vue
with
50 additions
and
38 deletions
src/components/UserAuthentication.vue
+
50
−
38
View file @
9177f51f
<
template
>
<div>
<div
v-if=
"!stateUser.id"
>
<button
v-if=
"!loggingIn"
@
click=
"loggingIn = true"
...
...
@@ -14,6 +15,9 @@
Authenticate
</button>
<div
v-if=
"loggingIn"
>
<div
v-if=
"loggingFailed"
>
Authentication failed. Please check your secret token.
</div>
<input
type=
"text"
placeholder=
"Secret token"
...
...
@@ -33,12 +37,20 @@
<button
@
click=
"authenticate(secret.trim())"
>
<Checkmark
width=
"30"
height=
"30"
class=
"login-button"
></Checkmark>
</button>
<button
@
click=
"loggingIn = false"
>
<button
@
click=
"
loggingIn = false;
loggingFailed = false;
secret = '';
"
>
<XCircle
width=
"30"
height=
"30"
class=
"login-button"
></XCircle>
</button>
</span>
</div>
</div>
<div
v-else
>
Welcome,
{{
stateUser
.
username
}}
</div>
</div>
</
template
>
<
script
>
...
...
@@ -53,11 +65,12 @@ export default {
data
:
function
()
{
return
{
loggingIn
:
false
,
loggingFailed
:
false
,
secret
:
""
,
};
},
computed
:
{
...
mapState
([
'
stateUser
'
])
...
mapState
([
"
stateUser
"
])
,
},
methods
:
{
async
authenticate
(
secret
)
{
...
...
@@ -73,9 +86,8 @@ export default {
username
:
data
.
username
,
secret
,
});
console
.
log
(
"
Authenticated successfully
"
);
}
else
{
console
.
error
(
"
Authenticated failed
"
)
;
this
.
loggingFailed
=
true
;
}
}
catch
{
(
error
)
=>
console
.
error
(
"
Something went terribly wrong...
"
,
error
);
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment