Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wiki-js
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
1
Issues
1
List
Board
Labels
Milestones
Merge Requests
1
Merge Requests
1
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Jacklull
wiki-js
Commits
69c342f8
Commit
69c342f8
authored
May 02, 2017
by
NGPixel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: Authentication localization
parent
06035786
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
56 additions
and
20 deletions
+56
-20
auth.js
server/controllers/auth.js
+5
-5
auth.js
server/libs/auth.js
+1
-1
auth.json
server/locales/en/auth.json
+19
-2
errors.json
server/locales/en/errors.json
+19
-0
login.pug
server/views/auth/login.pug
+12
-12
No files found.
server/controllers/auth.js
View file @
69c342f8
...
...
@@ -20,8 +20,8 @@ const bruteforce = new ExpressBrute(EBstore, {
failCallback
(
req
,
res
,
next
,
nextValidRequestDate
)
{
req
.
flash
(
'alert'
,
{
class
:
'error'
,
title
:
'Too many attempts!'
,
message
:
"You've made too many failed attempts in a short period of time, please try again "
+
moment
(
nextValidRequestDate
).
fromNow
()
+
'.'
,
title
:
lang
.
t
(
'auth:errors.toomanyattempts'
)
,
message
:
lang
.
t
(
'auth:errors.toomanyattemptsmsg'
,
{
time
:
moment
(
nextValidRequestDate
).
fromNow
()
})
,
iconClass
:
'fa-times'
})
res
.
redirect
(
'/login'
)
...
...
@@ -71,13 +71,13 @@ router.post('/login', bruteforce.prevent, function (req, res, next) {
// LOGIN FAIL
if
(
err
.
message
===
'INVALID_LOGIN'
)
{
req
.
flash
(
'alert'
,
{
title
:
'Invalid login'
,
message
:
'The email or password is invalid.'
title
:
lang
.
t
(
'auth:errors.invalidlogin'
)
,
message
:
lang
.
t
(
'auth:errors.invalidloginmsg'
)
})
return
res
.
redirect
(
'/login'
)
}
else
{
req
.
flash
(
'alert'
,
{
title
:
'Login error'
,
title
:
lang
.
t
(
'auth:errors.loginerror'
)
,
message
:
err
.
message
})
return
res
.
redirect
(
'/login'
)
...
...
server/libs/auth.js
View file @
69c342f8
...
...
@@ -16,7 +16,7 @@ module.exports = function (passport) {
if
(
user
)
{
done
(
null
,
user
)
}
else
{
done
(
new
Error
(
'User not found.'
),
null
)
done
(
new
Error
(
lang
.
t
(
'auth:errors:usernotfound'
)
),
null
)
}
return
true
}).
catch
((
err
)
=>
{
...
...
server/locales/en/auth.json
View file @
69c342f8
{
"loginrequired"
:
"Login required"
,
"loginusing"
:
"Log in using..."
,
"loginusingalt"
:
"Or, log in using..."
,
"fields"
:
{
"emailuser"
:
"Email / Username"
,
"password"
:
"Password"
},
"actions"
:
{
"login"
:
"Log In"
},
"errors"
:
{
"invalidlogin"
:
"Invalid Login"
,
"invalidloginmsg"
:
"The email or password is invalid."
,
"loginerror"
:
"Login error"
,
"toomanyattempts"
:
"Too many attempts!"
,
"toomanyattemptsmsg"
:
"You've made too many failed attempts in a short period of time, please try again {{time}}."
,
"usernotfound"
:
"User not found"
},
"providers"
:
{
"local"
:
"Local"
,
"windowslive"
:
"Microsoft Account"
,
...
...
@@ -9,4 +27,4 @@
"slack"
:
"Slack"
,
"ldap"
:
"LDAP / Active Directory"
}
}
\ No newline at end of file
}
server/locales/en/errors.json
0 → 100644
View file @
69c342f8
{
"generic"
:
"Oops, something went wrong"
,
"notexistdetail"
:
"Would you like to create this entry?"
,
"forbidden"
:
"Forbidden"
,
"forbiddendetail"
:
"Sorry, you don't have the necessary permissions to access this page."
,
"unauthorized"
:
"Unauthorized"
,
"debugmsg"
:
"Detailed debug trail"
,
"invalidaction"
:
"Invalid Action."
,
"invalidpath"
:
"Invalid page path."
,
"invaliduserid"
:
"Invalid User Id"
,
"reservedname"
:
"You cannot create a document with this name as it is reserved by the system."
,
"alreadyexists"
:
"This entry already exists!"
,
"starterfailed"
:
"Could not load starter content!"
,
"actions"
:
{
"create"
:
"Create"
,
"gohome"
:
"Go Home"
,
"loginas"
:
"Login as..."
}
}
server/views/auth/login.pug
View file @
69c342f8
...
...
@@ -26,7 +26,7 @@ html(data-logic='login')
div(style='background-image:url(/images/bg_' + bg + '.jpg);')
#root
h1= appconfig.title
h2
Login required
h2
= t('auth:loginrequired')
if appflash.length > 0
h3
i.icon-warning-outline
...
...
@@ -34,39 +34,39 @@ html(data-logic='login')
h4= appflash[0].message
if appconfig.auth.local.enabled
form(method='post', action='/login')
input#login-user(type='text', name='email', placeholder=
'Email / Username'
)
input#login-pass(type='password', name='password', placeholder=
'Password'
)
button(type='submit')
Log In
input#login-user(type='text', name='email', placeholder=
t('auth:fields.emailuser')
)
input#login-pass(type='password', name='password', placeholder=
t('auth:fields.password')
)
button(type='submit')
= t('auth:actions.login')
if appconfig.authStrategies.socialEnabled
#social
if appconfig.auth.local.enabled
span
Or, log in using...
span
= t('auth:loginusingalt')
else
span
Log in using...
span
= t('auth:loginusing')
if appconfig.auth.microsoft && appconfig.auth.microsoft.enabled
button.ms(onclick='window.location.assign("/login/ms")')
i.icon-windows2
span
Microsoft Account
span
= t('auth:providers.windowslive')
if appconfig.auth.azure && appconfig.auth.azure.enabled
button.ms(onclick='window.location.assign("/login/azure")')
i.icon-windows2
span
Azure AD
span
= t('auth:providers.azure')
if appconfig.auth.google && appconfig.auth.google.enabled
button.google(onclick='window.location.assign("/login/google")')
i.icon-google
span
Google ID
span
= t('auth:providers.google')
if appconfig.auth.facebook && appconfig.auth.facebook.enabled
button.facebook(onclick='window.location.assign("/login/facebook")')
i.icon-facebook
span
Facebook
span
= t('auth:providers.facebook')
if appconfig.auth.github && appconfig.auth.github.enabled
button.github(onclick='window.location.assign("/login/github")')
i.icon-github
span
GitHub
span
= t('auth:providers.github')
if appconfig.auth.slack && appconfig.auth.slack.enabled
button.slack(onclick='window.location.assign("/login/slack")')
i.icon-slack
span
Slack
span
= t('auth:providers.slack')
#copyright
= t('footer.poweredby') + ' '
a.icon(href='https://github.com/Requarks/wiki')
...
...
Write
Preview
Markdown
is supported
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