summaryrefslogtreecommitdiff
path: root/app/views/configure/users.phtml
blob: 990c80acc055319c12d9cea08f486f05e9de50a4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
<?php $this->partial('aside_configure'); ?>

<div class="post">
	<a href="<?php echo _url('index', 'index'); ?>"><?php echo Minz_Translate::t('back_to_rss_feeds'); ?></a>

	<form method="post" action="<?php echo _url('users', 'auth'); ?>">
		<legend><?php echo Minz_Translate::t('login_configuration'); ?></legend>

		<div class="form-group">
			<label class="group-name" for="current_user"><?php echo Minz_Translate::t('current_user'); ?></label>
			<div class="group-controls">
				<input id="current_user" type="text" disabled="disabled" value="<?php echo Minz_Session::param('currentUser', '_'); ?>" />
				<label class="checkbox" for="is_admin">
					<input type="checkbox" id="is_admin" disabled="disabled" <?php echo Minz_Configuration::isAdmin(Minz_Session::param('currentUser', '_')) ? 'checked="checked" ' : ''; ?>/>
					<?php echo Minz_Translate::t('is_admin'); ?>
				</label>
			</div>
		</div>

		<div class="form-group">
			<label class="group-name" for="passwordPlain"><?php echo Minz_Translate::t('password_form'); ?></label>
			<div class="group-controls">
				<input type="password" id="passwordPlain" name="passwordPlain" pattern=".{7,}" />
				<noscript><b><?php echo Minz_Translate::t('javascript_should_be_activated'); ?></b></noscript>
			</div>
		</div>

		<div class="form-group">
			<label class="group-name" for="mail_login"><?php echo Minz_Translate::t('persona_connection_email'); ?></label>
			<?php $mail = $this->conf->mail_login; ?>
			<div class="group-controls">
				<input type="email" id="mail_login" name="mail_login" value="<?php echo $mail; ?>" <?php echo Minz_Configuration::isAdmin(Minz_Session::param('currentUser', '_')) ? '' : 'disabled="disabled"'; ?> placeholder="alice@example.net" />
				<noscript><b><?php echo Minz_Translate::t('javascript_should_be_activated'); ?></b></noscript>
			</div>
		</div>

		<div class="form-group form-actions">
			<div class="group-controls">
				<button type="submit" class="btn btn-important"><?php echo Minz_Translate::t('save'); ?></button>
				<button type="reset" class="btn"><?php echo Minz_Translate::t('cancel'); ?></button>
			</div>
		</div>

	<?php if (Minz_Configuration::isAdmin(Minz_Session::param('currentUser', '_'))) { ?>

		<legend><?php echo Minz_Translate::t('auth_type'); ?></legend>

		<div class="form-group">
			<label class="group-name" for="auth_type"><?php echo Minz_Translate::t('auth_type'); ?></label>
			<div class="group-controls">
				<select id="auth_type" name="auth_type" required="required">
					<option value=""></option>
					<option value="form"<?php echo Minz_Configuration::authType() === 'form' ? ' selected="selected"' : '', version_compare(PHP_VERSION, '5.3', '<') ? ' disabled="disabled"' : ''; ?>><?php echo Minz_Translate::t('auth_form'); ?></option>
					<option value="persona"<?php echo Minz_Configuration::authType() === 'persona' ? ' selected="selected"' : '', $this->conf->mail_login == '' ? ' disabled="disabled"' : ''; ?>><?php echo Minz_Translate::t('auth_persona'); ?></option>
					<option value="http_auth"<?php echo Minz_Configuration::authType() === 'http_auth' ? ' selected="selected"' : '', httpAuthUser() == '' ? ' disabled="disabled"' : ''; ?>><?php echo Minz_Translate::t('http_auth'); ?> (REMOTE_USER = '<?php echo httpAuthUser(); ?>')</option>
					<option value="none"<?php echo Minz_Configuration::authType() === 'none' ? ' selected="selected"' : ''; ?>><?php echo Minz_Translate::t('auth_none'); ?></option>
				</select>
			</div>
		</div>

		<div class="form-group">
			<div class="group-controls">
				<label class="checkbox" for="anon_access">
					<input type="checkbox" name="anon_access" id="anon_access" value="1"<?php echo Minz_Configuration::allowAnonymous() ? ' checked="checked"' : '',
						Minz_Configuration::canLogIn() ? '' : ' disabled="disabled"'; ?> />
					<?php echo Minz_Translate::t('allow_anonymous', Minz_Configuration::defaultUser()); ?>
				</label>
			</div>
		</div>

		<?php if (Minz_Configuration::canLogIn()) { ?>
		<div class="form-group">
			<label class="group-name" for="token"><?php echo Minz_Translate::t('auth_token'); ?></label>
			<?php $token = $this->conf->token; ?>
			<div class="group-controls">
				<input type="text" id="token" name="token" value="<?php echo $token; ?>"  placeholder="<?php echo Minz_Translate::t('blank_to_disable'); ?>"<?php
					echo Minz_Configuration::canLogIn() ? '' : ' disabled="disabled"'; ?> />
				<?php echo FreshRSS_Themes::icon('help'); ?> <?php echo Minz_Translate::t('explain_token', Minz_Url::display(null, 'html', true), $token); ?>
			</div>
		</div>
		<?php } ?>

		<div class="form-group form-actions">
			<div class="group-controls">
				<button type="submit" class="btn btn-important"><?php echo Minz_Translate::t('save'); ?></button>
				<button type="reset" class="btn"><?php echo Minz_Translate::t('cancel'); ?></button>
			</div>
		</div>
	</form>

	<form method="post" action="<?php echo _url('users', 'delete'); ?>">
		<legend><?php echo Minz_Translate::t('users'); ?></legend>

		<div class="form-group">
			<label class="group-name" for="users_list"><?php echo Minz_Translate::t('users_list'); ?></label>
			<div class="group-controls">
				<select id="users_list" name="username"><?php
					foreach (listUsers() as $user) {
						echo '<option>', $user, '</option>';
					}
				?></select>
			</div>
		</div>
	
		<div class="form-group form-actions">
			<div class="group-controls">
				<button type="submit" class="btn btn-attention confirm"><?php echo Minz_Translate::t('delete'); ?></button>
			</div>
		</div>
	</form>

	<form method="post" action="<?php echo _url('users', 'create'); ?>">
		<legend><?php echo Minz_Translate::t('create_user'); ?></legend>

		<div class="form-group">
			<label class="group-name" for="new_user_language"><?php echo Minz_Translate::t ('language'); ?></label>
			<div class="group-controls">
				<select name="new_user_language" id="new_user_language">
				<?php $languages = $this->conf->availableLanguages (); ?>
				<?php foreach ($languages as $short => $lib) { ?>
				<option value="<?php echo $short; ?>"<?php echo $this->conf->language === $short ? ' selected="selected"' : ''; ?>><?php echo $lib; ?></option>
				<?php } ?>
				</select>
			</div>
		</div>

		<div class="form-group">
			<label class="group-name" for="new_user_name"><?php echo Minz_Translate::t('username'); ?></label>
			<div class="group-controls">
				<input id="new_user_name" name="new_user_name" type="text" size="16" required="required" maxlength="16" pattern="[0-9a-zA-Z]{1,16}" placeholder="demo" />
			</div>
		</div>

		<div class="form-group">
			<label class="group-name" for="new_user_passwordPlain"><?php echo Minz_Translate::t('password_form'); ?></label>
			<div class="group-controls">
				<input type="password" id="new_user_passwordPlain" name="new_user_passwordPlain" pattern=".{7,}" />
				<noscript><b><?php echo Minz_Translate::t('javascript_should_be_activated'); ?></b></noscript>
			</div>
		</div>

		<div class="form-group">
			<label class="group-name" for="new_user_email"><?php echo Minz_Translate::t('persona_connection_email'); ?></label>
			<?php $mail = $this->conf->mail_login; ?>
			<div class="group-controls">
				<input type="email" id="new_user_email" name="new_user_email" placeholder="alice@example.net" />
			</div>
		</div>

		<div class="form-group form-actions">
			<div class="group-controls">
				<button type="submit" class="btn btn-important"><?php echo Minz_Translate::t('create'); ?></button>
				<button type="reset" class="btn"><?php echo Minz_Translate::t('cancel'); ?></button>
			</div>
		</div>

	</form>

	<?php } ?>
</div>