Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
open-source
MetaGer
Commits
26ca361b
Commit
26ca361b
authored
Nov 10, 2020
by
Davide Aprea
Browse files
removed redirect to start page when sending key
parent
95845942
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
app/Http/Controllers/KeyController.php
View file @
26ca361b
...
...
@@ -12,9 +12,20 @@ class KeyController extends Controller
{
$redirUrl
=
$request
->
input
(
'redirUrl'
,
""
);
return
view
(
'key'
)
->
with
(
'title'
,
trans
(
'titles.key'
));
$cookie
=
Cookie
::
get
(
'key'
);
$key
=
$request
->
input
(
'key'
,
''
);
if
(
empty
(
$key
)
&&
empty
(
$cookie
)){
$key
=
'enter_key_here'
;
}
elseif
(
empty
(
$key
)
&&
!
empty
(
$cookie
)){
$key
=
$cookie
;
}
elseif
(
!
empty
(
$key
)){
$key
=
$request
->
input
(
'key'
);
}
return
view
(
'key'
)
->
with
(
'title'
,
trans
(
'titles.key'
))
->
with
(
'cookie'
,
$key
);
}
public
function
setKey
(
Request
$request
)
...
...
@@ -29,12 +40,24 @@ class KeyController extends Controller
$host
=
$request
->
header
(
"Host"
,
""
);
}
Cookie
::
queue
(
'key'
,
$key
,
525600
,
'/'
,
null
,
false
,
false
);
return
redirect
(
$redirUrl
);
$cookie
=
Cookie
::
get
(
'key'
);
if
(
empty
(
$key
)
&&
empty
(
$cookie
)){
$key
=
'enter_key_here'
;
}
elseif
(
empty
(
$key
)
&&
!
empty
(
$cookie
)){
$key
=
$cookie
;
}
elseif
(
!
empty
(
$key
)){
$key
=
$request
->
input
(
'key'
);
}
return
view
(
'key'
)
->
with
(
'title'
,
trans
(
'titles.key'
))
->
with
(
'cookie'
,
$key
);
}
else
{
return
view
(
'key'
)
->
with
(
'title'
,
trans
(
'titles.key'
))
->
with
(
'keyValid'
,
false
);
->
with
(
'keyValid'
,
false
)
->
with
(
'cookie'
,
'enter_key_here'
);
}
}
...
...
resources/views/key.blade.php
View file @
26ca361b
...
...
@@ -24,7 +24,7 @@
<
li
>
@
lang
(
'key.li1'
)
<
div
class
=
"copyLink"
>
<
input
id
=
"loadSettings"
class
=
"loadSettings"
type
=
"text"
value
=
"{{route('loadSettings', ["
key
" =>
empty(Cookie::get('key')) ? "
enter_key_here
" : Cookie::get('key')
])}}"
>
<
input
id
=
"loadSettings"
class
=
"loadSettings"
type
=
"text"
value
=
"{{route('loadSettings', ["
key
" =>
$cookie
])}}"
>
<
button
class
=
"js-only btn btn-default"
onclick
=
"var copyText = document.getElementById('loadSettings');copyText.select();copyText.setSelectionRange(0, 99999);document.execCommand('copy');"
>@
lang
(
'settings.copy'
)
</
button
>
</
div
>
</
li
>
...
...
@@ -32,7 +32,7 @@
<
li
>
@
lang
(
'key.li2'
)
<
div
class
=
"copyLink"
>
<
input
id
=
"searchString"
class
=
"loadSettings"
type
=
"text"
value
=
"{{route("
resultpage
", ["
key
" =>
empty(Cookie::get('key')) ? "
enter_key_here
" : Cookie::get('key')
]) . "
&
eingabe
=%
s
"}}"
>
<
input
id
=
"searchString"
class
=
"loadSettings"
type
=
"text"
value
=
"{{route("
resultpage
", ["
key
" =>
$cookie
]) . "
&
eingabe
=%
s
"}}"
>
<
button
class
=
"js-only btn btn-default"
onclick
=
"var copyText = document.getElementById('searchString');copyText.select();copyText.setSelectionRange(0, 99999);document.execCommand('copy');"
>@
lang
(
'settings.copy'
)
</
button
>
</
div
>
</
li
>
...
...
@@ -42,10 +42,10 @@
<
div
id
=
"form-wrapper"
>
<
form
method
=
"post"
>
<
input
type
=
"hidden"
name
=
"redirUrl"
value
=
"{{ Request::input('redirUrl', '') }}"
/>
<
input
type
=
"text"
name
=
"key"
value
=
"
{
{
C
ookie
::get('key')
}
}
"
placeholder
=
"@lang('key.placeholder1')"
autofocus
>
<
input
type
=
"text"
name
=
"key"
value
=
"{{
$c
ookie
=== 'enter_key_here' ? '' :
$cookie
}}"
placeholder
=
"@lang('key.placeholder1')"
autofocus
>
<
button
type
=
"submit"
class
=
"btn btn-success"
>
OK
</
button
>
</
form
>
@
if
(
C
ookie
::
get
(
'key'
)
!==
NULL
)
@
if
(
$c
ookie
!==
'enter_key_here'
)
<
form
method
=
"post"
action
=
"{{ LaravelLocalization::getLocalizedURL(LaravelLocalization::getCurrentLocale(), action('KeyController@removeKey', ['redirUrl' => url()->full()])) }}"
>
<
input
type
=
"hidden"
name
=
"redirUrl"
value
=
"{{ Request::input('redirUrl', '') }}"
/>
<
button
type
=
"submit"
class
=
"btn btn-default"
>@
lang
(
'key.removeKey'
)
</
button
>
...
...
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