Rename manager to browser (#406)

* rename File Manager to File Browser

* rename fm to fb
This commit is contained in:
1138-4EB
2018-04-23 23:42:52 +02:00
committed by Henrique Dias
parent cd0ab77388
commit 7643b0c4e3
16 changed files with 225 additions and 225 deletions

View File

@@ -9,7 +9,7 @@ import (
"github.com/dgrijalva/jwt-go"
"github.com/dgrijalva/jwt-go/request"
fm "github.com/filebrowser/filebrowser"
fb "github.com/filebrowser/filebrowser"
)
const reCaptchaAPI = "/recaptcha/api/siteverify"
@@ -50,7 +50,7 @@ func reCaptcha(host, secret, response string) (bool, error) {
}
// authHandler processes the authentication for the user.
func authHandler(c *fm.Context, w http.ResponseWriter, r *http.Request) (int, error) {
func authHandler(c *fb.Context, w http.ResponseWriter, r *http.Request) (int, error) {
// NoAuth instances shouldn't call this method.
if c.NoAuth {
return 0, nil
@@ -86,7 +86,7 @@ func authHandler(c *fm.Context, w http.ResponseWriter, r *http.Request) (int, er
}
// Checks if the password is correct.
if !fm.CheckPasswordHash(cred.Password, u.Password) {
if !fb.CheckPasswordHash(cred.Password, u.Password) {
return http.StatusForbidden, nil
}
@@ -96,7 +96,7 @@ func authHandler(c *fm.Context, w http.ResponseWriter, r *http.Request) (int, er
// renewAuthHandler is used when the front-end already has a JWT token
// and is checking if it is up to date. If so, updates its info.
func renewAuthHandler(c *fm.Context, w http.ResponseWriter, r *http.Request) (int, error) {
func renewAuthHandler(c *fb.Context, w http.ResponseWriter, r *http.Request) (int, error) {
ok, u := validateAuth(c, r)
if !ok {
return http.StatusForbidden, nil
@@ -108,15 +108,15 @@ func renewAuthHandler(c *fm.Context, w http.ResponseWriter, r *http.Request) (in
// claims is the JWT claims.
type claims struct {
fm.User
fb.User
jwt.StandardClaims
}
// printToken prints the final JWT token to the user.
func printToken(c *fm.Context, w http.ResponseWriter) (int, error) {
func printToken(c *fb.Context, w http.ResponseWriter) (int, error) {
// Creates a copy of the user and removes it password
// hash so it never arrives to the user.
u := fm.User{}
u := fb.User{}
u = *c.User
u.Password = ""
@@ -125,7 +125,7 @@ func printToken(c *fm.Context, w http.ResponseWriter) (int, error) {
u,
jwt.StandardClaims{
ExpiresAt: time.Now().Add(time.Hour * 24).Unix(),
Issuer: "File Manager",
Issuer: "File Browser",
},
}
@@ -165,7 +165,7 @@ func (e extractor) ExtractToken(r *http.Request) (string, error) {
// validateAuth is used to validate the authentication and returns the
// User if it is valid.
func validateAuth(c *fm.Context, r *http.Request) (bool, *fm.User) {
func validateAuth(c *fb.Context, r *http.Request) (bool, *fb.User) {
if c.NoAuth {
c.User = c.DefaultUser
return true, c.User