Page Menu
Home
Musing Studio
Search
Configure Global Search
Log In
Files
F12570655
admin.go
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
574 B
Subscribers
None
admin.go
View Options
package
writefreely
import
(
"fmt"
"github.com/writeas/impart"
"github.com/writeas/web-core/auth"
"net/http"
)
func
adminResetPassword
(
app
*
app
,
u
*
User
,
newPass
string
)
error
{
hashedPass
,
err
:=
auth
.
HashPass
([]
byte
(
newPass
))
if
err
!=
nil
{
return
impart
.
HTTPError
{
http
.
StatusInternalServerError
,
fmt
.
Sprintf
(
"Could not create password hash: %v"
,
err
)}
}
err
=
app
.
db
.
ChangePassphrase
(
u
.
ID
,
true
,
""
,
hashedPass
)
if
err
!=
nil
{
return
impart
.
HTTPError
{
http
.
StatusInternalServerError
,
fmt
.
Sprintf
(
"Could not update passphrase: %v"
,
err
)}
}
return
nil
}
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sun, Nov 23, 7:39 AM (1 d, 15 h)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
3502513
Attached To
rWF WriteFreely
Event Timeline
Log In to Comment