|
| 1 | +# Login Page Customization |
| 2 | + |
| 3 | +code-server allows you to customize the login page appearance and messages through CLI arguments, environment variables, or configuration files. |
| 4 | + |
| 5 | +## Available Customization Options |
| 6 | + |
| 7 | +### Branding and Appearance |
| 8 | +- **Login Title**: Customize the main title on the login page |
| 9 | +- **Welcome Text**: Set custom welcome message |
| 10 | +- **App Name**: Change the application branding throughout the interface |
| 11 | + |
| 12 | +### Login Messages |
| 13 | +- **Password Instructions**: Customize the message explaining where to find the password |
| 14 | +- **Environment Password Message**: Custom message when password is set via `$PASSWORD` |
| 15 | +- **Hashed Password Message**: Custom message when password is set via `$HASHED_PASSWORD` |
| 16 | + |
| 17 | +### Form Elements |
| 18 | +- **Password Placeholder**: Custom placeholder text for the password field |
| 19 | +- **Submit Button**: Custom text for the login button |
| 20 | + |
| 21 | +### Error Messages |
| 22 | +- **Rate Limit Message**: Custom message when login attempts are rate limited |
| 23 | +- **Missing Password**: Custom message for empty password submissions |
| 24 | +- **Incorrect Password**: Custom message for wrong password attempts |
| 25 | + |
| 26 | +## Configuration Methods |
| 27 | + |
| 28 | +### CLI Arguments |
| 29 | + |
| 30 | +```bash |
| 31 | +code-server \ |
| 32 | + --app-name "My Development Server" \ |
| 33 | + --welcome-text "Welcome to the development environment" \ |
| 34 | + --login-title "Secure Access Portal" \ |
| 35 | + --login-below "Please authenticate to continue" \ |
| 36 | + --password-placeholder "Enter your access code" \ |
| 37 | + --submit-text "AUTHENTICATE" \ |
| 38 | + --login-env-password-msg "Access code provided via environment variable" \ |
| 39 | + --login-rate-limit-msg "Too many attempts. Please wait before trying again." \ |
| 40 | + --missing-password-msg "Access code is required" \ |
| 41 | + --incorrect-password-msg "Invalid access code" |
| 42 | +``` |
| 43 | + |
| 44 | +### Environment Variables |
| 45 | + |
| 46 | +Perfect for Docker deployments and containerized environments: |
| 47 | + |
| 48 | +```bash |
| 49 | +# Basic branding |
| 50 | +export CS_APP_NAME="My Development Server" |
| 51 | +export CS_WELCOME_TEXT="Welcome to the development environment" |
| 52 | + |
| 53 | +# Login page customization |
| 54 | +export CS_LOGIN_TITLE="Secure Access Portal" |
| 55 | +export CS_LOGIN_BELOW="Please authenticate to continue" |
| 56 | +export CS_PASSWORD_PLACEHOLDER="Enter your access code" |
| 57 | +export CS_SUBMIT_TEXT="AUTHENTICATE" |
| 58 | + |
| 59 | +# Message customization |
| 60 | +export CS_LOGIN_ENV_PASSWORD_MSG="Access code provided via environment variable" |
| 61 | +export CS_LOGIN_RATE_LIMIT_MSG="Too many attempts. Please wait before trying again." |
| 62 | +export CS_MISSING_PASSWORD_MSG="Access code is required" |
| 63 | +export CS_INCORRECT_PASSWORD_MSG="Invalid access code" |
| 64 | + |
| 65 | +code-server |
| 66 | +``` |
| 67 | + |
| 68 | +### Configuration File |
| 69 | + |
| 70 | +Add to your `~/.config/code-server/config.yaml`: |
| 71 | + |
| 72 | +```yaml |
| 73 | +bind-addr: 127.0.0.1:8080 |
| 74 | +auth: password |
| 75 | +password: your-password |
| 76 | + |
| 77 | +# Branding |
| 78 | +app-name: "My Development Server" |
| 79 | +welcome-text: "Welcome to the development environment" |
| 80 | + |
| 81 | +# Login page |
| 82 | +login-title: "Secure Access Portal" |
| 83 | +login-below: "Please authenticate to continue" |
| 84 | +password-placeholder: "Enter your access code" |
| 85 | +submit-text: "AUTHENTICATE" |
| 86 | + |
| 87 | +# Messages |
| 88 | +login-env-password-msg: "Access code provided via environment variable" |
| 89 | +login-rate-limit-msg: "Too many attempts. Please wait before trying again." |
| 90 | +missing-password-msg: "Access code is required" |
| 91 | +incorrect-password-msg: "Invalid access code" |
| 92 | +``` |
| 93 | +
|
| 94 | +## Docker Examples |
| 95 | +
|
| 96 | +### Basic Docker Deployment with Customization |
| 97 | +
|
| 98 | +```bash |
| 99 | +docker run -it --name code-server -p 127.0.0.1:8080:8080 \ |
| 100 | + -v "$PWD:/home/coder/project" \ |
| 101 | + -e "CS_LOGIN_TITLE=Development Environment" \ |
| 102 | + -e "CS_LOGIN_ENV_PASSWORD_MSG=Password configured in container environment" \ |
| 103 | + -e "CS_PASSWORD_PLACEHOLDER=Enter development password" \ |
| 104 | + -e "CS_SUBMIT_TEXT=ACCESS ENVIRONMENT" \ |
| 105 | + codercom/code-server:latest |
| 106 | +``` |
| 107 | + |
| 108 | +### Corporate Branding Example |
| 109 | + |
| 110 | +```bash |
| 111 | +docker run -it --name code-server -p 127.0.0.1:8080:8080 \ |
| 112 | + -v "$PWD:/home/coder/project" \ |
| 113 | + -e "CS_APP_NAME=ACME Corporation Dev Portal" \ |
| 114 | + -e "CS_LOGIN_TITLE=ACME Development Portal" \ |
| 115 | + -e "CS_LOGIN_BELOW=Enter your corporate credentials" \ |
| 116 | + -e "CS_PASSWORD_PLACEHOLDER=Corporate Password" \ |
| 117 | + -e "CS_SUBMIT_TEXT=SIGN IN" \ |
| 118 | + -e "CS_LOGIN_ENV_PASSWORD_MSG=Password managed by IT department" \ |
| 119 | + codercom/code-server:latest |
| 120 | +``` |
| 121 | + |
| 122 | +## Priority Order |
| 123 | + |
| 124 | +Settings are applied in the following priority order (highest to lowest): |
| 125 | + |
| 126 | +1. **CLI arguments** - Highest priority |
| 127 | +2. **Environment variables** - Medium priority |
| 128 | +3. **Config file** - Lowest priority |
| 129 | + |
| 130 | +This allows you to set defaults in your config file and override them with environment variables or CLI arguments as needed. |
| 131 | + |
| 132 | +## Complete Reference |
| 133 | + |
| 134 | +| CLI Argument | Environment Variable | Description | |
| 135 | +|--------------|---------------------|-------------| |
| 136 | +| `--app-name` | `CS_APP_NAME` | Application name used throughout the interface | |
| 137 | +| `--welcome-text` | `CS_WELCOME_TEXT` | Welcome message on login page | |
| 138 | +| `--login-title` | `CS_LOGIN_TITLE` | Main title on login page | |
| 139 | +| `--login-below` | `CS_LOGIN_BELOW` | Text below the login title | |
| 140 | +| `--password-placeholder` | `CS_PASSWORD_PLACEHOLDER` | Password field placeholder text | |
| 141 | +| `--submit-text` | `CS_SUBMIT_TEXT` | Login button text | |
| 142 | +| `--login-password-msg` | `CS_LOGIN_PASSWORD_MSG` | Message for config file password | |
| 143 | +| `--login-env-password-msg` | `CS_LOGIN_ENV_PASSWORD_MSG` | Message when using `$PASSWORD` env var | |
| 144 | +| `--login-hashed-password-msg` | `CS_LOGIN_HASHED_PASSWORD_MSG` | Message when using `$HASHED_PASSWORD` env var | |
| 145 | +| `--login-rate-limit-msg` | `CS_LOGIN_RATE_LIMIT_MSG` | Rate limiting error message | |
| 146 | +| `--missing-password-msg` | `CS_MISSING_PASSWORD_MSG` | Empty password error message | |
| 147 | +| `--incorrect-password-msg` | `CS_INCORRECT_PASSWORD_MSG` | Wrong password error message | |
0 commit comments