feat(auth): enhance login flow with notifications and path normalization
- add success notification on successful login - show error notification with detailed message on login failure - normalize API paths to prevent double slashes and trailing slashes - redirect to login page only if not on login request or page
This commit is contained in:
@@ -126,7 +126,7 @@ var usersRemoveCmd = &cobra.Command{
|
||||
}
|
||||
|
||||
func init() {
|
||||
usersCmd.PersistentFlags().StringVar(&serverConfigPath, "server-config", "", "server config file (default: config.json or ~/.whatshooked/config.json)")
|
||||
usersCmd.PersistentFlags().StringVar(&serverConfigPath, "server-config", "", "server config file (default: config.json, ../config.json, or ~/.whatshooked/config.json)")
|
||||
|
||||
usersAddCmd.Flags().StringVarP(&addUsername, "username", "u", "", "Username")
|
||||
usersAddCmd.Flags().StringVarP(&addEmail, "email", "e", "", "Email address")
|
||||
@@ -156,6 +156,9 @@ func resolveServerConfigPath() string {
|
||||
if _, err := os.Stat("config.json"); err == nil {
|
||||
return "config.json"
|
||||
}
|
||||
if _, err := os.Stat("../config.json"); err == nil {
|
||||
return "../config.json"
|
||||
}
|
||||
home, err := os.UserHomeDir()
|
||||
if err == nil {
|
||||
p := filepath.Join(home, ".whatshooked", "config.json")
|
||||
|
||||
Reference in New Issue
Block a user