Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
Wolfgang Knopki
Spacedeck-open-SAML
Commits
a92b915b
Commit
a92b915b
authored
Apr 09, 2020
by
mntmn
Browse files
fix password recovery
parent
f5a6adc4
Changes
3
Hide whitespace changes
Inline
Side-by-side
public/javascripts/spacedeck_users.js
View file @
a92b915b
...
...
@@ -196,27 +196,29 @@ SpacedeckUsers = {
this
.
password_reset_confirm_error
=
null
;
this
.
password_reset_send
=
false
;
if
(
password
!=
password_confirmation
)
{
if
(
password
!=
password_confirmation
)
{
this
.
password_reset_confirm_error
=
"
Passwords do not match.
"
;
return
;
}
if
(
password
.
length
<
5
)
{
if
(
password
.
length
<
5
)
{
this
.
password_reset_confirm_error
=
"
Password too short (must have at least 5 characters).
"
;
return
;
}
confirm_password_reset
(
password
,
this
.
reset_token
,
function
(
parsed
,
req
)
{
if
(
req
.
status
==
201
){
if
(
req
.
status
==
201
)
{
alert
(
"
New password set successfully.
"
);
this
.
active_view
=
"
login
"
;
}
else
{
alert
(
"
An unknown error occured.
"
);
}
}.
bind
(
this
),
function
(
req
)
{
if
(
req
.
status
==
404
)
{
var
msg
=
"
user not found
"
;
alert
(
"
Error: Unknown user.
"
)
;
}
else
{
var
msg
=
"
e
rror:
"
+
req
.
statusText
;
alert
(
"
E
rror:
"
+
req
.
statusText
)
;
}
this
.
password_reset_confirm_error
=
msg
;
}.
bind
(
this
));
},
...
...
routes/api/users.js
View file @
a92b915b
...
...
@@ -289,15 +289,10 @@ router.post('/password_reset_requests/:confirm_token/confirm', function(req, res
if
(
user
)
{
bcrypt
.
genSalt
(
10
,
(
err
,
salt
)
=>
{
bcrypt
.
hash
(
password
,
salt
,
function
(
err
,
hash
)
{
user
.
password_hash
=
hash
;
user
.
password_token
=
null
;
user
.
save
(
function
(
err
,
updatedUser
){
if
(
err
)
{
res
.
sendStatus
(
400
);
}
else
{
res
.
sendStatus
(
201
);
}
user
.
save
().
then
(
function
(
updatedUser
)
{
res
.
sendStatus
(
201
);
});
});
});
...
...
views/partials/login.html
View file @
a92b915b
...
...
@@ -57,7 +57,7 @@
</div>
<div
class=
"form-group"
>
<input
class=
"input"
id=
"user-password-confirmation"
required
type=
"password"
v-model=
"signup_password_confirmation"
placeholder=
"
[[__("
password_confirmation
")]]
"
>
<input
class=
"input"
id=
"user-password-confirmation"
required
type=
"password"
v-model=
"signup_password_confirmation"
placeholder=
"
Repeat Password
"
>
</div>
</div>
...
...
@@ -98,8 +98,8 @@
</form>
</div>
<div
class=
"content"
v-if=
"password_reset_send==true"
>
<h4>
[[__("password_confirmation")]]
</h4>
[[__("password_check_
inbox
")]]
<h4>
Reset Password
</h4>
Please check your email
inbox
.
</div>
</div>
...
...
@@ -110,11 +110,11 @@
<div
class=
"tight"
>
<div
class=
"form-group"
>
<input
class=
"input"
id=
"user-password"
type=
"password"
v-model=
"signup_password"
placeholder=
"
[[__("
p
assword
"
)]]"
>
<input
class=
"input"
id=
"user-password"
type=
"password"
v-model=
"signup_password"
placeholder=
"
New P
assword"
>
</div>
<div
class=
"form-group"
>
<input
class=
"input"
id=
"user-password"
type=
"password"
v-model=
"signup_password_confirmation"
placeholder=
"
[[__("
password_confirmation
")]]
"
>
<input
class=
"input"
id=
"user-password"
type=
"password"
v-model=
"signup_password_confirmation"
placeholder=
"
Repeat Password
"
>
</div>
</div>
...
...
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