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
La Quadrature du Net
persona-non-google
Commits
dbc87c8a
Commit
dbc87c8a
authored
Sep 02, 2021
by
Barış Soner Uşaklı
Browse files
feat: login/register widget areas
parent
41d6b558
Changes
3
Hide whitespace changes
Inline
Side-by-side
library.js
View file @
dbc87c8a
...
...
@@ -25,6 +25,7 @@ library.defineWidgetAreas = async function (areas) {
const
templates
=
[
'
categories.tpl
'
,
'
category.tpl
'
,
'
topic.tpl
'
,
'
users.tpl
'
,
'
unread.tpl
'
,
'
recent.tpl
'
,
'
popular.tpl
'
,
'
top.tpl
'
,
'
tags.tpl
'
,
'
tag.tpl
'
,
'
login.tpl
'
,
'
register.tpl
'
,
];
function
capitalizeFirst
(
str
)
{
return
str
.
charAt
(
0
).
toUpperCase
()
+
str
.
slice
(
1
);
...
...
templates/login.tpl
View file @
dbc87c8a
<!-- IMPORT partials/breadcrumbs.tpl -->
<div
data-widget-area=
"header"
>
{{
{
each
widgets
.
header
}
}}
{
{
widgets
.
header
.
html
}
}
{{
{
end
}
}}
</div>
<div
class=
"row login"
>
<div
class=
"row {{{ if widgets.sidebar.length }}}col-lg-9 col-sm-12{{{ else }}}col-lg-12{{{ end }}}"
>
{{{ if allowLocalLogin }}}
<div
class=
"{{{ if alternate_logins }}}col-md-6{{{ else }}}col-md-12{{{ end }}}"
>
<div
class=
"login-block"
>
<div
class=
"alert alert-danger"
id=
"login-error-notify"
<!
--
IF
error
--
>
style="display:block"
<!-- ELSE -->
style="display: none;"
<!-- ENDIF error -->
>
<button
type=
"button"
class=
"close"
data-dismiss=
"alert"
>
×
</button>
<strong>
[[login:failed_login_attempt]]
</strong>
<p>
{
error
}
</p>
</div>
<div
class=
"row"
>
<!-- IF allowLocalLogin -->
<div
class=
"<!-- IF alternate_logins -->col-md-6<!-- ELSE -->col-md-12<!-- ENDIF alternate_logins -->"
>
<div
class=
"login-block"
>
<div
class=
"alert alert-danger"
id=
"login-error-notify"
<!
--
IF
error
--
>
style="display:block"
<!-- ELSE -->
style="display: none;"
<!-- ENDIF error -->
>
<button
type=
"button"
class=
"close"
data-dismiss=
"alert"
>
×
</button>
<strong>
[[login:failed_login_attempt]]
</strong>
<p>
{
error
}
</p>
</div>
<form
class=
"form-horizontal"
role=
"form"
method=
"post"
id=
"login-form"
>
<div
class=
"form-group"
>
<label
for=
"username"
class=
"col-lg-2 control-label"
>
{
allowLoginWith
}
</label>
<div
class=
"col-lg-10"
>
<input
class=
"form-control"
type=
"text"
placeholder=
"
{
allowLoginWith
}
"
name=
"username"
id=
"username"
autocorrect=
"off"
autocapitalize=
"off"
value=
"
{
username
}
"
/>
<form
class=
"form-horizontal"
role=
"form"
method=
"post"
id=
"login-form"
>
<div
class=
"form-group"
>
<label
for=
"username"
class=
"col-lg-2 control-label"
>
{
allowLoginWith
}
</label>
<div
class=
"col-lg-10"
>
<input
class=
"form-control"
type=
"text"
placeholder=
"
{
allowLoginWith
}
"
name=
"username"
id=
"username"
autocorrect=
"off"
autocapitalize=
"off"
value=
"
{
username
}
"
/>
</div>
</div>
<
/
div>
<div
class=
"form-group"
>
<label
for=
"password"
class=
"col-lg-2 control-label"
>
[[user:password]]
</label
>
<div
class=
"col-lg-10"
>
<input
class=
"form-control"
type=
"password"
placeholder=
"[[user:password]]"
name=
"password"
id=
"password"
<!
--
IF
username
--
>
autocomplete="off"
<!-- ENDIF username -->
/
>
<p
id=
"caps-lock-warning"
class=
"text-danger hidden"
>
<
i
class=
"fa fa-exclamation-triangle"
></i>
[[login:caps-lock-enabled]]
</
p
>
<div
class=
"form-group"
>
<label
for=
"password"
class=
"col-lg-2 control-label"
>
[[user:password]]
</label
>
<div
class=
"col-lg-10"
>
<input
class=
"form-control"
type=
"password"
placeholder=
"[[user:password]]"
name=
"password"
id=
"password"
<!
--
IF
username
--
>
autocomplete="off"
<!-- ENDIF username -->
/
>
<p
id=
"caps-lock-warning"
class=
"text-danger hidden"
>
<i
class=
"fa fa-exclamation-triangle"
></i>
[[login:caps-lock-enabled]]
<
/p>
</
div
>
</div>
<
/
div>
<div
class=
"
form-group
"
>
<div
class=
"c
ol-lg-offset-2 col-lg-10
"
>
<div
class=
"checkbox"
>
<label>
<
input
type=
"checkbox"
name=
"remember"
id=
"remember"
checked
/>
[[login:remember_me]]
</
label
>
<div
class=
"form-group"
>
<div
class=
"
col-lg-offset-2 col-lg-10
"
>
<div
class=
"c
heckbox
"
>
<label
>
<input
type=
"checkbox"
name=
"remember"
id=
"remember"
checked
/>
[[login:remember_me]]
<
/label>
</
div
>
</div>
</div>
</div>
{{
{
each
loginFormEntry
}
}}
<div
class=
"form-group loginFormEntry"
>
<label
for=
"login-
{
loginFormEntry
.
styleName
}
"
class=
"col-lg-4 control-label"
>
{
loginFormEntry
.
label
}
</label>
<div
id=
"login-
{
loginFormEntry
.
styleName
}
"
class=
"col-lg-8"
>
{
{
loginFormEntry
.
html
}
}
</div>
</div>
{{
{
end
}
}}
<input
type=
"hidden"
name=
"_csrf"
value=
"
{
config
.
csrf_token
}
"
/>
<input
type=
"hidden"
name=
"noscript"
id=
"noscript"
value=
"true"
/>
<div
class=
"form-group"
>
<div
class=
"col-lg-offset-2 col-lg-10"
>
<button
class=
"btn btn-primary btn-lg btn-block"
id=
"login"
type=
"submit"
>
[[global:login]]
</button>
<!-- IF allowRegistration -->
<span>
[[login:dont_have_account]]
<a
href=
"
{
config
.
relative_path
}
/register"
>
[[register:register]]
</a></span>
<!-- ENDIF allowRegistration -->
<!-- IF allowPasswordReset -->
<a
id=
"reset-link"
href=
"
{
config
.
relative_path
}
/reset"
>
[[login:forgot_password]]
</a>
<!-- ENDIF allowPasswordReset -->
{{
{
each
loginFormEntry
}
}}
<div
class=
"form-group loginFormEntry"
>
<label
for=
"login-
{
loginFormEntry
.
styleName
}
"
class=
"col-lg-4 control-label"
>
{
loginFormEntry
.
label
}
</label>
<div
id=
"login-
{
loginFormEntry
.
styleName
}
"
class=
"col-lg-8"
>
{
{
loginFormEntry
.
html
}
}
</div>
</div>
</div>
</form>
{{
{
end
}
}}
<input
type=
"hidden"
name=
"_csrf"
value=
"
{
config
.
csrf_token
}
"
/>
<input
type=
"hidden"
name=
"noscript"
id=
"noscript"
value=
"true"
/>
<div
class=
"form-group"
>
<div
class=
"col-lg-offset-2 col-lg-10"
>
<button
class=
"btn btn-primary btn-lg btn-block"
id=
"login"
type=
"submit"
>
[[global:login]]
</button>
<!-- IF allowRegistration -->
<span>
[[login:dont_have_account]]
<a
href=
"
{
config
.
relative_path
}
/register"
>
[[register:register]]
</a></span>
<!-- ENDIF allowRegistration -->
<!-- IF allowPasswordReset -->
<a
id=
"reset-link"
href=
"
{
config
.
relative_path
}
/reset"
>
[[login:forgot_password]]
</a>
<!-- ENDIF allowPasswordReset -->
</div>
</div>
</form>
</div>
</div>
</div>
<!-- ENDIF allowLocalLogin -->
{{{ end }}}
<!-- IF alternate_logins -->
<div
class=
"<!-- IF allowLocalLogin -->col-md-6<!-- ELSE -->col-md-12<!-- ENDIF allowLocalLogin -->"
>
<div
class=
"alt-login-block"
>
<h4>
[[login:alternative_logins]]
</h4>
<ul
class=
"alt-logins"
>
{{
{
each
authentication
}
}}
<li
class=
"
{
authentication
.
name
}
"
><a
rel=
"nofollow noopener noreferrer"
target=
"_top"
href=
"
{
config
.
relative_path
}{
authentication
.
url
}
"
><i
class=
"fa
{
authentication
.
icon
}
fa-3x"
></i></a></li>
{{
{
end
}
}}
</ul>
{{{ if alternate_logins }}}
<div
class=
"{{{ if allowLocalLogin }}}col-md-6<{{{ else }}}col-md-12{{{ end }}}"
>
<div
class=
"alt-login-block"
>
<h4>
[[login:alternative_logins]]
</h4>
<ul
class=
"alt-logins"
>
{{
{
each
authentication
}
}}
<li
class=
"
{
authentication
.
name
}
"
><a
rel=
"nofollow noopener noreferrer"
target=
"_top"
href=
"
{
config
.
relative_path
}{
authentication
.
url
}
"
><i
class=
"fa
{
authentication
.
icon
}
fa-3x"
></i></a></li>
{{
{
end
}
}}
</ul>
</div>
</div>
{{{ end }}}
</div>
<div
data-widget-area=
"sidebar"
class=
"col-lg-3 col-sm-12 {{{ if !widgets.sidebar.length }}}hidden{{{ end }}}"
>
{{
{
each
widgets
.
sidebar
}
}}
{
{
widgets
.
sidebar
.
html
}
}
{{
{
end
}
}}
</div>
<!-- ENDIF alternate_logins -->
</div>
<div
data-widget-area=
"footer"
>
{{
{
each
widgets
.
footer
}
}}
{
{
widgets
.
footer
.
html
}
}
{{
{
end
}
}}
</div>
\ No newline at end of file
templates/register.tpl
View file @
dbc87c8a
<!-- IMPORT partials/breadcrumbs.tpl -->
<div
data-widget-area=
"header"
>
{{
{
each
widgets
.
header
}
}}
{
{
widgets
.
header
.
html
}
}
{{
{
end
}
}}
</div>
<div
class=
"row register"
>
<div
class=
"
{
register_window
:
spansize
}
"
>
<div
class=
"register-block"
>
<div
class=
"alert alert-danger<!-- IF !error --> hidden<!-- ENDIF !error -->"
id=
"register-error-notify"
>
<strong>
[[error:registration-error]]
</strong>
<p>
{
error
}
</p>
</div>
<form
component=
"register/local"
class=
"form-horizontal"
role=
"form"
action=
"
{
config
.
relative_path
}
/register"
method=
"post"
>
<div
class=
"form-group"
>
<label
for=
"username"
class=
"col-lg-4 control-label"
>
[[register:username]]
</label>
<div
class=
"col-lg-8"
>
<input
class=
"form-control"
type=
"text"
placeholder=
"[[register:username_placeholder]]"
name=
"username"
id=
"username"
autocorrect=
"off"
autocapitalize=
"off"
autocomplete=
"off"
/>
<span
class=
"register-feedback"
id=
"username-notify"
></span>
<span
class=
"help-block"
>
[[register:help.username_restrictions,
{
minimumUsernameLength
}
,
{
maximumUsernameLength
}
]]
</span>
</div>
<div
class=
"row {{{ if widgets.sidebar.length }}}col-lg-9 col-sm-12{{{ else }}}col-lg-12{{{ end }}}"
>
<div
class=
"
{
register_window
:
spansize
}
"
>
<div
class=
"register-block"
>
<div
class=
"alert alert-danger<!-- IF !error --> hidden<!-- ENDIF !error -->"
id=
"register-error-notify"
>
<strong>
[[error:registration-error]]
</strong>
<p>
{
error
}
</p>
</div>
<div
class=
"form-group"
>
<label
for=
"password"
class=
"col-lg-4 control-label"
>
[[register:password]]
</label>
<div
class=
"col-lg-8"
>
<input
class=
"form-control"
type=
"password"
placeholder=
"[[register:password_placeholder]]"
name=
"password"
id=
"password"
/>
<span
class=
"register-feedback"
id=
"password-notify"
></span>
<span
class=
"help-block"
>
[[register:help.minimum_password_length,
{
minimumPasswordLength
}
]]
</span>
<p
id=
"caps-lock-warning"
class=
"text-danger hidden"
>
<i
class=
"fa fa-exclamation-triangle"
></i>
[[login:caps-lock-enabled]]
</p>
<form
component=
"register/local"
class=
"form-horizontal"
role=
"form"
action=
"
{
config
.
relative_path
}
/register"
method=
"post"
>
<div
class=
"form-group"
>
<label
for=
"username"
class=
"col-lg-4 control-label"
>
[[register:username]]
</label>
<div
class=
"col-lg-8"
>
<input
class=
"form-control"
type=
"text"
placeholder=
"[[register:username_placeholder]]"
name=
"username"
id=
"username"
autocorrect=
"off"
autocapitalize=
"off"
autocomplete=
"off"
/>
<span
class=
"register-feedback"
id=
"username-notify"
></span>
<span
class=
"help-block"
>
[[register:help.username_restrictions,
{
minimumUsernameLength
}
,
{
maximumUsernameLength
}
]]
</span>
</div>
</div>
</div>
<div
class=
"form-group"
>
<label
for=
"password-confirm"
class=
"col-lg-4 control-label"
>
[[register:confirm_password]]
</label>
<div
class=
"col-lg-8"
>
<input
class=
"form-control"
type=
"password"
placeholder=
"[[register:confirm_password_placeholder]]"
name=
"password-confirm"
id=
"password-confirm"
/>
<span
class=
"register-feedback"
id=
"password-confirm-notify"
></span>
<div
class=
"form-group"
>
<label
for=
"password"
class=
"col-lg-4 control-label"
>
[[register:password]]
</label>
<div
class=
"col-lg-8"
>
<input
class=
"form-control"
type=
"password"
placeholder=
"[[register:password_placeholder]]"
name=
"password"
id=
"password"
/>
<span
class=
"register-feedback"
id=
"password-notify"
></span>
<span
class=
"help-block"
>
[[register:help.minimum_password_length,
{
minimumPasswordLength
}
]]
</span>
<p
id=
"caps-lock-warning"
class=
"text-danger hidden"
>
<i
class=
"fa fa-exclamation-triangle"
></i>
[[login:caps-lock-enabled]]
</p>
</div>
</div>
<div
class=
"form-group"
>
<label
for=
"password-confirm"
class=
"col-lg-4 control-label"
>
[[register:confirm_password]]
</label>
<div
class=
"col-lg-8"
>
<input
class=
"form-control"
type=
"password"
placeholder=
"[[register:confirm_password_placeholder]]"
name=
"password-confirm"
id=
"password-confirm"
/>
<span
class=
"register-feedback"
id=
"password-confirm-notify"
></span>
</div>
</div>
</div>
{{
{
each
regFormEntry
}
}}
<div
class=
"form-group"
>
<label
for=
"register-
{
regFormEntry
.
styleName
}
"
class=
"col-lg-4 control-label"
>
{
regFormEntry
.
label
}
</label>
<div
id=
"register-
{
regFormEntry
.
styleName
}
"
class=
"col-lg-8"
>
{
{
regFormEntry
.
html
}
}
{{
{
each
regFormEntry
}
}}
<div
class=
"form-group"
>
<label
for=
"register-
{
regFormEntry
.
styleName
}
"
class=
"col-lg-4 control-label"
>
{
regFormEntry
.
label
}
</label>
<div
id=
"register-
{
regFormEntry
.
styleName
}
"
class=
"col-lg-8"
>
{
{
regFormEntry
.
html
}
}
</div>
</div>
</div>
{{
{
end
}
}}
{{
{
end
}
}}
<div
class=
"form-group"
>
<div
class=
"col-lg-offset-4 col-lg-8"
>
<button
class=
"btn btn-primary btn-lg btn-block"
id=
"register"
type=
"submit"
>
[[register:register_now_button]]
</button>
<div
class=
"form-group"
>
<div
class=
"col-lg-offset-4 col-lg-8"
>
<button
class=
"btn btn-primary btn-lg btn-block"
id=
"register"
type=
"submit"
>
[[register:register_now_button]]
</button>
</div>
</div>
</div
>
<input
id=
"
token
"
type=
"hidden"
name=
"
token
"
value=
""
/>
<input
id=
"noscript"
type=
"hidden"
name=
"
noscript
"
value=
"
true
"
/>
<
input
type=
"hidden"
name=
"_csrf"
value=
"
{
config
.
csrf_token
}
"
/
>
</
form
>
<input
id=
"token"
type=
"hidden"
name=
"token"
value=
""
/
>
<input
id=
"
noscript
"
type=
"hidden"
name=
"
noscript
"
value=
"
true
"
/>
<input
type=
"hidden"
name=
"
_csrf
"
value=
"
{
config
.
csrf_token
}
"
/>
<
/form
>
</
div
>
</div>
</div>
<!-- IF alternate_logins -->
<div
class=
"col-md-6"
>
<div
class=
"alt-register-block"
>
<h4>
[[register:alternative_registration]]
</h4>
<ul
class=
"alt-logins"
>
{{
{
each
authentication
}
}}
<li
class=
"
{
authentication
.
name
}
"
><a
rel=
"nofollow noopener noreferrer"
target=
"_top"
href=
"
{
config
.
relative_path
}{
authentication
.
url
}
"
><i
class=
"fa
{
authentication
.
icon
}
fa-3x"
></i></i></a></li>
{{
{
end
}
}}
</ul>
{{{ if alternate_logins }}}
<div
class=
"col-md-6"
>
<div
class=
"alt-register-block"
>
<h4>
[[register:alternative_registration]]
</h4>
<ul
class=
"alt-logins"
>
{{
{
each
authentication
}
}}
<li
class=
"
{
authentication
.
name
}
"
><a
rel=
"nofollow noopener noreferrer"
target=
"_top"
href=
"
{
config
.
relative_path
}{
authentication
.
url
}
"
><i
class=
"fa
{
authentication
.
icon
}
fa-3x"
></i></i></a></li>
{{
{
end
}
}}
</ul>
</div>
</div>
{{{ end }}}
</div>
<div
data-widget-area=
"sidebar"
class=
"col-lg-3 col-sm-12 {{{ if !widgets.sidebar.length }}}hidden{{{ end }}}"
>
{{
{
each
widgets
.
sidebar
}
}}
{
{
widgets
.
sidebar
.
html
}
}
{{
{
end
}
}}
</div>
<!-- ENDIF alternate_logins -->
</div>
<div
data-widget-area=
"footer"
>
{{
{
each
widgets
.
footer
}
}}
{
{
widgets
.
footer
.
html
}
}
{{
{
end
}
}}
</div>
\ No newline at end of file
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